Friday, March 01, 2013

Shortening URLs in iOS


NSString *url = @"http://www.example.com";
NSString *apiUrl = [NSString stringWithFormat:@"http://api.tr.im/v1/trim_simple?url=%@",url];
NSString *shortURL = [NSString stringWithContentsOfURL:[NSURL URLWithString:apiUrl]
encoding:NSASCIIStringEncoding
error:nil];
NSLog(@"Long: %@ = Short: %@",url,shortURL);

No comments:

Create a list in SwiftUI with sticky section headers

 Sample Code import SwiftUI struct ContentView : View {     @State var isCustomViewControllerDisplayed = false     @State private va...