Skip to content

Commit

Permalink
Upgraded to Swift 5 and XCode 10.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Yunus TEK committed Jul 15, 2019
1 parent f227c55 commit fd74be4
Show file tree
Hide file tree
Showing 14 changed files with 190 additions and 129 deletions.
38 changes: 30 additions & 8 deletions Example/KGFloatingDrawer-Example.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@
1F441C021AA6A745005772A1 /* KGFloatingDrawer-ExampleTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "KGFloatingDrawer-ExampleTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
1F441C071AA6A745005772A1 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
1F441C081AA6A745005772A1 /* KGFloatingDrawer_ExampleTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KGFloatingDrawer_ExampleTests.swift; sourceTree = "<group>"; };
1F441C121AA6AE19005772A1 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
1F441C121AA6AE19005772A1 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; usesTabs = 0; };
1F441C131AA6AE19005772A1 /* Drawers.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Drawers.storyboard; sourceTree = "<group>"; };
1F441C141AA6AE19005772A1 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
1F441C151AA6AE19005772A1 /* KGDrawerSettingsTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KGDrawerSettingsTableViewController.swift; sourceTree = "<group>"; };
1F441C161AA6AE19005772A1 /* KGDrawerWebViewViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KGDrawerWebViewViewController.swift; sourceTree = "<group>"; };
1F441C171AA6AE19005772A1 /* LeftDrawerTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LeftDrawerTableViewController.swift; sourceTree = "<group>"; };
1F441C151AA6AE19005772A1 /* KGDrawerSettingsTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KGDrawerSettingsTableViewController.swift; sourceTree = "<group>"; usesTabs = 0; };
1F441C161AA6AE19005772A1 /* KGDrawerWebViewViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KGDrawerWebViewViewController.swift; sourceTree = "<group>"; usesTabs = 0; };
1F441C171AA6AE19005772A1 /* LeftDrawerTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LeftDrawerTableViewController.swift; sourceTree = "<group>"; usesTabs = 0; };
32C544AAFDD754DFC176AA6A /* Pods_KGFloatingDrawer_ExampleTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_KGFloatingDrawer_ExampleTests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
45285703E1FEC57C335B8ADC /* Pods-KGFloatingDrawer-ExampleTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-KGFloatingDrawer-ExampleTests.release.xcconfig"; path = "Target Support Files/Pods-KGFloatingDrawer-ExampleTests/Pods-KGFloatingDrawer-ExampleTests.release.xcconfig"; sourceTree = "<group>"; };
6A8138A82EA93310804F84EA /* Pods-KGFloatingDrawer-Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-KGFloatingDrawer-Example.release.xcconfig"; path = "Target Support Files/Pods-KGFloatingDrawer-Example/Pods-KGFloatingDrawer-Example.release.xcconfig"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -80,6 +80,7 @@
FF2F98923FCEC8ABADA11DB7 /* Frameworks */,
);
sourceTree = "<group>";
usesTabs = 0;
};
1F441BEE1AA6A745005772A1 /* Products */ = {
isa = PBXGroup;
Expand Down Expand Up @@ -138,7 +139,6 @@
D15F4ED4853ECE22A63BD431 /* Pods-KGFloatingDrawer-ExampleTests.debug.xcconfig */,
45285703E1FEC57C335B8ADC /* Pods-KGFloatingDrawer-ExampleTests.release.xcconfig */,
);
name = Pods;
path = Pods;
sourceTree = "<group>";
};
Expand Down Expand Up @@ -200,7 +200,7 @@
attributes = {
LastSwiftMigration = 0700;
LastSwiftUpdateCheck = 0700;
LastUpgradeCheck = 0710;
LastUpgradeCheck = 1020;
ORGANIZATIONNAME = "Kyle Goddard";
TargetAttributes = {
1F441BEC1AA6A745005772A1 = {
Expand All @@ -214,10 +214,9 @@
};
buildConfigurationList = 1F441BE81AA6A745005772A1 /* Build configuration list for PBXProject "KGFloatingDrawer-Example" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
English,
en,
Base,
);
Expand Down Expand Up @@ -367,13 +366,23 @@
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";
Expand All @@ -383,6 +392,7 @@
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",
Expand Down Expand Up @@ -413,13 +423,23 @@
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";
Expand All @@ -428,6 +448,7 @@
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;
Expand All @@ -437,6 +458,7 @@
IPHONEOS_DEPLOYMENT_TARGET = 8.3;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
Expand Down
Binary file not shown.
34 changes: 17 additions & 17 deletions Example/KGFloatingDrawer-Example/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
let kKGRightDrawerStoryboardId = "KGRightDrawerViewControllerStoryboardId"


func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
// Override point for customization after application launch.
window = UIWindow(frame: UIScreen.mainScreen().bounds)
window = UIWindow(frame: UIScreen.main.bounds)

window?.rootViewController = drawerViewController

Expand All @@ -33,25 +33,25 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
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.
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the private 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:.
}

Expand Down Expand Up @@ -84,38 +84,38 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
}

private func viewControllerForStoryboardId(storyboardId: String) -> UIViewController {
let viewController: UIViewController = drawerStoryboard().instantiateViewControllerWithIdentifier(storyboardId)
let viewController: UIViewController = drawerStoryboard().instantiateViewController(withIdentifier: storyboardId)
return viewController
}

func drawerSettingsViewController() -> UIViewController {
let viewController = viewControllerForStoryboardId(kKGDrawerSettingsViewControllerStoryboardId)
let viewController = viewControllerForStoryboardId(storyboardId: kKGDrawerSettingsViewControllerStoryboardId)
return viewController
}

func sourcePageViewController() -> UIViewController {
let viewController = viewControllerForStoryboardId(kKGDrawerWebViewViewControllerStoryboardId)
let viewController = viewControllerForStoryboardId(storyboardId: kKGDrawerWebViewViewControllerStoryboardId)
return viewController
}

private func leftViewController() -> UIViewController {
let viewController = viewControllerForStoryboardId(kKGLeftDrawerStoryboardId)
let viewController = viewControllerForStoryboardId(storyboardId: kKGLeftDrawerStoryboardId)
return viewController
}

private func rightViewController() -> UIViewController {
let viewController = viewControllerForStoryboardId(kKGRightDrawerStoryboardId)
let viewController = viewControllerForStoryboardId(storyboardId: kKGRightDrawerStoryboardId)
return viewController
}

func toggleLeftDrawer(sender:AnyObject, animated:Bool) {
_drawerViewController?.toggleDrawer(.Left, animated: true, complete: { (finished) -> Void in
func toggleLeftDrawer(_ sender:AnyObject, animated:Bool) {
_drawerViewController?.toggleDrawer(.left, animated: true, complete: { (finished) -> Void in
// do nothing
})
}

func toggleRightDrawer(sender:AnyObject, animated:Bool) {
_drawerViewController?.toggleDrawer(.Right, animated: true, complete: { (finished) -> Void in
func toggleRightDrawer(_ sender:AnyObject, animated:Bool) {
_drawerViewController?.toggleDrawer(.right, animated: true, complete: { (finished) -> Void in
// do nothing
})
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
{
"images" : [
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "3x"
},
{
"size" : "29x29",
"idiom" : "iphone",
Expand Down Expand Up @@ -36,6 +46,16 @@
"filename" : "icon-180.png",
"scale" : "3x"
},
{
"idiom" : "ipad",
"size" : "20x20",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "20x20",
"scale" : "2x"
},
{
"size" : "29x29",
"idiom" : "ipad",
Expand Down Expand Up @@ -71,6 +91,16 @@
"idiom" : "ipad",
"filename" : "icon-152.png",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "83.5x83.5",
"scale" : "2x"
},
{
"idiom" : "ios-marketing",
"size" : "1024x1024",
"scale" : "1x"
}
],
"info" : {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ import KGFloatingDrawer
class KGDrawerSettingsTableViewController: UITableViewController {

let resetRowIndex:Int = 4

@IBOutlet weak var durationLabel: UILabel!
@IBOutlet weak var delayLabel: UILabel!
@IBOutlet weak var springVelocityLabel: UILabel!
@IBOutlet weak var springDampingLabel: UILabel!

var animator: KGDrawerSpringAnimator?

var defaultDuration: NSTimeInterval?
var defaultDelay: NSTimeInterval?
var defaultDuration: TimeInterval?
var defaultDelay: TimeInterval?
var defaultSpringVelocity: CGFloat?
var defaultSpringDamping: CGFloat?

Expand All @@ -32,21 +32,21 @@ class KGDrawerSettingsTableViewController: UITableViewController {

override func viewDidLoad() {
super.viewDidLoad()

// Uncomment the following line to preserve selection between presentations
// self.clearsSelectionOnViewWillAppear = false

// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
// self.navigationItem.rightBarButtonItem = self.editButtonItem()

if let appDelegate: AppDelegate = UIApplication.sharedApplication().delegate as? AppDelegate {
if let appDelegate: AppDelegate = UIApplication.shared.delegate as? AppDelegate {
animator = appDelegate.drawerViewController.animator
captureDefaultValues(animator!)
reset()
}
}

func captureDefaultValues(animator:KGDrawerSpringAnimator) {
func captureDefaultValues(_ animator:KGDrawerSpringAnimator) {
defaultDuration = animator.animationDuration
defaultDelay = animator.animationDelay
defaultSpringVelocity = animator.initialSpringVelocity
Expand All @@ -61,8 +61,8 @@ class KGDrawerSettingsTableViewController: UITableViewController {

func updateAnimator() {
if let currentAnimator = animator {
currentAnimator.animationDuration = NSTimeInterval(defaultDuration!)
currentAnimator.animationDelay = NSTimeInterval(defaultDelay!)
currentAnimator.animationDuration = TimeInterval(defaultDuration!)
currentAnimator.animationDelay = TimeInterval(defaultDelay!)
currentAnimator.initialSpringVelocity = defaultSpringVelocity!
currentAnimator.springDamping = defaultSpringDamping!
}
Expand All @@ -82,22 +82,22 @@ class KGDrawerSettingsTableViewController: UITableViewController {
springDampingLabel.text = String(format: "%.2f", springDampingSlider.value)
}

@IBAction func durationSliderChanged(sender: UISlider) {
@IBAction func durationSliderChanged(_ sender: UISlider) {
durationLabel.text = String(format: "%.2f", sender.value)
animator?.animationDuration = NSTimeInterval(sender.value)
animator?.animationDuration = TimeInterval(sender.value)
}

@IBAction func delaySliderChanged(sender: UISlider) {
@IBAction func delaySliderChanged(_ sender: UISlider) {
delayLabel.text = String(format: "%.2f", sender.value)
animator?.animationDelay = NSTimeInterval(sender.value)
animator?.animationDelay = TimeInterval(sender.value)
}

@IBAction func springVelocitySliderChanged(sender: UISlider) {
@IBAction func springVelocitySliderChanged(_ sender: UISlider) {
springVelocityLabel.text = String(format: "%.2f", sender.value)
animator?.initialSpringVelocity = CGFloat(sender.value)
}

@IBAction func springDampingSliderChanged(sender: UISlider) {
@IBAction func springDampingSliderChanged(_ sender: UISlider) {
springDampingLabel.text = String(format: "%.2f", sender.value)
animator?.springDamping = CGFloat(sender.value)
}
Expand All @@ -106,18 +106,18 @@ class KGDrawerSettingsTableViewController: UITableViewController {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}

@IBAction func toggleLeftDrawer(sender: AnyObject) {
let appDelegate = UIApplication.sharedApplication().delegate as! AppDelegate
@IBAction func toggleLeftDrawer(_ sender: AnyObject) {
let appDelegate = UIApplication.shared.delegate as! AppDelegate
appDelegate.toggleLeftDrawer(sender, animated: false)
}

@IBAction func toggleRightDrawer(sender: AnyObject) {
let appDelegate = UIApplication.sharedApplication().delegate as! AppDelegate
@IBAction func toggleRightDrawer(_ sender: AnyObject) {
let appDelegate = UIApplication.shared.delegate as! AppDelegate
appDelegate.toggleRightDrawer(sender, animated: true)
}

override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let selectedRowIndex:Int = indexPath.section
if selectedRowIndex == resetRowIndex {
reset()
Expand Down
Loading

0 comments on commit fd74be4

Please sign in to comment.