// // AppDelegate.swift // SearchDemo // // Created by Ralf Gronkowski on 13/10/14. // Copyright (c) 2014 Ralf Gronkowski. All rights reserved. // import UIKit @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: NSDictionary?) -> Bool { window = UIWindow(frame: UIScreen.mainScreen().bounds) window?.backgroundColor = UIColor.whiteColor() let viewController = ViewController(nibName: nil, bundle: nil) let navController = UINavigationController(rootViewController: viewController) window?.rootViewController = navController let appDefaults = [SettingsKeys.namePreferenceKey: "Joe_Coder",SettingsKeys.passwordPreferenceKey: "perforce",SettingsKeys.p4searchURLPreferenceKey: "http://perforce.p4demo.com:8088/api/",SettingsKeys.swarmURLPreferenceKey: "http://perforce.p4demo.com/"] NSUserDefaults.standardUserDefaults().registerDefaults(appDefaults) NSUserDefaults.standardUserDefaults().synchronize() return true } func applicationDidEnterBackground(application: UIApplication){ NSUserDefaults.standardUserDefaults().synchronize() } func applicationWillEnterForeground(application: UIApplication){ NSUserDefaults.standardUserDefaults().synchronize() } }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 10709 | gronk |
First working example of an iOS app that searches in P4Search and displys content by retrieving it from Swarm. There is a file JSON.swift in the project in which you need to paste some external code from here https://github.com/lingoer/SwiftyJSON/blob/master/SwiftyJSON/SwiftyJSON.swift to simplify JSON parsing. You will also need access to a running P4Search and Swarm instance if you want to run the app on a device or inside an emulator. Coded in Swift with XCode 6.0.1 |