1 // 2 // AppDelegate.swift 3 // SwiftExample 4 // 5 // Created by Barry Smith on 10/19/14. 6 // Copyright (c) 2014 Barry Smith. All rights reserved. 7 // 8 9 import UIKit 10 11 import PETSc 12 13 /* 14 This is called by PETSc for all print calls. 15 16 Simply addeds to the NSString in globalTextView and it gets displayed in the UITextView in the display 17 */ PetscVFPrintfiPhonenull18func PetscVFPrintfiPhone(str: UnsafePointer<Int8>) -> CInt 19 { 20 let result = String.fromCString(str) 21 print(result) 22 return 0; 23 } 24 25 var closure: (UnsafePointer<Int8>) -> CInt = PetscVFPrintfiPhone 26 27 @UIApplicationMain 28 class AppDelegate: UIResponder, UIApplicationDelegate { 29 30 var window: UIWindow? 31 32 applicationnull33 func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { 34 // Override point for customization after application launch. 35 PetscVFPrintfSetClosure(closure) 36 PetscInitializeNoArguments() 37 return true 38 } 39 applicationWillResignActivenull40 func applicationWillResignActive(application: UIApplication) { 41 // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 42 // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 43 } 44 applicationDidEnterBackgroundnull45 func applicationDidEnterBackground(application: UIApplication) { 46 // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 47 // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 48 } 49 applicationWillEnterForegroundnull50 func applicationWillEnterForeground(application: UIApplication) { 51 // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 52 } 53 applicationDidBecomeActivenull54 func applicationDidBecomeActive(application: UIApplication) { 55 // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 56 } 57 applicationWillTerminatenull58 func applicationWillTerminate(application: UIApplication) { 59 // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 60 } 61 62 63 } 64 65