Skip to content
This repository was archived by the owner on Jun 17, 2018. It is now read-only.

Commit a93ecc7

Browse files
committed
Convert to Swift 3
1 parent 088e4a2 commit a93ecc7

File tree

9 files changed

+34
-23
lines changed

9 files changed

+34
-23
lines changed

Example/PagingMenuControllerDemo.xcodeproj/project.pbxproj

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@
408408
isa = PBXProject;
409409
attributes = {
410410
LastSwiftUpdateCheck = 0720;
411-
LastUpgradeCheck = 0700;
411+
LastUpgradeCheck = 0800;
412412
ORGANIZATIONNAME = kitasuke;
413413
TargetAttributes = {
414414
707C60DA1AFF822100BDAB0B = {
@@ -753,8 +753,10 @@
753753
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
754754
CLANG_WARN_EMPTY_BODY = YES;
755755
CLANG_WARN_ENUM_CONVERSION = YES;
756+
CLANG_WARN_INFINITE_RECURSION = YES;
756757
CLANG_WARN_INT_CONVERSION = YES;
757758
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
759+
CLANG_WARN_SUSPICIOUS_MOVE = YES;
758760
CLANG_WARN_UNREACHABLE_CODE = YES;
759761
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
760762
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
@@ -798,8 +800,10 @@
798800
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
799801
CLANG_WARN_EMPTY_BODY = YES;
800802
CLANG_WARN_ENUM_CONVERSION = YES;
803+
CLANG_WARN_INFINITE_RECURSION = YES;
801804
CLANG_WARN_INT_CONVERSION = YES;
802805
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
806+
CLANG_WARN_SUSPICIOUS_MOVE = YES;
803807
CLANG_WARN_UNREACHABLE_CODE = YES;
804808
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
805809
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
@@ -818,6 +822,7 @@
818822
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
819823
MTL_ENABLE_DEBUG_INFO = NO;
820824
SDKROOT = iphoneos;
825+
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
821826
VALIDATE_PRODUCT = YES;
822827
};
823828
name = Release;
@@ -826,6 +831,7 @@
826831
isa = XCBuildConfiguration;
827832
baseConfigurationReference = 37DB6C408095AB6AE01575DD /* Pods-PagingMenuControllerDemo.debug.xcconfig */;
828833
buildSettings = {
834+
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
829835
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
830836
INFOPLIST_FILE = PagingMenuControllerDemo/Info.plist;
831837
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
@@ -840,6 +846,7 @@
840846
isa = XCBuildConfiguration;
841847
baseConfigurationReference = 55CF464B33595E0DB123AF77 /* Pods-PagingMenuControllerDemo.release.xcconfig */;
842848
buildSettings = {
849+
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
843850
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
844851
INFOPLIST_FILE = PagingMenuControllerDemo/Info.plist;
845852
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
@@ -854,6 +861,7 @@
854861
isa = XCBuildConfiguration;
855862
baseConfigurationReference = A77A4C2595FFFC7D39FB9291 /* Pods-PagingMenuControllerDemoTests.debug.xcconfig */;
856863
buildSettings = {
864+
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
857865
BUNDLE_LOADER = "$(TEST_HOST)";
858866
FRAMEWORK_SEARCH_PATHS = (
859867
"$(SDKROOT)/Developer/Library/Frameworks",
@@ -876,6 +884,7 @@
876884
isa = XCBuildConfiguration;
877885
baseConfigurationReference = 86E133660B679D5777BC191C /* Pods-PagingMenuControllerDemoTests.release.xcconfig */;
878886
buildSettings = {
887+
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
879888
BUNDLE_LOADER = "$(TEST_HOST)";
880889
FRAMEWORK_SEARCH_PATHS = (
881890
"$(SDKROOT)/Developer/Library/Frameworks",
@@ -894,6 +903,7 @@
894903
isa = XCBuildConfiguration;
895904
baseConfigurationReference = 03C427477DB91E6E85218AD2 /* Pods-PagingMenuControllerDemo2.debug.xcconfig */;
896905
buildSettings = {
906+
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
897907
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
898908
GCC_PREPROCESSOR_DEFINITIONS = (
899909
"DEBUG=1",
@@ -913,6 +923,7 @@
913923
isa = XCBuildConfiguration;
914924
baseConfigurationReference = 376ABED07EA31AA4F8DEAD32 /* Pods-PagingMenuControllerDemo2.release.xcconfig */;
915925
buildSettings = {
926+
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
916927
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
917928
INFOPLIST_FILE = PagingMenuControllerDemo2/Info.plist;
918929
IPHONEOS_DEPLOYMENT_TARGET = 8.0;

Example/PagingMenuControllerDemo/AppDelegate.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
1414
var window: UIWindow?
1515

1616

17-
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
17+
private func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
1818
// Override point for customization after application launch.
1919
return true
2020
}

Example/PagingMenuControllerDemo/GistsViewController.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class GistsViewController: UITableViewController {
1313

1414
class func instantiateFromStoryboard() -> GistsViewController {
1515
let storyboard = UIStoryboard(name: "MenuViewController", bundle: nil)
16-
return storyboard.instantiateViewController(withIdentifier: String(self)) as! GistsViewController
16+
return storyboard.instantiateViewController(withIdentifier: String(describing: self)) as! GistsViewController
1717
}
1818

1919
// MARK: - Lifecycle
@@ -23,7 +23,7 @@ class GistsViewController: UITableViewController {
2323

2424
let url = URL(string: "https://api.github.com/gists/public")
2525
let request = URLRequest(url: url!)
26-
let session = URLSession(configuration: URLSessionConfiguration.default())
26+
let session = URLSession(configuration: URLSessionConfiguration.default)
2727

2828
let task = session.dataTask(with: request) { [weak self] data, response, error in
2929
let result = try? JSONSerialization.jsonObject(with: data!, options: .allowFragments) as! [[String: AnyObject]]

Example/PagingMenuControllerDemo/OrganizationsViewController.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class OrganizationsViewController: UITableViewController {
1313

1414
class func instantiateFromStoryboard() -> OrganizationsViewController {
1515
let storyboard = UIStoryboard(name: "MenuViewController", bundle: nil)
16-
return storyboard.instantiateViewController(withIdentifier: String(self)) as! OrganizationsViewController
16+
return storyboard.instantiateViewController(withIdentifier: String(describing: self)) as! OrganizationsViewController
1717
}
1818

1919
// MARK: - Lifecycle
@@ -23,7 +23,7 @@ class OrganizationsViewController: UITableViewController {
2323

2424
let url = URL(string: "https://api.github.com/organizations")
2525
let request = URLRequest(url: url!)
26-
let session = URLSession(configuration: URLSessionConfiguration.default())
26+
let session = URLSession(configuration: URLSessionConfiguration.default)
2727

2828
let task = session.dataTask(with: request) { [weak self] data, response, error in
2929
let result = try? JSONSerialization.jsonObject(with: data!, options: .allowFragments) as! [[String: AnyObject]]

Example/PagingMenuControllerDemo/PagingMenuControllerOptions.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,28 +45,28 @@ struct PagingMenuOptions1: PagingMenuControllerCustomizable {
4545
struct MenuItemUsers: MenuItemViewCustomizable {
4646
var displayMode: MenuItemDisplayMode {
4747
let title = MenuItemText(text: "Menu")
48-
let description = MenuItemText(text: String(self))
48+
let description = MenuItemText(text: String(describing: self))
4949
return .multilineText(title: title, description: description)
5050
}
5151
}
5252
struct MenuItemRepository: MenuItemViewCustomizable {
5353
var displayMode: MenuItemDisplayMode {
5454
let title = MenuItemText(text: "Menu")
55-
let description = MenuItemText(text: String(self))
55+
let description = MenuItemText(text: String(describing: self))
5656
return .multilineText(title: title, description: description)
5757
}
5858
}
5959
struct MenuItemGists: MenuItemViewCustomizable {
6060
var displayMode: MenuItemDisplayMode {
6161
let title = MenuItemText(text: "Menu")
62-
let description = MenuItemText(text: String(self))
62+
let description = MenuItemText(text: String(describing: self))
6363
return .multilineText(title: title, description: description)
6464
}
6565
}
6666
struct MenuItemOrganization: MenuItemViewCustomizable {
6767
var displayMode: MenuItemDisplayMode {
6868
let title = MenuItemText(text: "Menu")
69-
let description = MenuItemText(text: String(self))
69+
let description = MenuItemText(text: String(describing: self))
7070
return .multilineText(title: title, description: description)
7171
}
7272
}
@@ -118,7 +118,7 @@ struct PagingMenuOptions4: PagingMenuControllerCustomizable {
118118
return .segmentedControl
119119
}
120120
var focusMode: MenuFocusMode {
121-
return .underline(height: 3, color: UIColor.blue(), horizontalPadding: 10, verticalPadding: 0)
121+
return .underline(height: 3, color: UIColor.blue, horizontalPadding: 10, verticalPadding: 0)
122122
}
123123
var itemsOptions: [MenuItemViewCustomizable] {
124124
return [MenuItemUsers(), MenuItemRepository(), MenuItemGists(), MenuItemOrganization()]
@@ -136,7 +136,7 @@ struct PagingMenuOptions5: PagingMenuControllerCustomizable {
136136
return .infinite(widthMode: .flexible, scrollingMode: .pagingEnabled)
137137
}
138138
var focusMode: MenuFocusMode {
139-
return .roundRect(radius: 12, horizontalPadding: 8, verticalPadding: 8, selectedColor: UIColor.lightGray())
139+
return .roundRect(radius: 12, horizontalPadding: 8, verticalPadding: 8, selectedColor: UIColor.lightGray)
140140
}
141141
var itemsOptions: [MenuItemViewCustomizable] {
142142
return [MenuItemUsers(), MenuItemRepository(), MenuItemGists(), MenuItemOrganization()]

Example/PagingMenuControllerDemo/RepositoriesViewController.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class RepositoriesViewController: UITableViewController {
1313

1414
class func instantiateFromStoryboard() -> RepositoriesViewController {
1515
let storyboard = UIStoryboard(name: "MenuViewController", bundle: nil)
16-
return storyboard.instantiateViewController(withIdentifier: String(self)) as! RepositoriesViewController
16+
return storyboard.instantiateViewController(withIdentifier: String(describing: self)) as! RepositoriesViewController
1717
}
1818

1919
// MARK: - Lifecycle
@@ -23,7 +23,7 @@ class RepositoriesViewController: UITableViewController {
2323

2424
let url = URL(string: "https://api.github.com/repositories")
2525
let request = URLRequest(url: url!)
26-
let session = URLSession(configuration: URLSessionConfiguration.default())
26+
let session = URLSession(configuration: URLSessionConfiguration.default)
2727

2828
let task = session.dataTask(with: request) { [weak self] data, response, error in
2929
let result = try? JSONSerialization.jsonObject(with: data!, options: .allowFragments) as! [[String: AnyObject]]

Example/PagingMenuControllerDemo/RootViewController.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,11 @@ class RootViewController: UITableViewController {
6868
// Do any additional setup after loading the view, typically from a nib.
6969
}
7070

71-
override func prepare(for segue: UIStoryboardSegue, sender: AnyObject?) {
71+
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
7272
guard let cell = sender as? UITableViewCell,
7373
let indexPath = tableView.indexPath(for: cell),
7474
let sectionType = Section(indexPath: indexPath),
75-
let viewController = segue.destinationViewController as? PagingMenuViewController else { return }
75+
let viewController = segue.destination as? PagingMenuViewController else { return }
7676

7777
viewController.title = cell.textLabel?.text
7878
viewController.options = sectionType.options

Example/PagingMenuControllerDemo/UsersViewController.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class UsersViewController: UITableViewController {
1313

1414
class func instantiateFromStoryboard() -> UsersViewController {
1515
let storyboard = UIStoryboard(name: "MenuViewController", bundle: nil)
16-
return storyboard.instantiateViewController(withIdentifier: String(self)) as! UsersViewController
16+
return storyboard.instantiateViewController(withIdentifier: String(describing: self)) as! UsersViewController
1717
}
1818

1919
// MARK: - Lifecycle
@@ -23,7 +23,7 @@ class UsersViewController: UITableViewController {
2323

2424
let url = URL(string: "https://api.github.com/users")
2525
let request = URLRequest(url: url!)
26-
let session = URLSession(configuration: URLSessionConfiguration.default())
26+
let session = URLSession(configuration: URLSessionConfiguration.default)
2727

2828
let task = session.dataTask(with: request) { [weak self] data, response, error in
2929
let result = try? JSONSerialization.jsonObject(with: data!, options: .allowFragments) as! [[String: AnyObject]]

Example/PagingMenuControllerDemo2/RootViewControoler.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import PagingMenuController
1111

1212
private struct PagingMenuOptions: PagingMenuControllerCustomizable {
1313
fileprivate var componentType: ComponentType {
14-
return .All(menuOptions: MenuOptions(), pagingControllers: pagingControllers)
14+
return .all(menuOptions: MenuOptions(), pagingControllers: pagingControllers)
1515
}
1616

1717
fileprivate var pagingControllers: [UIViewController] {
@@ -22,7 +22,7 @@ private struct PagingMenuOptions: PagingMenuControllerCustomizable {
2222

2323
fileprivate struct MenuOptions: MenuViewCustomizable {
2424
var displayMode: MenuDisplayMode {
25-
return .SegmentedControl
25+
return .segmentedControl
2626
}
2727
var itemsOptions: [MenuItemViewCustomizable] {
2828
return [MenuItem1(), MenuItem2()]
@@ -31,12 +31,12 @@ private struct PagingMenuOptions: PagingMenuControllerCustomizable {
3131

3232
fileprivate struct MenuItem1: MenuItemViewCustomizable {
3333
var displayMode: MenuItemDisplayMode {
34-
return .Text(title: MenuItemText(text: "First Menu"))
34+
return .text(title: MenuItemText(text: "First Menu"))
3535
}
3636
}
3737
fileprivate struct MenuItem2: MenuItemViewCustomizable {
3838
var displayMode: MenuItemDisplayMode {
39-
return .Text(title: MenuItemText(text: "Second Menu"))
39+
return .text(title: MenuItemText(text: "Second Menu"))
4040
}
4141
}
4242
}
@@ -54,6 +54,6 @@ class RootViewControoler: UIViewController {
5454

5555
addChildViewController(pagingMenuController)
5656
view.addSubview(pagingMenuController.view)
57-
pagingMenuController.didMoveToParentViewController(self)
57+
pagingMenuController.didMove(toParentViewController: self)
5858
}
5959
}

0 commit comments

Comments
 (0)