diff --git a/Spring/DesignableTabBarController.swift b/Spring/DesignableTabBarController.swift index f75fbcc..6b6dc03 100644 --- a/Spring/DesignableTabBarController.swift +++ b/Spring/DesignableTabBarController.swift @@ -47,7 +47,7 @@ import UIKit @IBInspectable var firstSelectedImage: UIImage? { didSet { if let image = firstSelectedImage { - var tabBarItems = self.tabBar.items as [UITabBarItem]! + var tabBarItems = self.tabBar.items as [UITabBarItem]? tabBarItems?[0].selectedImage = image.withRenderingMode(UIImage.RenderingMode.alwaysTemplate) } } @@ -56,7 +56,7 @@ import UIKit @IBInspectable var secondSelectedImage: UIImage? { didSet { if let image = secondSelectedImage { - var tabBarItems = self.tabBar.items as [UITabBarItem]! + var tabBarItems = self.tabBar.items as [UITabBarItem]? tabBarItems?[1].selectedImage = image.withRenderingMode(UIImage.RenderingMode.alwaysTemplate) } } @@ -65,7 +65,7 @@ import UIKit @IBInspectable var thirdSelectedImage: UIImage? { didSet { if let image = thirdSelectedImage { - var tabBarItems = self.tabBar.items as [UITabBarItem]! + var tabBarItems = self.tabBar.items as [UITabBarItem]? tabBarItems?[2].selectedImage = image.withRenderingMode(UIImage.RenderingMode.alwaysTemplate) } } @@ -74,7 +74,7 @@ import UIKit @IBInspectable var fourthSelectedImage: UIImage? { didSet { if let image = fourthSelectedImage { - var tabBarItems = self.tabBar.items as [UITabBarItem]! + var tabBarItems = self.tabBar.items as [UITabBarItem]? tabBarItems?[3].selectedImage = image.withRenderingMode(UIImage.RenderingMode.alwaysTemplate) } } @@ -83,7 +83,7 @@ import UIKit @IBInspectable var fifthSelectedImage: UIImage? { didSet { if let image = fifthSelectedImage { - var tabBarItems = self.tabBar.items as [UITabBarItem]! + var tabBarItems = self.tabBar.items as [UITabBarItem]? tabBarItems?[4].selectedImage = image.withRenderingMode(UIImage.RenderingMode.alwaysTemplate) } } @@ -92,9 +92,11 @@ import UIKit override func viewDidLoad() { super.viewDidLoad() - for item in self.tabBar.items as [UITabBarItem]! { - if let image = item.image { - item.image = image.imageWithColor(tintColor: self.normalTint).withRenderingMode(UIImage.RenderingMode.alwaysOriginal) + if let arr = self.tabBar.items as [UITabBarItem]? { + for item in arr { + if let image = item.image { + item.image = image.imageWithColor(tintColor: self.normalTint).withRenderingMode(UIImage.RenderingMode.alwaysOriginal) + } } } } diff --git a/Spring/KeyboardLayoutConstraint.swift b/Spring/KeyboardLayoutConstraint.swift index 1b45a56..d9048a1 100644 --- a/Spring/KeyboardLayoutConstraint.swift +++ b/Spring/KeyboardLayoutConstraint.swift @@ -49,7 +49,9 @@ public class KeyboardLayoutConstraint: NSLayoutConstraint { if let userInfo = notification.userInfo { if let frameValue = userInfo[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue { let frame = frameValue.cgRectValue - keyboardVisibleHeight = frame.size.height + + let bottomSafeAreaInset = UIApplication.shared.keyWindow?.safeAreaInsets.bottom ?? 0 + keyboardVisibleHeight = frame.size.height - bottomSafeAreaInset } self.updateConstant() diff --git a/Spring/LoadingView.swift b/Spring/LoadingView.swift index 5f62ce8..55e5e2c 100644 --- a/Spring/LoadingView.swift +++ b/Spring/LoadingView.swift @@ -50,7 +50,7 @@ public extension UIView { static let Tag = 1000 } - public func showLoading() { + func showLoading() { if self.viewWithTag(LoadingViewConstants.Tag) != nil { // If loading view is already found in current view hierachy, do nothing @@ -68,7 +68,7 @@ public extension UIView { }) } - public func hideLoading() { + func hideLoading() { if let loadingXibView = self.viewWithTag(LoadingViewConstants.Tag) { loadingXibView.alpha = 1 diff --git a/Spring/Misc.swift b/Spring/Misc.swift index c0a9add..96024b8 100644 --- a/Spring/Misc.swift +++ b/Spring/Misc.swift @@ -23,9 +23,9 @@ import UIKit public extension String { - public var length: Int { return self.characters.count } + var length: Int { return self.count } - public func toURL() -> NSURL? { + func toURL() -> NSURL? { return NSURL(string: self) } } @@ -73,7 +73,7 @@ public extension UIColor { let scanner = Scanner(string: hex) var hexValue: CUnsignedLongLong = 0 if scanner.scanHexInt64(&hexValue) { - switch (hex.characters.count) { + switch (hex.count) { case 3: red = CGFloat((hexValue & 0xF00) >> 8) / 15.0 green = CGFloat((hexValue & 0x0F0) >> 4) / 15.0 diff --git a/Spring/UnwindSegue.swift b/Spring/UnwindSegue.swift index 53a71cb..2080094 100644 --- a/Spring/UnwindSegue.swift +++ b/Spring/UnwindSegue.swift @@ -23,5 +23,5 @@ import UIKit public extension UIViewController { - @IBAction public func unwindToViewController (_ segue: UIStoryboardSegue){} + @IBAction func unwindToViewController (_ segue: UIStoryboardSegue){} } diff --git a/SpringApp.xcodeproj/project.pbxproj b/SpringApp.xcodeproj/project.pbxproj index 8e701c1..ca58980 100644 --- a/SpringApp.xcodeproj/project.pbxproj +++ b/SpringApp.xcodeproj/project.pbxproj @@ -97,6 +97,8 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + 181F7BD822D3785100A45C51 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Main.strings; sourceTree = ""; }; + 181F7BD922D3785100A45C51 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/LaunchScreen.strings; sourceTree = ""; }; 1A4FDA2A1A6E44270099D309 /* LoadingView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LoadingView.swift; sourceTree = ""; }; 1A4FDA2B1A6E44270099D309 /* LoadingView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = LoadingView.xib; sourceTree = ""; }; 1A4FDA331A6E44780099D309 /* Spring.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Spring.framework; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -413,20 +415,20 @@ TargetAttributes = { 1A4FDA321A6E44780099D309 = { CreatedOnToolsVersion = 6.1.1; - LastSwiftMigration = 0900; + LastSwiftMigration = 1020; }; 1A4FDA3C1A6E44780099D309 = { CreatedOnToolsVersion = 6.1.1; - LastSwiftMigration = 0900; + LastSwiftMigration = 1020; TestTargetID = 9641173A1A5BE90A000E3A5A; }; 9641173A1A5BE90A000E3A5A = { CreatedOnToolsVersion = 6.2; - LastSwiftMigration = 0900; + LastSwiftMigration = 1020; }; 9641174F1A5BE90A000E3A5A = { CreatedOnToolsVersion = 6.2; - LastSwiftMigration = 0900; + LastSwiftMigration = 1020; TestTargetID = 9641173A1A5BE90A000E3A5A; }; }; @@ -436,8 +438,8 @@ developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( - en, Base, + en, ); mainGroup = 964117321A5BE90A000E3A5A; productRefGroup = 9641173C1A5BE90A000E3A5A /* Products */; @@ -580,6 +582,7 @@ isa = PBXVariantGroup; children = ( 964117451A5BE90A000E3A5A /* Base */, + 181F7BD822D3785100A45C51 /* en */, ); name = Main.storyboard; sourceTree = ""; @@ -588,6 +591,7 @@ isa = PBXVariantGroup; children = ( 9641174A1A5BE90A000E3A5A /* Base */, + 181F7BD922D3785100A45C51 /* en */, ); name = LaunchScreen.xib; sourceTree = ""; @@ -610,13 +614,12 @@ ); INFOPLIST_FILE = Spring/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "designcode.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; - SWIFT_SWIFT3_OBJC_INFERENCE = Off; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -634,14 +637,13 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = Spring/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "designcode.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_SWIFT3_OBJC_INFERENCE = Off; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -660,8 +662,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "com.jamztang.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_SWIFT3_OBJC_INFERENCE = Off; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SpringApp.app/SpringApp"; }; name = Debug; @@ -675,8 +676,7 @@ PRODUCT_BUNDLE_IDENTIFIER = "com.jamztang.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_SWIFT3_OBJC_INFERENCE = Off; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SpringApp.app/SpringApp"; }; name = Release; @@ -784,12 +784,11 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; INFOPLIST_FILE = SpringApp/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "designcode.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_SWIFT3_OBJC_INFERENCE = Off; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; @@ -799,13 +798,12 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; INFOPLIST_FILE = SpringApp/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "designcode.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_SWIFT3_OBJC_INFERENCE = Off; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Release; @@ -822,8 +820,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "designcode.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_SWIFT3_OBJC_INFERENCE = Off; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SpringApp.app/SpringApp"; }; name = Debug; @@ -837,8 +834,7 @@ PRODUCT_BUNDLE_IDENTIFIER = "designcode.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_SWIFT3_OBJC_INFERENCE = Off; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SpringApp.app/SpringApp"; }; name = Release; diff --git a/SpringApp.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/SpringApp.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/SpringApp.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/SpringApp/Images.xcassets/AppIcon.appiconset/Contents.json b/SpringApp/Images.xcassets/AppIcon.appiconset/Contents.json index 1acc2b0..812c166 100644 --- a/SpringApp/Images.xcassets/AppIcon.appiconset/Contents.json +++ b/SpringApp/Images.xcassets/AppIcon.appiconset/Contents.json @@ -1,5 +1,15 @@ { "images" : [ + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "3x" + }, { "size" : "29x29", "idiom" : "iphone", @@ -36,6 +46,16 @@ "filename" : "appicon@180.png", "scale" : "3x" }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "2x" + }, { "size" : "29x29", "idiom" : "ipad", @@ -77,6 +97,11 @@ "idiom" : "ipad", "filename" : "appicon@167.png", "scale" : "2x" + }, + { + "idiom" : "ios-marketing", + "size" : "1024x1024", + "scale" : "1x" } ], "info" : { diff --git a/SpringApp/OptionsViewController.swift b/SpringApp/OptionsViewController.swift index be62011..2da05cf 100644 --- a/SpringApp/OptionsViewController.swift +++ b/SpringApp/OptionsViewController.swift @@ -17,6 +17,7 @@ protocol OptionsViewControllerDelegate: class { func ySliderChanged(_ sender: AnyObject) func rotateSliderChanged(_ sender: AnyObject) func resetButtonPressed(_ sender: AnyObject) + } class OptionsViewController: UIViewController { diff --git a/SpringApp/SpringViewController.swift b/SpringApp/SpringViewController.swift index 6a4ea1b..faab8b6 100644 --- a/SpringApp/SpringViewController.swift +++ b/SpringApp/SpringViewController.swift @@ -106,6 +106,7 @@ class SpringViewController: UIViewController, UIPickerViewDelegate, UIPickerView SpringAnimation.spring(duration: 0.7, animations: { self.view.transform = CGAffineTransform(scaleX: 0.935, y: 0.935) }) + UIApplication.shared.setStatusBarStyle(UIStatusBarStyle.lightContent, animated: true) } diff --git a/SpringApp/en.lproj/LaunchScreen.strings b/SpringApp/en.lproj/LaunchScreen.strings new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/SpringApp/en.lproj/LaunchScreen.strings @@ -0,0 +1 @@ + diff --git a/SpringApp/en.lproj/Main.strings b/SpringApp/en.lproj/Main.strings new file mode 100644 index 0000000..067cf58 --- /dev/null +++ b/SpringApp/en.lproj/Main.strings @@ -0,0 +1,42 @@ + +/* Class = "UILabel"; text = "x: 0"; ObjectID = "8i2-8d-Gyo"; */ +"8i2-8d-Gyo.text" = "x: 0"; + +/* Class = "UILabel"; text = "y: 0"; ObjectID = "8kG-Ub-7Gx"; */ +"8kG-Ub-7Gx.text" = "y: 0"; + +/* Class = "UILabel"; text = "Scale: 1"; ObjectID = "PFw-Jb-2Xm"; */ +"PFw-Jb-2Xm.text" = "Scale: 1"; + +/* Class = "UITextView"; text = "layer.animation = \"shake\""; ObjectID = "QYe-M8-GcU"; */ +"QYe-M8-GcU.text" = "layer.animation = \"shake\""; + +/* Class = "UILabel"; text = "Rotate: 0"; ObjectID = "Sss-g7-hcA"; */ +"Sss-g7-hcA.text" = "Rotate: 0"; + +/* Class = "UIButton"; normalTitle = "Reset"; ObjectID = "WbE-Ar-bLf"; */ +"WbE-Ar-bLf.normalTitle" = "Reset"; + +/* Class = "UIButton"; normalTitle = "Code"; ObjectID = "XZL-Vb-0wq"; */ +"XZL-Vb-0wq.normalTitle" = "Code"; + +/* Class = "UIButton"; normalTitle = "Options"; ObjectID = "hQw-No-MzG"; */ +"hQw-No-MzG.normalTitle" = "Options"; + +/* Class = "UILabel"; text = "Force: 1"; ObjectID = "hZO-3H-UCU"; */ +"hZO-3H-UCU.text" = "Force: 1"; + +/* Class = "UILabel"; text = "Code"; ObjectID = "jUx-Gp-qoT"; */ +"jUx-Gp-qoT.text" = "Code"; + +/* Class = "UILabel"; text = "Velocity: 0.7"; ObjectID = "kqf-ZO-435"; */ +"kqf-ZO-435.text" = "Velocity: 0.7"; + +/* Class = "UILabel"; text = "Delay: 0"; ObjectID = "nfx-rk-xQP"; */ +"nfx-rk-xQP.text" = "Delay: 0"; + +/* Class = "UILabel"; text = "Damping: 0.7"; ObjectID = "rM7-dW-gD1"; */ +"rM7-dW-gD1.text" = "Damping: 0.7"; + +/* Class = "UILabel"; text = "Duration: 1"; ObjectID = "xk2-sC-g25"; */ +"xk2-sC-g25.text" = "Duration: 1";