diff --git a/SQIntervalTimer/SQIntervalTimer.xcodeproj/project.pbxproj b/SQIntervalTimer/SQIntervalTimer.xcodeproj/project.pbxproj new file mode 100644 index 00000000..ffb8f620 --- /dev/null +++ b/SQIntervalTimer/SQIntervalTimer.xcodeproj/project.pbxproj @@ -0,0 +1,363 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 50; + objects = { + +/* Begin PBXBuildFile section */ + 141C7D63235075030013B0EE /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 141C7D62235075030013B0EE /* AppDelegate.m */; }; + 141C7D66235075030013B0EE /* SceneDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 141C7D65235075030013B0EE /* SceneDelegate.m */; }; + 141C7D69235075030013B0EE /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 141C7D68235075030013B0EE /* ViewController.m */; }; + 141C7D6C235075030013B0EE /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 141C7D6A235075030013B0EE /* Main.storyboard */; }; + 141C7D6F235075030013B0EE /* SQIntervalTimer.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = 141C7D6D235075030013B0EE /* SQIntervalTimer.xcdatamodeld */; }; + 141C7D71235075040013B0EE /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 141C7D70235075040013B0EE /* Assets.xcassets */; }; + 141C7D74235075040013B0EE /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 141C7D72235075040013B0EE /* LaunchScreen.storyboard */; }; + 141C7D77235075040013B0EE /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 141C7D76235075040013B0EE /* main.m */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 141C7D5E235075030013B0EE /* SQIntervalTimer.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SQIntervalTimer.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 141C7D61235075030013B0EE /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; + 141C7D62235075030013B0EE /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; + 141C7D64235075030013B0EE /* SceneDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SceneDelegate.h; sourceTree = ""; }; + 141C7D65235075030013B0EE /* SceneDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SceneDelegate.m; sourceTree = ""; }; + 141C7D67235075030013B0EE /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; + 141C7D68235075030013B0EE /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; + 141C7D6B235075030013B0EE /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 141C7D6E235075030013B0EE /* SQIntervalTimer.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = SQIntervalTimer.xcdatamodel; sourceTree = ""; }; + 141C7D70235075040013B0EE /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 141C7D73235075040013B0EE /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + 141C7D75235075040013B0EE /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 141C7D76235075040013B0EE /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 141C7D5B235075030013B0EE /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 141C7D55235075030013B0EE = { + isa = PBXGroup; + children = ( + 141C7D60235075030013B0EE /* SQIntervalTimer */, + 141C7D5F235075030013B0EE /* Products */, + ); + sourceTree = ""; + }; + 141C7D5F235075030013B0EE /* Products */ = { + isa = PBXGroup; + children = ( + 141C7D5E235075030013B0EE /* SQIntervalTimer.app */, + ); + name = Products; + sourceTree = ""; + }; + 141C7D60235075030013B0EE /* SQIntervalTimer */ = { + isa = PBXGroup; + children = ( + 141C7D61235075030013B0EE /* AppDelegate.h */, + 141C7D62235075030013B0EE /* AppDelegate.m */, + 141C7D64235075030013B0EE /* SceneDelegate.h */, + 141C7D65235075030013B0EE /* SceneDelegate.m */, + 141C7D67235075030013B0EE /* ViewController.h */, + 141C7D68235075030013B0EE /* ViewController.m */, + 141C7D6A235075030013B0EE /* Main.storyboard */, + 141C7D70235075040013B0EE /* Assets.xcassets */, + 141C7D72235075040013B0EE /* LaunchScreen.storyboard */, + 141C7D75235075040013B0EE /* Info.plist */, + 141C7D76235075040013B0EE /* main.m */, + 141C7D6D235075030013B0EE /* SQIntervalTimer.xcdatamodeld */, + ); + path = SQIntervalTimer; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 141C7D5D235075030013B0EE /* SQIntervalTimer */ = { + isa = PBXNativeTarget; + buildConfigurationList = 141C7D7A235075040013B0EE /* Build configuration list for PBXNativeTarget "SQIntervalTimer" */; + buildPhases = ( + 141C7D5A235075030013B0EE /* Sources */, + 141C7D5B235075030013B0EE /* Frameworks */, + 141C7D5C235075030013B0EE /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = SQIntervalTimer; + productName = SQIntervalTimer; + productReference = 141C7D5E235075030013B0EE /* SQIntervalTimer.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 141C7D56235075030013B0EE /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 1100; + ORGANIZATIONNAME = "朱双泉"; + TargetAttributes = { + 141C7D5D235075030013B0EE = { + CreatedOnToolsVersion = 11.0; + }; + }; + }; + buildConfigurationList = 141C7D59235075030013B0EE /* Build configuration list for PBXProject "SQIntervalTimer" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 141C7D55235075030013B0EE; + productRefGroup = 141C7D5F235075030013B0EE /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 141C7D5D235075030013B0EE /* SQIntervalTimer */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 141C7D5C235075030013B0EE /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 141C7D74235075040013B0EE /* LaunchScreen.storyboard in Resources */, + 141C7D71235075040013B0EE /* Assets.xcassets in Resources */, + 141C7D6C235075030013B0EE /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 141C7D5A235075030013B0EE /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 141C7D77235075040013B0EE /* main.m in Sources */, + 141C7D69235075030013B0EE /* ViewController.m in Sources */, + 141C7D63235075030013B0EE /* AppDelegate.m in Sources */, + 141C7D6F235075030013B0EE /* SQIntervalTimer.xcdatamodeld in Sources */, + 141C7D66235075030013B0EE /* SceneDelegate.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + 141C7D6A235075030013B0EE /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 141C7D6B235075030013B0EE /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + 141C7D72235075040013B0EE /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 141C7D73235075040013B0EE /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 141C7D78235075040013B0EE /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + 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 = 13.0; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + }; + name = Debug; + }; + 141C7D79235075040013B0EE /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + 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 = 13.0; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = iphoneos; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 141C7D7B235075040013B0EE /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = NGPFU6GT2A; + INFOPLIST_FILE = SQIntervalTimer/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = coderZsq.SQIntervalTimer; + PRODUCT_NAME = "$(TARGET_NAME)"; + TARGETED_DEVICE_FAMILY = 1; + }; + name = Debug; + }; + 141C7D7C235075040013B0EE /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = NGPFU6GT2A; + INFOPLIST_FILE = SQIntervalTimer/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = coderZsq.SQIntervalTimer; + PRODUCT_NAME = "$(TARGET_NAME)"; + TARGETED_DEVICE_FAMILY = 1; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 141C7D59235075030013B0EE /* Build configuration list for PBXProject "SQIntervalTimer" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 141C7D78235075040013B0EE /* Debug */, + 141C7D79235075040013B0EE /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 141C7D7A235075040013B0EE /* Build configuration list for PBXNativeTarget "SQIntervalTimer" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 141C7D7B235075040013B0EE /* Debug */, + 141C7D7C235075040013B0EE /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + +/* Begin XCVersionGroup section */ + 141C7D6D235075030013B0EE /* SQIntervalTimer.xcdatamodeld */ = { + isa = XCVersionGroup; + children = ( + 141C7D6E235075030013B0EE /* SQIntervalTimer.xcdatamodel */, + ); + currentVersion = 141C7D6E235075030013B0EE /* SQIntervalTimer.xcdatamodel */; + path = SQIntervalTimer.xcdatamodeld; + sourceTree = ""; + versionGroupType = wrapper.xcdatamodel; + }; +/* End XCVersionGroup section */ + }; + rootObject = 141C7D56235075030013B0EE /* Project object */; +} diff --git a/SQIntervalTimer/SQIntervalTimer.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/SQIntervalTimer/SQIntervalTimer.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 00000000..40f39fcb --- /dev/null +++ b/SQIntervalTimer/SQIntervalTimer.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/SQIntervalTimer/SQIntervalTimer.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/SQIntervalTimer/SQIntervalTimer.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 00000000..18d98100 --- /dev/null +++ b/SQIntervalTimer/SQIntervalTimer.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/SQIntervalTimer/SQIntervalTimer/AppDelegate.h b/SQIntervalTimer/SQIntervalTimer/AppDelegate.h new file mode 100644 index 00000000..8a5c43e6 --- /dev/null +++ b/SQIntervalTimer/SQIntervalTimer/AppDelegate.h @@ -0,0 +1,20 @@ +// +// AppDelegate.h +// SQIntervalTimer +// +// Created by 朱双泉 on 2019/10/11. +// Copyright © 2019 朱双泉. All rights reserved. +// + +#import +#import + +@interface AppDelegate : UIResponder + +@property (readonly, strong) NSPersistentCloudKitContainer *persistentContainer; + +- (void)saveContext; + + +@end + diff --git a/SQIntervalTimer/SQIntervalTimer/AppDelegate.m b/SQIntervalTimer/SQIntervalTimer/AppDelegate.m new file mode 100644 index 00000000..7fd9bf04 --- /dev/null +++ b/SQIntervalTimer/SQIntervalTimer/AppDelegate.m @@ -0,0 +1,86 @@ +// +// AppDelegate.m +// SQIntervalTimer +// +// Created by 朱双泉 on 2019/10/11. +// Copyright © 2019 朱双泉. All rights reserved. +// + +#import "AppDelegate.h" + +@interface AppDelegate () + +@end + +@implementation AppDelegate + + +- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { + // Override point for customization after application launch. + return YES; +} + + +#pragma mark - UISceneSession lifecycle + + +- (UISceneConfiguration *)application:(UIApplication *)application configurationForConnectingSceneSession:(UISceneSession *)connectingSceneSession options:(UISceneConnectionOptions *)options { + // Called when a new scene session is being created. + // Use this method to select a configuration to create the new scene with. + return [[UISceneConfiguration alloc] initWithName:@"Default Configuration" sessionRole:connectingSceneSession.role]; +} + + +- (void)application:(UIApplication *)application didDiscardSceneSessions:(NSSet *)sceneSessions { + // Called when the user discards a scene session. + // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions. + // Use this method to release any resources that were specific to the discarded scenes, as they will not return. +} + + +#pragma mark - Core Data stack + +@synthesize persistentContainer = _persistentContainer; + +- (NSPersistentCloudKitContainer *)persistentContainer { + // The persistent container for the application. This implementation creates and returns a container, having loaded the store for the application to it. + @synchronized (self) { + if (_persistentContainer == nil) { + _persistentContainer = [[NSPersistentCloudKitContainer alloc] initWithName:@"SQIntervalTimer"]; + [_persistentContainer loadPersistentStoresWithCompletionHandler:^(NSPersistentStoreDescription *storeDescription, NSError *error) { + if (error != nil) { + // 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. + + /* + Typical reasons for an error here include: + * The parent directory does not exist, cannot be created, or disallows writing. + * The persistent store is not accessible, due to permissions or data protection when the device is locked. + * The device is out of space. + * The store could not be migrated to the current model version. + Check the error message to determine what the actual problem was. + */ + NSLog(@"Unresolved error %@, %@", error, error.userInfo); + abort(); + } + }]; + } + } + + return _persistentContainer; +} + +#pragma mark - Core Data Saving support + +- (void)saveContext { + NSManagedObjectContext *context = self.persistentContainer.viewContext; + NSError *error = nil; + if ([context hasChanges] && ![context 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(); + } +} + +@end diff --git a/SQIntervalTimer/SQIntervalTimer/Assets.xcassets/AppIcon.appiconset/Contents.json b/SQIntervalTimer/SQIntervalTimer/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 00000000..d8db8d65 --- /dev/null +++ b/SQIntervalTimer/SQIntervalTimer/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,98 @@ +{ + "images" : [ + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "3x" + }, + { + "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" + }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "29x29", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "40x40", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "76x76", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "76x76", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "83.5x83.5", + "scale" : "2x" + }, + { + "idiom" : "ios-marketing", + "size" : "1024x1024", + "scale" : "1x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/SQIntervalTimer/SQIntervalTimer/Assets.xcassets/Contents.json b/SQIntervalTimer/SQIntervalTimer/Assets.xcassets/Contents.json new file mode 100644 index 00000000..da4a164c --- /dev/null +++ b/SQIntervalTimer/SQIntervalTimer/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/SQIntervalTimer/SQIntervalTimer/Base.lproj/LaunchScreen.storyboard b/SQIntervalTimer/SQIntervalTimer/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 00000000..865e9329 --- /dev/null +++ b/SQIntervalTimer/SQIntervalTimer/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SQIntervalTimer/SQIntervalTimer/Base.lproj/Main.storyboard b/SQIntervalTimer/SQIntervalTimer/Base.lproj/Main.storyboard new file mode 100644 index 00000000..4d6ba584 --- /dev/null +++ b/SQIntervalTimer/SQIntervalTimer/Base.lproj/Main.storyboard @@ -0,0 +1,156 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SQIntervalTimer/SQIntervalTimer/Info.plist b/SQIntervalTimer/SQIntervalTimer/Info.plist new file mode 100644 index 00000000..3f1711b6 --- /dev/null +++ b/SQIntervalTimer/SQIntervalTimer/Info.plist @@ -0,0 +1,62 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + $(PRODUCT_BUNDLE_PACKAGE_TYPE) + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + LSRequiresIPhoneOS + + UIApplicationSceneManifest + + UIApplicationSupportsMultipleScenes + + UISceneConfigurations + + UIWindowSceneSessionRoleApplication + + + UISceneConfigurationName + Default Configuration + UISceneDelegateClassName + SceneDelegate + UISceneStoryboardFile + Main + + + + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/SQIntervalTimer/SQIntervalTimer/SQIntervalTimer.xcdatamodeld/.xccurrentversion b/SQIntervalTimer/SQIntervalTimer/SQIntervalTimer.xcdatamodeld/.xccurrentversion new file mode 100644 index 00000000..1db1145e --- /dev/null +++ b/SQIntervalTimer/SQIntervalTimer/SQIntervalTimer.xcdatamodeld/.xccurrentversion @@ -0,0 +1,8 @@ + + + + + _XCCurrentVersionName + SQIntervalTimer.xcdatamodel + + diff --git a/SQIntervalTimer/SQIntervalTimer/SQIntervalTimer.xcdatamodeld/SQIntervalTimer.xcdatamodel/contents b/SQIntervalTimer/SQIntervalTimer/SQIntervalTimer.xcdatamodeld/SQIntervalTimer.xcdatamodel/contents new file mode 100644 index 00000000..5d6f17b7 --- /dev/null +++ b/SQIntervalTimer/SQIntervalTimer/SQIntervalTimer.xcdatamodeld/SQIntervalTimer.xcdatamodel/contents @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/SQIntervalTimer/SQIntervalTimer/SceneDelegate.h b/SQIntervalTimer/SQIntervalTimer/SceneDelegate.h new file mode 100644 index 00000000..341dfddf --- /dev/null +++ b/SQIntervalTimer/SQIntervalTimer/SceneDelegate.h @@ -0,0 +1,16 @@ +// +// SceneDelegate.h +// SQIntervalTimer +// +// Created by 朱双泉 on 2019/10/11. +// Copyright © 2019 朱双泉. All rights reserved. +// + +#import + +@interface SceneDelegate : UIResponder + +@property (strong, nonatomic) UIWindow * window; + +@end + diff --git a/SQIntervalTimer/SQIntervalTimer/SceneDelegate.m b/SQIntervalTimer/SQIntervalTimer/SceneDelegate.m new file mode 100644 index 00000000..0c5e4d07 --- /dev/null +++ b/SQIntervalTimer/SQIntervalTimer/SceneDelegate.m @@ -0,0 +1,54 @@ +#import "SceneDelegate.h" +#import "AppDelegate.h" + +@interface SceneDelegate () + +@end + +@implementation SceneDelegate + + +- (void)scene:(UIScene *)scene willConnectToSession:(UISceneSession *)session options:(UISceneConnectionOptions *)connectionOptions { + // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`. + // If using a storyboard, the `window` property will automatically be initialized and attached to the scene. + // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead). +} + + +- (void)sceneDidDisconnect:(UIScene *)scene { + // Called as the scene is being released by the system. + // This occurs shortly after the scene enters the background, or when its session is discarded. + // Release any resources associated with this scene that can be re-created the next time the scene connects. + // The scene may re-connect later, as its session was not neccessarily discarded (see `application:didDiscardSceneSessions` instead). +} + + +- (void)sceneDidBecomeActive:(UIScene *)scene { + // Called when the scene has moved from an inactive state to an active state. + // Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive. +} + + +- (void)sceneWillResignActive:(UIScene *)scene { + // Called when the scene will move from an active state to an inactive state. + // This may occur due to temporary interruptions (ex. an incoming phone call). +} + + +- (void)sceneWillEnterForeground:(UIScene *)scene { + // Called as the scene transitions from the background to the foreground. + // Use this method to undo the changes made on entering the background. +} + + +- (void)sceneDidEnterBackground:(UIScene *)scene { + // Called as the scene transitions from the foreground to the background. + // Use this method to save data, release shared resources, and store enough scene-specific state information + // to restore the scene back to its current state. + + // Save changes in the application's managed object context when the application transitions to the background. + [(AppDelegate *)UIApplication.sharedApplication.delegate saveContext]; +} + + +@end diff --git a/SQIntervalTimer/SQIntervalTimer/ViewController.h b/SQIntervalTimer/SQIntervalTimer/ViewController.h new file mode 100644 index 00000000..c0b0fdb5 --- /dev/null +++ b/SQIntervalTimer/SQIntervalTimer/ViewController.h @@ -0,0 +1,15 @@ +// +// ViewController.h +// SQIntervalTimer +// +// Created by 朱双泉 on 2019/10/11. +// Copyright © 2019 朱双泉. All rights reserved. +// + +#import + +@interface ViewController : UIViewController + + +@end + diff --git a/SQIntervalTimer/SQIntervalTimer/ViewController.m b/SQIntervalTimer/SQIntervalTimer/ViewController.m new file mode 100644 index 00000000..49c04436 --- /dev/null +++ b/SQIntervalTimer/SQIntervalTimer/ViewController.m @@ -0,0 +1,48 @@ +// +// ViewController.m +// SQIntervalTimer +// +// Created by 朱双泉 on 2019/10/11. +// Copyright © 2019 朱双泉. All rights reserved. +// + +#import "ViewController.h" + +@interface ViewController () +@property (strong, nonatomic) NSMutableArray *dataSource; +@property (weak, nonatomic) IBOutlet UIPickerView *pickView; +@property (weak, nonatomic) IBOutlet UIButton *controlButton; +@property (weak, nonatomic) IBOutlet UIButton *cancelButton; +@end + +@implementation ViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + self.dataSource = [NSMutableArray array]; + for (NSUInteger i = 1; i <= 60; i++) { + [self.dataSource addObject:@(i).stringValue]; + } + self.controlButton.layer.cornerRadius = self.controlButton.bounds.size.width * 0.5; + self.controlButton.layer.masksToBounds = YES; + self.cancelButton.layer.cornerRadius = self.cancelButton.bounds.size.width * 0.5; + self.cancelButton.layer.masksToBounds = YES; +} + +- (UIStatusBarStyle)preferredStatusBarStyle { + return UIStatusBarStyleLightContent; +} + +- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView { + return 3; +} + +- (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component { + return self.dataSource.count; +} + +- (NSAttributedString *)pickerView:(UIPickerView *)pickerView attributedTitleForRow:(NSInteger)row forComponent:(NSInteger)component { + return [[NSAttributedString alloc] initWithString:self.dataSource[row] attributes:@{NSForegroundColorAttributeName : [UIColor whiteColor]}]; +} + +@end diff --git a/SQIntervalTimer/SQIntervalTimer/main.m b/SQIntervalTimer/SQIntervalTimer/main.m new file mode 100644 index 00000000..04f45c8c --- /dev/null +++ b/SQIntervalTimer/SQIntervalTimer/main.m @@ -0,0 +1,19 @@ +// +// main.m +// SQIntervalTimer +// +// Created by 朱双泉 on 2019/10/11. +// Copyright © 2019 朱双泉. All rights reserved. +// + +#import +#import "AppDelegate.h" + +int main(int argc, char * argv[]) { + NSString * appDelegateClassName; + @autoreleasepool { + // Setup code that might create autoreleased objects goes here. + appDelegateClassName = NSStringFromClass([AppDelegate class]); + } + return UIApplicationMain(argc, argv, nil, appDelegateClassName); +}