diff --git a/.DS_Store b/.DS_Store index 44876a7..bb8991b 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/.gitignore b/.gitignore index fef6442..a159107 100644 --- a/.gitignore +++ b/.gitignore @@ -1,22 +1,103 @@ +##### +# OS X temporary files that should never be committed +.DS_Store +*.swp +*.lock +profile -*.xcworkspacedata +##### +# DotEnv files +.env -*.xcuserstate +#### +# Xcode temporary files that should never be committed +*~.nib -*.xcsettings +#### +# Objective-C/Swift specific +*.hmap +*.ipa -*.xcbkptlist +#### +# Xcode build files +DerivedData/ +build/ +Builds/ -*.xcscheme +##### +# Xcode private settings (window sizes, bookmarks, breakpoints, custom executables, smart groups) +*.pbxuser +*.mode1v3 +*.mode2v3 +*.perspectivev3 +!default.pbxuser +!default.mode1v3 +!default.mode2v3 +!default.perspectivev3 -ICETutorial.xcodeproj/xcuserdata/patrick.trillsam.xcuserdatad/xcschemes/xcschememanagement.plist +#### +# Xcode 4 +xcuserdata +!xcschemes +# Xcode 4 +*.moved-aside + +#### +# XCode 4 workspaces - more detailed +!xcshareddata +!default.xcworkspace +*.xcworkspacedata -ICETutorial.xcodeproj/xcuserdata/patrick.trillsam.xcuserdatad/xcschemes/ICETutorialSwift.xcscheme -ICETutorial.xcodeproj/xcuserdata/patrick.trillsam.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +#### +# Xcode 5 +*.xccheckout +*.xcuserstate -ICETutorial.xcodeproj/project.xcworkspace/xcuserdata/patrick.trillsam.xcuserdatad/WorkspaceSettings.xcsettings +#### +# Xcode 7 +*.xcscmblueprint -ICETutorial.xcodeproj/project.xcworkspace/xcuserdata/patrick.trillsam.xcuserdatad/UserInterfaceState.xcuserstate +#### +# AppCode +.idea/ -ICETutorial.xcodeproj/project.xcworkspace/contents.xcworkspacedata +#### +# Other Xcode files +profile +*.hmap +*.ipa + +#### +# CocoaPods +Pods/ +!Podfile +!Podfile.lock + +#### +# Carthage +Carthage/Build.rbenv-vars +!Cartfile +!Cartfile.private +!Cartfile.resolved + +#### +# Fastlane +# Temporary profiling data +/fastlane/report.xml +# Deliver temporary error output +/fastlane/Error*.png +# Deliver temporary preview output +/fastlane/Preview.html +# Snapshot generated screenshots +/fastlane/screenshots/*/*-portrait.png +/fastlane/screenshots/*/*-landscape.png +/fastlane/screenshots/screenshots.html +# Frameit generated screenshots +/fastlane/screenshots/*/*-portrait_framed.png +/fastlane/screenshots/*/*-landscape_framed.png + +#### +# rbenv +.rbenv-vars +*.xcscheme diff --git a/ICETutorial.xcodeproj/project.pbxproj b/ICETutorial.xcodeproj/project.pbxproj index 69ed317..b12343f 100755 --- a/ICETutorial.xcodeproj/project.pbxproj +++ b/ICETutorial.xcodeproj/project.pbxproj @@ -12,11 +12,6 @@ 55A1D56D193FEFCC00994874 /* ICETutorialTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 55A1D56C193FEFCC00994874 /* ICETutorialTests.swift */; }; 55A1D583193FF01600994874 /* background-gradient.png in Resources */ = {isa = PBXBuildFile; fileRef = 55A1D577193FF01600994874 /* background-gradient.png */; }; 55A1D584193FF01600994874 /* background-gradient@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 55A1D578193FF01600994874 /* background-gradient@2x.png */; }; - 55A1D585193FF01600994874 /* button-background.png in Resources */ = {isa = PBXBuildFile; fileRef = 55A1D579193FF01600994874 /* button-background.png */; }; - 55A1D586193FF01600994874 /* button-background@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 55A1D57A193FF01600994874 /* button-background@2x.png */; }; - 55A1D587193FF01600994874 /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 55A1D57B193FF01600994874 /* Default-568h@2x.png */; }; - 55A1D588193FF01600994874 /* Default.png in Resources */ = {isa = PBXBuildFile; fileRef = 55A1D57C193FF01600994874 /* Default.png */; }; - 55A1D589193FF01600994874 /* Default@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 55A1D57D193FF01600994874 /* Default@2x.png */; }; 55A1D58A193FF01600994874 /* tutorial_background_00@2x.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 55A1D57E193FF01600994874 /* tutorial_background_00@2x.jpg */; }; 55A1D58B193FF01600994874 /* tutorial_background_01@2x.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 55A1D57F193FF01600994874 /* tutorial_background_01@2x.jpg */; }; 55A1D58C193FF01600994874 /* tutorial_background_02@2x.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 55A1D580193FF01600994874 /* tutorial_background_02@2x.jpg */; }; @@ -24,6 +19,7 @@ 55A1D58E193FF01600994874 /* tutorial_background_04@2x.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 55A1D582193FF01600994874 /* tutorial_background_04@2x.jpg */; }; 55A1D597193FF05400994874 /* ICETutorialPage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 55A1D596193FF05400994874 /* ICETutorialPage.swift */; }; 55A1D5F3193FFA9300994874 /* ICETutorialController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 55A1D5F2193FFA9300994874 /* ICETutorialController.swift */; }; + 5626A6A2249AFF8300390246 /* Launch Screen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 5626A6A1249AFF8300390246 /* Launch Screen.storyboard */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -46,11 +42,6 @@ 55A1D56C193FEFCC00994874 /* ICETutorialTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ICETutorialTests.swift; sourceTree = ""; }; 55A1D577193FF01600994874 /* background-gradient.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "background-gradient.png"; sourceTree = ""; }; 55A1D578193FF01600994874 /* background-gradient@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "background-gradient@2x.png"; sourceTree = ""; }; - 55A1D579193FF01600994874 /* button-background.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "button-background.png"; sourceTree = ""; }; - 55A1D57A193FF01600994874 /* button-background@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "button-background@2x.png"; sourceTree = ""; }; - 55A1D57B193FF01600994874 /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = ""; }; - 55A1D57C193FF01600994874 /* Default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Default.png; sourceTree = ""; }; - 55A1D57D193FF01600994874 /* Default@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default@2x.png"; sourceTree = ""; }; 55A1D57E193FF01600994874 /* tutorial_background_00@2x.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = "tutorial_background_00@2x.jpg"; sourceTree = ""; }; 55A1D57F193FF01600994874 /* tutorial_background_01@2x.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = "tutorial_background_01@2x.jpg"; sourceTree = ""; }; 55A1D580193FF01600994874 /* tutorial_background_02@2x.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = "tutorial_background_02@2x.jpg"; sourceTree = ""; }; @@ -58,6 +49,7 @@ 55A1D582193FF01600994874 /* tutorial_background_04@2x.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = "tutorial_background_04@2x.jpg"; sourceTree = ""; }; 55A1D596193FF05400994874 /* ICETutorialPage.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ICETutorialPage.swift; sourceTree = ""; }; 55A1D5F2193FFA9300994874 /* ICETutorialController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ICETutorialController.swift; sourceTree = ""; }; + 5626A6A1249AFF8300390246 /* Launch Screen.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = "Launch Screen.storyboard"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -104,6 +96,7 @@ 55A1D55E193FEFCC00994874 /* AppDelegate.swift */, 55A1D560193FEFCC00994874 /* Images.xcassets */, 55A1D55C193FEFCC00994874 /* Supporting Files */, + 5626A6A1249AFF8300390246 /* Launch Screen.storyboard */, ); path = ICETutorial; sourceTree = ""; @@ -138,11 +131,6 @@ children = ( 55A1D577193FF01600994874 /* background-gradient.png */, 55A1D578193FF01600994874 /* background-gradient@2x.png */, - 55A1D579193FF01600994874 /* button-background.png */, - 55A1D57A193FF01600994874 /* button-background@2x.png */, - 55A1D57B193FF01600994874 /* Default-568h@2x.png */, - 55A1D57C193FF01600994874 /* Default.png */, - 55A1D57D193FF01600994874 /* Default@2x.png */, 55A1D57E193FF01600994874 /* tutorial_background_00@2x.jpg */, 55A1D57F193FF01600994874 /* tutorial_background_01@2x.jpg */, 55A1D580193FF01600994874 /* tutorial_background_02@2x.jpg */, @@ -206,24 +194,29 @@ 55A1D551193FEFCC00994874 /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0600; + LastUpgradeCheck = 1150; ORGANIZATIONNAME = "Patrick Trillsam"; TargetAttributes = { 55A1D558193FEFCC00994874 = { CreatedOnToolsVersion = 6.0; + LastSwiftMigration = 1150; + ProvisioningStyle = Automatic; }; 55A1D565193FEFCC00994874 = { CreatedOnToolsVersion = 6.0; + LastSwiftMigration = 1150; + ProvisioningStyle = Automatic; TestTargetID = 55A1D558193FEFCC00994874; }; }; }; buildConfigurationList = 55A1D554193FEFCC00994874 /* Build configuration list for PBXProject "ICETutorial" */; compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; + developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( en, + Base, ); mainGroup = 55A1D550193FEFCC00994874; productRefGroup = 55A1D55A193FEFCC00994874 /* Products */; @@ -241,18 +234,14 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - 55A1D589193FF01600994874 /* Default@2x.png in Resources */, 55A1D58C193FF01600994874 /* tutorial_background_02@2x.jpg in Resources */, 55A1D58B193FF01600994874 /* tutorial_background_01@2x.jpg in Resources */, 55A1D561193FEFCC00994874 /* Images.xcassets in Resources */, - 55A1D586193FF01600994874 /* button-background@2x.png in Resources */, 55A1D58A193FF01600994874 /* tutorial_background_00@2x.jpg in Resources */, 55A1D58E193FF01600994874 /* tutorial_background_04@2x.jpg in Resources */, - 55A1D585193FF01600994874 /* button-background.png in Resources */, + 5626A6A2249AFF8300390246 /* Launch Screen.storyboard in Resources */, 55A1D584193FF01600994874 /* background-gradient@2x.png in Resources */, - 55A1D588193FF01600994874 /* Default.png in Resources */, 55A1D583193FF01600994874 /* background-gradient.png in Resources */, - 55A1D587193FF01600994874 /* Default-568h@2x.png in Resources */, 55A1D58D193FF01600994874 /* tutorial_background_03@2x.jpg in Resources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -300,24 +289,37 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = 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_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_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = 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", @@ -330,7 +332,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.4; METAL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -343,17 +345,28 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = 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_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_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; @@ -361,15 +374,17 @@ 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.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.4; METAL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; }; @@ -379,10 +394,15 @@ isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; + CODE_SIGN_IDENTITY = "Apple Development"; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = ICETutorial/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "Patrick-Trillsam.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = ICETutorial; + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -390,17 +410,26 @@ isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; + CODE_SIGN_IDENTITY = "Apple Development"; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = ICETutorial/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "Patrick-Trillsam.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = ICETutorial; + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_VERSION = 5.0; }; name = Release; }; 55A1D574193FEFCC00994874 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/ICETutorialSwift.app/ICETutorialSwift"; + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_IDENTITY = "Apple Development"; + "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development"; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = ""; FRAMEWORK_SEARCH_PATHS = ( "$(SDKROOT)/Developer/Library/Frameworks", "$(inherited)", @@ -409,27 +438,39 @@ "DEBUG=1", "$(inherited)", ); - INFOPLIST_FILE = ICETutorialSwiftTests/Info.plist; + INFOPLIST_FILE = ICETutorialTests/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; METAL_ENABLE_DEBUG_INFO = YES; + PRODUCT_BUNDLE_IDENTIFIER = "Patrick-Trillsam.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = ICETutorialTests; - TEST_HOST = "$(BUNDLE_LOADER)"; + PROVISIONING_PROFILE_SPECIFIER = ""; + "PROVISIONING_PROFILE_SPECIFIER[sdk=macosx*]" = ""; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ICETutorial.app/ICETutorial"; }; name = Debug; }; 55A1D575193FEFCC00994874 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/ICETutorialSwift.app/ICETutorialSwift"; + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_IDENTITY = "Apple Development"; + "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development"; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = ""; FRAMEWORK_SEARCH_PATHS = ( "$(SDKROOT)/Developer/Library/Frameworks", "$(inherited)", ); - INFOPLIST_FILE = ICETutorialSwiftTests/Info.plist; + INFOPLIST_FILE = ICETutorialTests/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; METAL_ENABLE_DEBUG_INFO = NO; + PRODUCT_BUNDLE_IDENTIFIER = "Patrick-Trillsam.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = ICETutorialTests; - TEST_HOST = "$(BUNDLE_LOADER)"; + PROVISIONING_PROFILE_SPECIFIER = ""; + "PROVISIONING_PROFILE_SPECIFIER[sdk=macosx*]" = ""; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ICETutorial.app/ICETutorial"; }; name = Release; }; diff --git a/ICETutorial.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/ICETutorial.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/ICETutorial.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/ICETutorial.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/ICETutorial.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 0000000..08de0be --- /dev/null +++ b/ICETutorial.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + IDEWorkspaceSharedSettings_AutocreateContextsIfNeeded + + + diff --git a/ICETutorial/AppDelegate.swift b/ICETutorial/AppDelegate.swift index 067bf39..3aefee4 100755 --- a/ICETutorial/AppDelegate.swift +++ b/ICETutorial/AppDelegate.swift @@ -10,69 +10,69 @@ import UIKit @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { - + var window: UIWindow? - - func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: NSDictionary?) -> Bool { - self.window = UIWindow(frame: UIScreen.mainScreen().bounds) + + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]?) -> Bool { // Override point for customization after application launch. - self.window!.backgroundColor = UIColor.whiteColor() + self.window = UIWindow(frame: UIScreen.main.bounds) + self.window!.backgroundColor = .white + // Init the pages texts, and pictures. - var layer1: ICETutorialPage = ICETutorialPage(title: "Picture 1", subTitle: "Champs-Elysées by night", pictureName: "tutorial_background_00@2x.jpg", duration: 3.0) - var layer2: ICETutorialPage = ICETutorialPage(title: "Picture 2", subTitle: "The Eiffel Tower with\n cloudy weather", pictureName: "tutorial_background_01@2x.jpg", duration: 3.0) - var layer3: ICETutorialPage = ICETutorialPage(title: "Picture 3", subTitle: "An other famous street of Paris", pictureName: "tutorial_background_02@2x.jpg", duration: 3.0) - var layer4: ICETutorialPage = ICETutorialPage(title: "Picture 4", subTitle: "The Eiffel Tower with a better weather", pictureName: "tutorial_background_03@2x.jpg", duration: 3.0) - var layer5: ICETutorialPage = ICETutorialPage(title: "Picture 5", subTitle: "The Louvre's Museum Pyramide", pictureName: "tutorial_background_04@2x.jpg", duration: 3.0) + let layer1 = ICETutorialPage(title: "Picture 1", subTitle: "Champs-Elysées by night", pictureName: "tutorial_background_00@2x.jpg", duration: 3.0) + let layer2 = ICETutorialPage(title: "Picture 2", subTitle: "The Eiffel Tower with\n cloudy weather", pictureName: "tutorial_background_01@2x.jpg", duration: 3.0) + let layer3 = ICETutorialPage(title: "Picture 3", subTitle: "An other famous street of Paris", pictureName: "tutorial_background_02@2x.jpg", duration: 3.0) + let layer4 = ICETutorialPage(title: "Picture 4", subTitle: "The Eiffel Tower with a better weather", pictureName: "tutorial_background_03@2x.jpg", duration: 3.0) + let layer5 = ICETutorialPage(title: "Picture 5", subTitle: "The Louvre's Museum Pyramide", pictureName: "tutorial_background_04@2x.jpg", duration: 3.0) // Set the common style for SubTitles and Description (can be overrided on each page). - var titleStyle: ICETutorialLabelStyle = ICETutorialLabelStyle() - titleStyle.font = UIFont(name: "Helvetica-Bold", size: 17.0) - titleStyle.color = UIColor.whiteColor() + let titleStyle = ICETutorialLabelStyle() + titleStyle.font = .boldSystemFont(ofSize: 17) + titleStyle.color = .white titleStyle.linesNumber = 1 - titleStyle.offsset = 180 + titleStyle.offset = 180 - var subStyle: ICETutorialLabelStyle = ICETutorialLabelStyle() - subStyle.font = UIFont(name: "Helvetica", size: 15.0) - subStyle.color = UIColor.whiteColor() + let subStyle = ICETutorialLabelStyle() + subStyle.font = .systemFont(ofSize: 15) + subStyle.color = .white subStyle.linesNumber = 1 - subStyle.offsset = 150 - + subStyle.offset = 150 - var listPages: ICETutorialPage[] = [layer1, layer2, layer3, layer4, layer5] + let listPages = [layer1, layer2, layer3, layer4, layer5] - var controller: ICETutorialController = ICETutorialController(pages: listPages) + let controller = ICETutorialController(pages: listPages) controller.commonPageTitleStyle = titleStyle controller.commonPageSubTitleStyle = subStyle controller.startScrolling() - + self.window!.rootViewController = controller self.window!.makeKeyAndVisible() return true } - - func applicationWillResignActive(application: UIApplication) { + + 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) { + + 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) { + + 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) { + + 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) { + + func applicationWillTerminate(_ application: UIApplication) { // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. } - - + + } diff --git a/ICETutorial/Images.xcassets/AppIcon.appiconset/Contents.json b/ICETutorial/Images.xcassets/AppIcon.appiconset/Contents.json index 91bf9c1..9221b9b 100755 --- a/ICETutorial/Images.xcassets/AppIcon.appiconset/Contents.json +++ b/ICETutorial/Images.xcassets/AppIcon.appiconset/Contents.json @@ -2,52 +2,97 @@ "images" : [ { "idiom" : "iphone", - "size" : "29x29", - "scale" : "2x" + "scale" : "2x", + "size" : "20x20" }, { "idiom" : "iphone", - "size" : "40x40", - "scale" : "2x" + "scale" : "3x", + "size" : "20x20" }, { "idiom" : "iphone", - "size" : "60x60", - "scale" : "2x" + "scale" : "2x", + "size" : "29x29" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "29x29" + }, + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "40x40" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "40x40" + }, + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "60x60" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "60x60" }, { "idiom" : "ipad", - "size" : "29x29", - "scale" : "1x" + "scale" : "1x", + "size" : "20x20" }, { "idiom" : "ipad", - "size" : "29x29", - "scale" : "2x" + "scale" : "2x", + "size" : "20x20" }, { "idiom" : "ipad", - "size" : "40x40", - "scale" : "1x" + "scale" : "1x", + "size" : "29x29" }, { "idiom" : "ipad", - "size" : "40x40", - "scale" : "2x" + "scale" : "2x", + "size" : "29x29" }, { "idiom" : "ipad", - "size" : "76x76", - "scale" : "1x" + "scale" : "1x", + "size" : "40x40" }, { "idiom" : "ipad", - "size" : "76x76", - "scale" : "2x" + "scale" : "2x", + "size" : "40x40" + }, + { + "idiom" : "ipad", + "scale" : "1x", + "size" : "76x76" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "76x76" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "83.5x83.5" + }, + { + "idiom" : "ios-marketing", + "scale" : "1x", + "size" : "1024x1024" } ], "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 } -} \ No newline at end of file +} diff --git a/ICETutorial/Images.xcassets/Contents.json b/ICETutorial/Images.xcassets/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/ICETutorial/Images.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/ICETutorial/Images.xcassets/LaunchImage.launchimage/Contents.json b/ICETutorial/Images.xcassets/LaunchImage.launchimage/Contents.json deleted file mode 100755 index 6f870a4..0000000 --- a/ICETutorial/Images.xcassets/LaunchImage.launchimage/Contents.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "images" : [ - { - "orientation" : "portrait", - "idiom" : "iphone", - "extent" : "full-screen", - "minimum-system-version" : "7.0", - "scale" : "2x" - }, - { - "orientation" : "portrait", - "idiom" : "iphone", - "subtype" : "retina4", - "extent" : "full-screen", - "minimum-system-version" : "7.0", - "scale" : "2x" - }, - { - "orientation" : "portrait", - "idiom" : "ipad", - "extent" : "full-screen", - "minimum-system-version" : "7.0", - "scale" : "1x" - }, - { - "orientation" : "landscape", - "idiom" : "ipad", - "extent" : "full-screen", - "minimum-system-version" : "7.0", - "scale" : "1x" - }, - { - "orientation" : "portrait", - "idiom" : "ipad", - "extent" : "full-screen", - "minimum-system-version" : "7.0", - "scale" : "2x" - }, - { - "orientation" : "landscape", - "idiom" : "ipad", - "extent" : "full-screen", - "minimum-system-version" : "7.0", - "scale" : "2x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/ICETutorial/Info.plist b/ICETutorial/Info.plist index 1101fb2..db8641f 100755 --- a/ICETutorial/Info.plist +++ b/ICETutorial/Info.plist @@ -7,7 +7,7 @@ CFBundleExecutable ${EXECUTABLE_NAME} CFBundleIdentifier - Patrick-Trillsam.${PRODUCT_NAME:rfc1034identifier} + $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName @@ -22,6 +22,8 @@ 1 LSRequiresIPhoneOS + UILaunchStoryboardName + Launch Screen UIRequiredDeviceCapabilities armv7 diff --git a/ICETutorial/Launch Screen.storyboard b/ICETutorial/Launch Screen.storyboard new file mode 100644 index 0000000..e4402cd --- /dev/null +++ b/ICETutorial/Launch Screen.storyboard @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ICETutorial/Libraries/ICETutorialController.swift b/ICETutorial/Libraries/ICETutorialController.swift index 7326e3c..e33d2de 100755 --- a/ICETutorial/Libraries/ICETutorialController.swift +++ b/ICETutorial/Libraries/ICETutorialController.swift @@ -10,395 +10,376 @@ import Foundation import UIKit enum ScrollingState : Int { - case Auto - case Manual - case Looping + case auto + case manual + case looping } class ICETutorialController : UIViewController, UIScrollViewDelegate { - - var frontLayerView: UIImageView! - var backLayerView: UIImageView! - var scrollView: UIScrollView! - var pageControl: UIPageControl! - var leftButton: UIButton! - var rightButton: UIButton! - - var overlayLogo: UILabel! - - var currentPageIndex: NSInteger! - var nextPageIndex: NSInteger? - var currentState: ScrollingState? - var windowSize: CGSize? - var pages: ICETutorialPage[]! - var autoScrollEnabled: Bool! + + var frontLayerView = UIImageView() + var backLayerView = UIImageView() + var scrollView = UIScrollView() + var pageControl = UIPageControl() + var leftButton = UIButton() + var rightButton = UIButton() + + var overlayLogo = UILabel() + + var currentPageIndex = 0 + var nextPageIndex = 0 + var currentState = ScrollingState.auto + var pages: [ICETutorialPage] + var autoScrollEnabled = true var commonPageTitleStyle: ICETutorialLabelStyle! var commonPageSubTitleStyle: ICETutorialLabelStyle! - init(pages: ICETutorialPage[]) { - super.init(nibName: nil, bundle: nil) - - self.autoScrollEnabled = true - self.currentPageIndex = 0 - // Auto-scrollDuration + init(pages: [ICETutorialPage]) { self.pages = pages - - self.frontLayerView = UIImageView() - self.backLayerView = UIImageView() - self.scrollView = UIScrollView() - - self.overlayLogo = UILabel() - self.pageControl = UIPageControl() - self.leftButton = UIButton() - self.rightButton = UIButton() + super.init(nibName: nil, bundle: nil) + } + + required init?(coder aDecoder: NSCoder) { + fatalError("init(coder:) has not been implemented") } override func viewDidLoad() { super.viewDidLoad() - self.view!.backgroundColor = UIColor.blackColor() + view?.backgroundColor = UIColor.black - self.setupView() - - // Overlays. - self.setOverlayTexts() - self.setOverlayTitle() + setupView() + + // Overlays + setOverlayTexts() + setOverlayTitle() // Preset the origin state. - self.setOriginLayersState() + setOriginLayersState() } func setupView() { - self.frontLayerView!.frame = self.view.bounds - self.backLayerView!.frame = self.view.bounds + frontLayerView.frame = view.bounds + backLayerView.frame = view.bounds - // Decoration. - var gradientView = UIImageView(frame: CGRectMake(0, 368, 320, 200)) + // Decoration + let gradientView = UIImageView(frame: view.bounds) gradientView.image = UIImage(named: "background-gradient.png") - // Title. - self.overlayLogo!.frame = CGRectMake(84, 116, 212, 50) - self.overlayLogo!.textColor = UIColor.whiteColor() - self.overlayLogo!.font = UIFont(name: "Helvetica-Bold", size: 32.0) - - // ScrollView configuration. - self.scrollView!.frame = self.view.bounds - self.scrollView!.delegate = self - self.scrollView!.pagingEnabled = true - self.scrollView!.contentSize = CGSizeMake(5 * 320, self.view.bounds.height) - - // PageControl. - self.pageControl!.frame = CGRectMake(141, 453, 36, 32) - self.pageControl!.numberOfPages = self.numberOfPages() - self.pageControl!.currentPage = 0 - self.pageControl!.addTarget(self, action: "didClickOnPageControl:", forControlEvents: UIControlEvents.ValueChanged) - - // UIButtons. - self.leftButton!.frame = CGRectMake(20, 494, 130, 36) - self.rightButton!.frame = CGRectMake(172, 494, 130, 36) - self.leftButton!.backgroundColor = UIColor.darkGrayColor() - self.rightButton!.backgroundColor = UIColor.darkGrayColor() - self.leftButton!.setTitle("Button 1", forState: UIControlState.Normal) - self.rightButton!.setTitle("Button 2", forState: UIControlState.Normal) - self.leftButton!.addTarget(self, action: "didClickOnButton1:", forControlEvents: UIControlEvents.TouchUpInside) - self.rightButton!.addTarget(self, action: "didClickOnButton2:", forControlEvents: UIControlEvents.TouchUpInside) - - - // Fetch on screen. - self.view.addSubview(self.frontLayerView) - self.view.addSubview(self.backLayerView) - self.view.addSubview(gradientView) - self.view.addSubview(self.scrollView) - self.view.addSubview(self.overlayLogo) - self.view.addSubview(self.pageControl) - self.view.addSubview(self.leftButton) - self.view.addSubview(self.rightButton) + // Title + overlayLogo.frame = CGRect.init(origin: CGPoint.init(x: 0, y: 40), size: CGSize.init(width: view.bounds.size.width, height: 40)) + overlayLogo.textColor = .white + overlayLogo.textAlignment = .center + overlayLogo.font = .boldSystemFont(ofSize: 32) + + // ScrollView configuration + scrollView.frame = view.bounds + scrollView.delegate = self + scrollView.isPagingEnabled = true + scrollView.contentSize = CGSize(width: CGFloat(pages.count) * view.bounds.width, height: view.bounds.height) + + // PageControl + var rect = CGRect.zero + rect.size.width = CGFloat(pages.count) * 8.0 + rect.size.height = 32 + rect.origin.x = (view.bounds.size.width - rect.size.width) / 2.0 + rect.origin.y = view.bounds.size.height - 120 + pageControl.frame = rect + pageControl.numberOfPages = pages.count + pageControl.currentPage = 0 + pageControl.addTarget(self, action: #selector(didClickOnPageControl(sender:)), for: UIControl.Event.valueChanged) + + // UIButtons + rect.size.width = 130 + rect.size.height = 36 + rect.origin.x = 30 + rect.origin.y = view.bounds.size.height - 80.0 + leftButton.frame = rect + rect.origin.x = view.bounds.size.width - rect.size.width - rect.origin.x + rightButton.frame = rect + leftButton.backgroundColor = .darkGray + rightButton.backgroundColor = .darkGray + leftButton.setTitle("Button 1", for: .normal) + rightButton.setTitle("Button 2", for: .normal) + leftButton.addTarget(self, action: #selector(didClickOnButton1(sender:)), for: .touchUpInside) + rightButton.addTarget(self, action: #selector(didClickOnButton2(sender:)), for: .touchUpInside) + + // Fetch on screen + view.addSubview(frontLayerView) + view.addSubview(backLayerView) + view.addSubview(gradientView) + view.addSubview(scrollView) + view.addSubview(overlayLogo) + view.addSubview(pageControl) + view.addSubview(leftButton) + view.addSubview(rightButton) } - func didClickOnButton1(sender: UIButton) { + @objc func didClickOnButton1(sender: UIButton) { } - func didClickOnButton2(sender: UIButton) { + @objc func didClickOnButton2(sender: UIButton) { } - func didClickOnPageControl(sender: UIPageControl) { - self.stopScrolling() + @objc func didClickOnPageControl(sender: UIPageControl) { + stopScrolling() - // Make the scrollView animation. - self.scrollToNextPageIndex(sender.currentPage) + // Make the scrollView animation + scrollToNextPageIndex(nextPageIndex: sender.currentPage) } - // Set the list of pages (ICETutorialPage). - func setPages(pages: ICETutorialPage[] ) { + // Set the list of pages (ICETutorialPage) + func setPages(pages: [ICETutorialPage] ) { self.pages = pages } - func numberOfPages() -> Int { - if (self.pages) { - return self.pages!.count - } - return 0 - } - - func animateScrolling() { - if (self.currentState == ScrollingState.Manual) { + @objc func animateScrolling() { + if (currentState == ScrollingState.manual) { return; } // Jump to the next page... - var nextPage: Int = self.currentPageIndex! + 1 - if (nextPage == self.numberOfPages()) { + var nextPage = currentPageIndex + 1 + if (nextPage == pages.count) { // ...stop the auto-scrolling or... - if (!self.autoScrollEnabled) { - self.currentState = ScrollingState.Manual + if (!autoScrollEnabled) { + currentState = ScrollingState.manual return; } // ...jump to the first page. nextPage = 0 - self.currentState = ScrollingState.Looping + currentState = ScrollingState.looping // Set alpha on layers. - self.setOriginLayerAlpha() - self.setBackLayerPictureWithPageIndex(-1) + setOriginLayerAlpha() + setBackLayerPictureWithPageIndex(index: -1) } else { - self.currentState = ScrollingState.Auto + currentState = ScrollingState.auto } // Make the scrollView animation. - var nextPagePosition: Float = Float(nextPage) * 320 - self.scrollView!.setContentOffset(CGPointMake(nextPagePosition, 0), animated: true) + let nextPagePosition = CGFloat(nextPage) * view.frame.size.width + scrollView.setContentOffset(CGPoint(x: nextPagePosition, y: 0), animated: true) // Set the PageControl on the right page. - self.pageControl!.currentPage = nextPage + pageControl.currentPage = nextPage // Call the next animation after X seconds. - self.autoScrollToNextPage() + autoScrollToNextPage() } func autoScrollToNextPage() { - let page: ICETutorialPage = self.pages[self.currentPageIndex!] - - if (self.autoScrollEnabled) { - NSTimer.scheduledTimerWithTimeInterval(page.duration!, target: self, selector: Selector("animateScrolling"), userInfo: nil, repeats: false) + if (autoScrollEnabled) { + Timer.scheduledTimer(timeInterval: pages[currentPageIndex].duration!, target: self, selector: #selector(animateScrolling), userInfo: nil, repeats: false) } } func scrollToNextPageIndex(nextPageIndex: NSInteger) { // Make the scrollView animation. - self.scrollView!.setContentOffset(CGPointMake(Float(nextPageIndex) * self.view.frame.size.width,0), animated: true) + scrollView.setContentOffset(CGPoint(x: CGFloat(nextPageIndex) * view.frame.size.width, y: 0), animated: true) // Set the PageControl on the right page. - self.pageControl!.currentPage = nextPageIndex + pageControl.currentPage = nextPageIndex } // Run it. func startScrolling() { - self.autoScrollToNextPage() + autoScrollToNextPage() } // Manually stop the scrolling func stopScrolling() { - self.currentState = ScrollingState.Manual - } - - // State. - func getCurrentState() -> ScrollingState { - return self.currentState! + currentState = ScrollingState.manual } // Setup the Title Label. func setOverlayTitle() { - self.overlayLogo!.text = "Welcome" + overlayLogo.text = "Welcome" } // Setup the Title/Subtitle style/text. func setOverlayTexts() { var index: Int = 0 - for page in self.pages! { - if (page.title.text) { - var title: UILabel = self.overlayLabelWithText(page.title.text!, style: page.title!, commonStyle: self.commonPageTitleStyle, index: index) - self.scrollView!.addSubview(title) - } - if (page.subTitle.text) { - var subTitle: UILabel = self.overlayLabelWithText(page.subTitle.text!, style: page.subTitle!, commonStyle: self.commonPageSubTitleStyle!, index: index) - self.scrollView!.addSubview(subTitle) - } - index++ + for page in pages { + let title = overlayLabelWithText(text: page.title.text!, style: page.title!, commonStyle: commonPageTitleStyle, index: index) + scrollView.addSubview(title) + let subTitle = overlayLabelWithText(text: page.subTitle.text!, style: page.subTitle!, commonStyle: commonPageSubTitleStyle!, index: index) + scrollView.addSubview(subTitle) + index += 1 } } - func overlayLabelWithText(text: NSString, style: ICETutorialLabelStyle, commonStyle: ICETutorialLabelStyle, index: NSInteger) -> UILabel { - var position: CGFloat = (CGFloat)(index * 320) - var positionY: CGFloat = (CGFloat)(540 - commonStyle.offsset) - var overlayLabel: UILabel = UILabel() - overlayLabel.frame = CGRectMake(position, positionY, 320, 34) + func overlayLabelWithText(text: String, style: ICETutorialLabelStyle, commonStyle: ICETutorialLabelStyle, index: Int) -> UILabel { + let position = CGFloat(index) * view.bounds.size.width + let positionY = view.bounds.size.height - commonStyle.offset + let overlayLabel = UILabel() + overlayLabel.frame = CGRect(x: position, y: positionY, width: view.bounds.size.width, height: 34) // SubTitles. - overlayLabel.setTranslatesAutoresizingMaskIntoConstraints(false) + overlayLabel.translatesAutoresizingMaskIntoConstraints = false overlayLabel.numberOfLines = commonStyle.linesNumber - overlayLabel.backgroundColor = UIColor.clearColor() - overlayLabel.textAlignment = NSTextAlignment.Center - + overlayLabel.backgroundColor = .clear + overlayLabel.textAlignment = .center + // Datas and style. - overlayLabel.text = text - if (style.font) { + overlayLabel.text = text as String + overlayLabel.font = commonStyle.font + if (style.font != commonStyle.font) { overlayLabel.font = style.font - } else { - overlayLabel.font = commonStyle.font } - if (style.color) { + overlayLabel.textColor = commonStyle.color + if (style.color != commonStyle.color) { overlayLabel.textColor = style.color - } else { - overlayLabel.textColor = commonStyle.color } - + return overlayLabel } // Handle the background layer image switch. func setBackLayerPictureWithPageIndex(index: NSInteger) { - self.setBackgroundImage(self.backLayerView!, pageIndex: index + 1) + setBackgroundImage(imageView: backLayerView, pageIndex: index + 1) } // Handle the front layer image switch. func setFrontLayerPictureWithPageIndex(index: NSInteger) { - self.setBackgroundImage(self.frontLayerView!, pageIndex: index) + setBackgroundImage(imageView: frontLayerView, pageIndex: index) } // Handle page image's loading func setBackgroundImage(imageView: UIImageView, pageIndex: NSInteger) { - if (pageIndex >= self.pages!.count) { + if (pageIndex >= pages.count) { imageView.image = nil return } - let page: ICETutorialPage = self.pages[pageIndex] + let page: ICETutorialPage = pages[pageIndex] imageView.image = UIImage(named: page.pictureName!) } // Setup layer's alpha. func setOriginLayerAlpha() { - self.frontLayerView!.alpha = 1 - self.backLayerView!.alpha = 0 + frontLayerView.alpha = 1 + backLayerView.alpha = 0 } // Preset the origin state. func setOriginLayersState() { - self.currentState = ScrollingState.Auto - self.backLayerView!.backgroundColor = UIColor.blackColor() - self.frontLayerView!.backgroundColor = UIColor.blackColor() - self.setLayersPicturesWithIndex(0) + currentState = ScrollingState.auto + backLayerView.backgroundColor = .black + frontLayerView.backgroundColor = .black + setLayersPicturesWithIndex(index: 0) } - + // Setup the layers with the page index. func setLayersPicturesWithIndex(index: NSInteger) { - self.currentPageIndex = index - self.setOriginLayerAlpha() - self.setFrontLayerPictureWithPageIndex(index) - self.setBackLayerPictureWithPageIndex(index) + currentPageIndex = index + setOriginLayerAlpha() + setFrontLayerPictureWithPageIndex(index: index) + setBackLayerPictureWithPageIndex(index: index) } // Animate the fade-in/out (Cross-disolve) with the scrollView translation. - func disolveBackgroundWithContentOffset(offset: Float) { - if (self.currentState == ScrollingState.Looping) { + func disolveBackgroundWithContentOffset(offset: CGFloat) { + if (currentState == ScrollingState.looping) { // Jump from the last page to the first. - self.scrollingToFirstPageWithOffset(offset) + scrollingToFirstPageWithOffset(offset: offset) } else { // Or just scroll to the next/previous page. - self.scrollingToNextPageWithOffset(offset) + scrollingToNextPageWithOffset(offset: offset) } } // Handle alpha on layers when the auto-scrolling is looping to the first page. - func scrollingToFirstPageWithOffset(offset: Float) { + func scrollingToFirstPageWithOffset(offset: CGFloat) { // Compute the scrolling percentage on all the page. - let offsetX: Float = (offset * 320) - let numberOfPage: Float = 5 - let offsetY: Float = (320 * numberOfPage) - let finalOffset: Float = offsetX / offsetY + let offsetX = offset * view.bounds.size.width + let numberOfPage = CGFloat(pages.count) + let offsetY = view.bounds.size.width * numberOfPage + let finalOffset = offsetX / offsetY // Scrolling finished... - if (offset == 0) { - self.setOriginLayersState() + if (finalOffset == 0) { + setOriginLayersState() return } // Invert alpha for the back picture. - var backLayerAlpha: Float = (1 - offset) - var frontLayerAlpha: Float = offset + let backLayerAlpha = 1.0 - finalOffset + let frontLayerAlpha = finalOffset // Set alpha. - self.backLayerView!.alpha = backLayerAlpha - self.frontLayerView!.alpha = frontLayerAlpha + backLayerView.alpha = backLayerAlpha + frontLayerView.alpha = frontLayerAlpha } // Handle alpha on layers when we are scrolling to the next/previous page. - func scrollingToNextPageWithOffset(offset: Float) { + func scrollingToNextPageWithOffset(offset: CGFloat) { // Current page index in scrolling. - var page: Int = Int(offset) + let page: Int = Int(offset) // Keep only the float value. - var alphaValue: Float = offset - Float(Int(offset)); + let alphaValue = offset - CGFloat(Int(offset)); // This is only when you scroll to the right on the first page. // That will fade-in black the first picture. - if (alphaValue < 0 && self.currentPageIndex == 0) { - self.backLayerView!.image = nil - self.frontLayerView!.alpha = (1 + alphaValue) + if (alphaValue < 0 && currentPageIndex == 0) { + backLayerView.image = nil + frontLayerView.alpha = 1.0 + alphaValue return } // Switch pictures, and imageView alpha. - if (page != self.currentPageIndex || - (page == self.currentPageIndex && 0.0 < offset && offset < 1.0)) { - self.setLayersPicturesWithIndex(page) + if (page != currentPageIndex || + (page == currentPageIndex && 0.0 < offset && offset < 1.0)) { + setLayersPicturesWithIndex(index: page) } // Invert alpha for the front picture. - var backLayerAlpha: Float = alphaValue - var frontLayerAlpha: Float = (1 - alphaValue) + let backLayerAlpha = alphaValue + let frontLayerAlpha = 1.0 - alphaValue // Set alpha. - self.backLayerView!.alpha = backLayerAlpha - self.frontLayerView!.alpha = frontLayerAlpha + backLayerView.alpha = backLayerAlpha + frontLayerView.alpha = frontLayerAlpha } - - func scrollViewDidScroll(scrollView: UIScrollView!) { + + func scrollViewDidScroll(_ scrollView: UIScrollView) { // Get scrolling position, and nextPageindex. - var scrollingPosition: Float = self.scrollView!.contentOffset.x / 320.0 - var nextPageIndex: Int = Int(scrollingPosition) + let scrollingPosition = scrollView.contentOffset.x / view.bounds.size.width + var nextPageIndex = Int(scrollingPosition) // If we are looping, we reset the indexPage. - if (self.currentState == ScrollingState.Looping) { + if (currentState == ScrollingState.looping) { nextPageIndex = 0 } // If we are going to the next page, let's call the delegate. - if (nextPageIndex != self.nextPageIndex) { + if (self.nextPageIndex != nextPageIndex) { // DELEGATE self.nextPageIndex = nextPageIndex } // Delegate when we reach the end. - if (self.nextPageIndex == self.numberOfPages() - 1) { + if (nextPageIndex == pages.count - 1) { // DELEGATE } // Animate. - self.disolveBackgroundWithContentOffset(scrollingPosition) + disolveBackgroundWithContentOffset(offset: scrollingPosition) } - func scrollViewWillBeginDragging(scrollView: UIScrollView!) { + func scrollViewWillBeginDragging(_ scrollView: UIScrollView) { // At the first user interaction, we disable the auto scrolling. - if (self.scrollView!.tracking) { - self.stopScrolling() + if (scrollView.isTracking) { + stopScrolling() } } - func scrollViewDidEndDecelerating(scrollView: UIScrollView!) { + func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) { // Update the page index. - self.pageControl!.currentPage = self.currentPageIndex!; + pageControl.currentPage = currentPageIndex; } -} \ No newline at end of file + +} diff --git a/ICETutorial/Libraries/ICETutorialPage.swift b/ICETutorial/Libraries/ICETutorialPage.swift index fa6a93b..26981f6 100755 --- a/ICETutorial/Libraries/ICETutorialPage.swift +++ b/ICETutorial/Libraries/ICETutorialPage.swift @@ -9,18 +9,16 @@ import Foundation import UIKit -class ICETutorialLabelStyle : NSObject { +class ICETutorialLabelStyle { var text: String? - var font: UIFont? - var color: UIColor? - var linesNumber: Int = 0 - var offsset: Int = 0 + var font = UIFont.systemFont(ofSize: 17) + var color = UIColor.white + var linesNumber = 0 + var offset: CGFloat = 0 + + init() {} - init() { - super.init() - } - init(text: String) { self.text = text } @@ -30,17 +28,18 @@ class ICETutorialLabelStyle : NSObject { self.font = font self.color = color } + } -class ICETutorialPage : NSObject { +class ICETutorialPage { var title: ICETutorialLabelStyle! var subTitle: ICETutorialLabelStyle! var pictureName: String? - var duration: NSTimeInterval? + var duration: TimeInterval? - init(title: String, subTitle: NSString, pictureName: String, duration: NSTimeInterval) { + init(title: String, subTitle: String, pictureName: String, duration: TimeInterval) { self.title = ICETutorialLabelStyle(text: title) self.subTitle = ICETutorialLabelStyle(text: subTitle) self.pictureName = pictureName @@ -54,4 +53,5 @@ class ICETutorialPage : NSObject { func setTitleStyle(style: ICETutorialLabelStyle) { self.title = style } -} \ No newline at end of file + +} diff --git a/ICETutorialTests/ICETutorialTests.swift b/ICETutorialTests/ICETutorialTests.swift index 92fa904..80d3b07 100755 --- a/ICETutorialTests/ICETutorialTests.swift +++ b/ICETutorialTests/ICETutorialTests.swift @@ -27,7 +27,7 @@ class ICETutorialTests: XCTestCase { func testPerformanceExample() { // This is an example of a performance test case. - self.measureBlock() { + self.measure() { // Put the code you want to measure the time of here. } } diff --git a/ICETutorialTests/Info.plist b/ICETutorialTests/Info.plist index 1cc7f6e..6d32c15 100755 --- a/ICETutorialTests/Info.plist +++ b/ICETutorialTests/Info.plist @@ -7,7 +7,7 @@ CFBundleExecutable ${EXECUTABLE_NAME} CFBundleIdentifier - Patrick-Trillsam.${PRODUCT_NAME:rfc1034identifier} + $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName diff --git a/Resources/Default-568h@2x.png b/Resources/Default-568h@2x.png deleted file mode 100755 index 0891b7a..0000000 Binary files a/Resources/Default-568h@2x.png and /dev/null differ diff --git a/Resources/Default.png b/Resources/Default.png deleted file mode 100755 index 4c8ca6f..0000000 Binary files a/Resources/Default.png and /dev/null differ diff --git a/Resources/Default@2x.png b/Resources/Default@2x.png deleted file mode 100755 index 35b84cf..0000000 Binary files a/Resources/Default@2x.png and /dev/null differ diff --git a/Resources/button-background.png b/Resources/button-background.png deleted file mode 100755 index a8286f2..0000000 Binary files a/Resources/button-background.png and /dev/null differ diff --git a/Resources/button-background@2x.png b/Resources/button-background@2x.png deleted file mode 100755 index 9d8b78a..0000000 Binary files a/Resources/button-background@2x.png and /dev/null differ