commit ca9c197b32de1debefae203589e81e618e0bfe53 Author: ylzheng Date: Fri Jul 24 22:49:10 2015 +0800 Initial Commit diff --git a/librx.xcodeproj/project.pbxproj b/librx.xcodeproj/project.pbxproj new file mode 100644 index 0000000..2dfa50e --- /dev/null +++ b/librx.xcodeproj/project.pbxproj @@ -0,0 +1,441 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 452DC1191B6287E600847691 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 452DC1181B6287E600847691 /* AppDelegate.swift */; }; + 452DC11C1B6287E600847691 /* librx.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = 452DC11A1B6287E600847691 /* librx.xcdatamodeld */; }; + 452DC11E1B6287E600847691 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 452DC11D1B6287E600847691 /* ViewController.swift */; }; + 452DC1211B6287E600847691 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 452DC11F1B6287E600847691 /* Main.storyboard */; }; + 452DC1231B6287E600847691 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 452DC1221B6287E600847691 /* Images.xcassets */; }; + 452DC1261B6287E600847691 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 452DC1241B6287E600847691 /* LaunchScreen.xib */; }; + 452DC1321B6287E600847691 /* librxTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 452DC1311B6287E600847691 /* librxTests.swift */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 452DC12C1B6287E600847691 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 452DC10B1B6287E600847691 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 452DC1121B6287E600847691; + remoteInfo = librx; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + 452DC1131B6287E600847691 /* librx.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = librx.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 452DC1171B6287E600847691 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 452DC1181B6287E600847691 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 452DC11B1B6287E600847691 /* librx.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = librx.xcdatamodel; sourceTree = ""; }; + 452DC11D1B6287E600847691 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; + 452DC1201B6287E600847691 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 452DC1221B6287E600847691 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; + 452DC1251B6287E600847691 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; + 452DC12B1B6287E600847691 /* librxTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = librxTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 452DC1301B6287E600847691 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 452DC1311B6287E600847691 /* librxTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = librxTests.swift; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 452DC1101B6287E600847691 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 452DC1281B6287E600847691 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 452DC10A1B6287E600847691 = { + isa = PBXGroup; + children = ( + 452DC1151B6287E600847691 /* librx */, + 452DC12E1B6287E600847691 /* librxTests */, + 452DC1141B6287E600847691 /* Products */, + ); + sourceTree = ""; + }; + 452DC1141B6287E600847691 /* Products */ = { + isa = PBXGroup; + children = ( + 452DC1131B6287E600847691 /* librx.app */, + 452DC12B1B6287E600847691 /* librxTests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + 452DC1151B6287E600847691 /* librx */ = { + isa = PBXGroup; + children = ( + 452DC1181B6287E600847691 /* AppDelegate.swift */, + 452DC11D1B6287E600847691 /* ViewController.swift */, + 452DC11F1B6287E600847691 /* Main.storyboard */, + 452DC1221B6287E600847691 /* Images.xcassets */, + 452DC1241B6287E600847691 /* LaunchScreen.xib */, + 452DC11A1B6287E600847691 /* librx.xcdatamodeld */, + 452DC1161B6287E600847691 /* Supporting Files */, + ); + path = librx; + sourceTree = ""; + }; + 452DC1161B6287E600847691 /* Supporting Files */ = { + isa = PBXGroup; + children = ( + 452DC1171B6287E600847691 /* Info.plist */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; + 452DC12E1B6287E600847691 /* librxTests */ = { + isa = PBXGroup; + children = ( + 452DC1311B6287E600847691 /* librxTests.swift */, + 452DC12F1B6287E600847691 /* Supporting Files */, + ); + path = librxTests; + sourceTree = ""; + }; + 452DC12F1B6287E600847691 /* Supporting Files */ = { + isa = PBXGroup; + children = ( + 452DC1301B6287E600847691 /* Info.plist */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 452DC1121B6287E600847691 /* librx */ = { + isa = PBXNativeTarget; + buildConfigurationList = 452DC1351B6287E600847691 /* Build configuration list for PBXNativeTarget "librx" */; + buildPhases = ( + 452DC10F1B6287E600847691 /* Sources */, + 452DC1101B6287E600847691 /* Frameworks */, + 452DC1111B6287E600847691 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = librx; + productName = librx; + productReference = 452DC1131B6287E600847691 /* librx.app */; + productType = "com.apple.product-type.application"; + }; + 452DC12A1B6287E600847691 /* librxTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 452DC1381B6287E600847691 /* Build configuration list for PBXNativeTarget "librxTests" */; + buildPhases = ( + 452DC1271B6287E600847691 /* Sources */, + 452DC1281B6287E600847691 /* Frameworks */, + 452DC1291B6287E600847691 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 452DC12D1B6287E600847691 /* PBXTargetDependency */, + ); + name = librxTests; + productName = librxTests; + productReference = 452DC12B1B6287E600847691 /* librxTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 452DC10B1B6287E600847691 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0630; + ORGANIZATIONNAME = librx; + TargetAttributes = { + 452DC1121B6287E600847691 = { + CreatedOnToolsVersion = 6.3.1; + }; + 452DC12A1B6287E600847691 = { + CreatedOnToolsVersion = 6.3.1; + TestTargetID = 452DC1121B6287E600847691; + }; + }; + }; + buildConfigurationList = 452DC10E1B6287E600847691 /* Build configuration list for PBXProject "librx" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 452DC10A1B6287E600847691; + productRefGroup = 452DC1141B6287E600847691 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 452DC1121B6287E600847691 /* librx */, + 452DC12A1B6287E600847691 /* librxTests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 452DC1111B6287E600847691 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 452DC1211B6287E600847691 /* Main.storyboard in Resources */, + 452DC1261B6287E600847691 /* LaunchScreen.xib in Resources */, + 452DC1231B6287E600847691 /* Images.xcassets in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 452DC1291B6287E600847691 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 452DC10F1B6287E600847691 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 452DC11E1B6287E600847691 /* ViewController.swift in Sources */, + 452DC1191B6287E600847691 /* AppDelegate.swift in Sources */, + 452DC11C1B6287E600847691 /* librx.xcdatamodeld in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 452DC1271B6287E600847691 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 452DC1321B6287E600847691 /* librxTests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 452DC12D1B6287E600847691 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 452DC1121B6287E600847691 /* librx */; + targetProxy = 452DC12C1B6287E600847691 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + 452DC11F1B6287E600847691 /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 452DC1201B6287E600847691 /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + 452DC1241B6287E600847691 /* LaunchScreen.xib */ = { + isa = PBXVariantGroup; + children = ( + 452DC1251B6287E600847691 /* Base */, + ); + name = LaunchScreen.xib; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 452DC1331B6287E600847691 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.3; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 452DC1341B6287E600847691 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.3; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 452DC1361B6287E600847691 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + INFOPLIST_FILE = librx/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 452DC1371B6287E600847691 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + INFOPLIST_FILE = librx/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; + 452DC1391B6287E600847691 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + FRAMEWORK_SEARCH_PATHS = ( + "$(SDKROOT)/Developer/Library/Frameworks", + "$(inherited)", + ); + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + INFOPLIST_FILE = librxTests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_NAME = "$(TARGET_NAME)"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/librx.app/librx"; + }; + name = Debug; + }; + 452DC13A1B6287E600847691 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + FRAMEWORK_SEARCH_PATHS = ( + "$(SDKROOT)/Developer/Library/Frameworks", + "$(inherited)", + ); + INFOPLIST_FILE = librxTests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_NAME = "$(TARGET_NAME)"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/librx.app/librx"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 452DC10E1B6287E600847691 /* Build configuration list for PBXProject "librx" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 452DC1331B6287E600847691 /* Debug */, + 452DC1341B6287E600847691 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 452DC1351B6287E600847691 /* Build configuration list for PBXNativeTarget "librx" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 452DC1361B6287E600847691 /* Debug */, + 452DC1371B6287E600847691 /* Release */, + ); + defaultConfigurationIsVisible = 0; + }; + 452DC1381B6287E600847691 /* Build configuration list for PBXNativeTarget "librxTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 452DC1391B6287E600847691 /* Debug */, + 452DC13A1B6287E600847691 /* Release */, + ); + defaultConfigurationIsVisible = 0; + }; +/* End XCConfigurationList section */ + +/* Begin XCVersionGroup section */ + 452DC11A1B6287E600847691 /* librx.xcdatamodeld */ = { + isa = XCVersionGroup; + children = ( + 452DC11B1B6287E600847691 /* librx.xcdatamodel */, + ); + currentVersion = 452DC11B1B6287E600847691 /* librx.xcdatamodel */; + path = librx.xcdatamodeld; + sourceTree = ""; + versionGroupType = wrapper.xcdatamodel; + }; +/* End XCVersionGroup section */ + }; + rootObject = 452DC10B1B6287E600847691 /* Project object */; +} diff --git a/librx.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/librx.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..4a06ebe --- /dev/null +++ b/librx.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/librx/AppDelegate.swift b/librx/AppDelegate.swift new file mode 100644 index 0000000..993acfa --- /dev/null +++ b/librx/AppDelegate.swift @@ -0,0 +1,111 @@ +// +// AppDelegate.swift +// librx +// +// Created by Yunlong Zheng on 15/7/24. +// Copyright (c) 2015年 librx. All rights reserved. +// + +import UIKit +import CoreData + +@UIApplicationMain +class AppDelegate: UIResponder, UIApplicationDelegate { + + var window: UIWindow? + + + func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { + // Override point for customization after application launch. + return true + } + + func applicationWillResignActive(application: UIApplication) { + // 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. + // 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. + } + + func applicationDidEnterBackground(application: UIApplication) { + // 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. + // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. + } + + func applicationWillEnterForeground(application: UIApplication) { + // 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. + } + + func applicationDidBecomeActive(application: UIApplication) { + // 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. + } + + func applicationWillTerminate(application: UIApplication) { + // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. + // Saves changes in the application's managed object context before the application terminates. + self.saveContext() + } + + // MARK: - Core Data stack + + lazy var applicationDocumentsDirectory: NSURL = { + // The directory the application uses to store the Core Data store file. This code uses a directory named "com.librx.librx" in the application's documents Application Support directory. + let urls = NSFileManager.defaultManager().URLsForDirectory(.DocumentDirectory, inDomains: .UserDomainMask) + return urls[urls.count-1] as! NSURL + }() + + lazy var managedObjectModel: NSManagedObjectModel = { + // The managed object model for the application. This property is not optional. It is a fatal error for the application not to be able to find and load its model. + let modelURL = NSBundle.mainBundle().URLForResource("librx", withExtension: "momd")! + return NSManagedObjectModel(contentsOfURL: modelURL)! + }() + + lazy var persistentStoreCoordinator: NSPersistentStoreCoordinator? = { + // The persistent store coordinator for the application. This implementation creates and return a coordinator, having added the store for the application to it. This property is optional since there are legitimate error conditions that could cause the creation of the store to fail. + // Create the coordinator and store + var coordinator: NSPersistentStoreCoordinator? = NSPersistentStoreCoordinator(managedObjectModel: self.managedObjectModel) + let url = self.applicationDocumentsDirectory.URLByAppendingPathComponent("librx.sqlite") + var error: NSError? = nil + var failureReason = "There was an error creating or loading the application's saved data." + if coordinator!.addPersistentStoreWithType(NSSQLiteStoreType, configuration: nil, URL: url, options: nil, error: &error) == nil { + coordinator = nil + // Report any error we got. + var dict = [String: AnyObject]() + dict[NSLocalizedDescriptionKey] = "Failed to initialize the application's saved data" + dict[NSLocalizedFailureReasonErrorKey] = failureReason + dict[NSUnderlyingErrorKey] = error + error = NSError(domain: "YOUR_ERROR_DOMAIN", code: 9999, userInfo: dict) + // Replace this with code to handle the error appropriately. + // abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development. + NSLog("Unresolved error \(error), \(error!.userInfo)") + abort() + } + + return coordinator + }() + + lazy var managedObjectContext: NSManagedObjectContext? = { + // Returns the managed object context for the application (which is already bound to the persistent store coordinator for the application.) This property is optional since there are legitimate error conditions that could cause the creation of the context to fail. + let coordinator = self.persistentStoreCoordinator + if coordinator == nil { + return nil + } + var managedObjectContext = NSManagedObjectContext() + managedObjectContext.persistentStoreCoordinator = coordinator + return managedObjectContext + }() + + // MARK: - Core Data Saving support + + func saveContext () { + if let moc = self.managedObjectContext { + var error: NSError? = nil + if moc.hasChanges && !moc.save(&error) { + // Replace this implementation with code to handle the error appropriately. + // abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development. + NSLog("Unresolved error \(error), \(error!.userInfo)") + abort() + } + } + } + +} + diff --git a/librx/Base.lproj/LaunchScreen.xib b/librx/Base.lproj/LaunchScreen.xib new file mode 100644 index 0000000..8a10c92 --- /dev/null +++ b/librx/Base.lproj/LaunchScreen.xib @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/librx/Base.lproj/Main.storyboard b/librx/Base.lproj/Main.storyboard new file mode 100644 index 0000000..52ea29e --- /dev/null +++ b/librx/Base.lproj/Main.storyboard @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/librx/Images.xcassets/AppIcon.appiconset/Contents.json b/librx/Images.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..118c98f --- /dev/null +++ b/librx/Images.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,38 @@ +{ + "images" : [ + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/librx/Info.plist b/librx/Info.plist new file mode 100644 index 0000000..5fd77b9 --- /dev/null +++ b/librx/Info.plist @@ -0,0 +1,40 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + com.librx.$(PRODUCT_NAME:rfc1034identifier) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + LSRequiresIPhoneOS + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/librx/ViewController.swift b/librx/ViewController.swift new file mode 100644 index 0000000..83c92d4 --- /dev/null +++ b/librx/ViewController.swift @@ -0,0 +1,25 @@ +// +// ViewController.swift +// librx +// +// Created by Yunlong Zheng on 15/7/24. +// Copyright (c) 2015年 librx. All rights reserved. +// + +import UIKit + +class ViewController: UIViewController { + + override func viewDidLoad() { + super.viewDidLoad() + // Do any additional setup after loading the view, typically from a nib. + } + + override func didReceiveMemoryWarning() { + super.didReceiveMemoryWarning() + // Dispose of any resources that can be recreated. + } + + +} + diff --git a/librx/librx.xcdatamodeld/.xccurrentversion b/librx/librx.xcdatamodeld/.xccurrentversion new file mode 100644 index 0000000..d5eebc9 --- /dev/null +++ b/librx/librx.xcdatamodeld/.xccurrentversion @@ -0,0 +1,8 @@ + + + + + _XCCurrentVersionName + librx.xcdatamodel + + diff --git a/librx/librx.xcdatamodeld/librx.xcdatamodel/contents b/librx/librx.xcdatamodeld/librx.xcdatamodel/contents new file mode 100644 index 0000000..193f33c --- /dev/null +++ b/librx/librx.xcdatamodeld/librx.xcdatamodel/contents @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/librxTests/Info.plist b/librxTests/Info.plist new file mode 100644 index 0000000..2bf6e63 --- /dev/null +++ b/librxTests/Info.plist @@ -0,0 +1,24 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + com.librx.$(PRODUCT_NAME:rfc1034identifier) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + BNDL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + + diff --git a/librxTests/librxTests.swift b/librxTests/librxTests.swift new file mode 100644 index 0000000..ca78f2b --- /dev/null +++ b/librxTests/librxTests.swift @@ -0,0 +1,36 @@ +// +// librxTests.swift +// librxTests +// +// Created by Yunlong Zheng on 15/7/24. +// Copyright (c) 2015年 librx. All rights reserved. +// + +import UIKit +import XCTest + +class librxTests: XCTestCase { + + override func setUp() { + super.setUp() + // Put setup code here. This method is called before the invocation of each test method in the class. + } + + override func tearDown() { + // Put teardown code here. This method is called after the invocation of each test method in the class. + super.tearDown() + } + + func testExample() { + // This is an example of a functional test case. + XCTAssert(true, "Pass") + } + + func testPerformanceExample() { + // This is an example of a performance test case. + self.measureBlock() { + // Put the code you want to measure the time of here. + } + } + +}