Skip to content

Commit ae692a6

Browse files
author
Ivan Sapozhnik
committed
Swift 3 migration
1 parent d839e95 commit ae692a6

18 files changed

+195
-164
lines changed

Example/LoadingViewController.xcodeproj/project.pbxproj

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,14 +210,16 @@
210210
isa = PBXProject;
211211
attributes = {
212212
LastSwiftUpdateCheck = 0720;
213-
LastUpgradeCheck = 0720;
213+
LastUpgradeCheck = 0830;
214214
ORGANIZATIONNAME = CocoaPods;
215215
TargetAttributes = {
216216
607FACCF1AFB9204008FA782 = {
217217
CreatedOnToolsVersion = 6.3.1;
218+
LastSwiftMigration = 0830;
218219
};
219220
607FACE41AFB9204008FA782 = {
220221
CreatedOnToolsVersion = 6.3.1;
222+
LastSwiftMigration = 0830;
221223
TestTargetID = 607FACCF1AFB9204008FA782;
222224
};
223225
};
@@ -415,8 +417,10 @@
415417
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
416418
CLANG_WARN_EMPTY_BODY = YES;
417419
CLANG_WARN_ENUM_CONVERSION = YES;
420+
CLANG_WARN_INFINITE_RECURSION = YES;
418421
CLANG_WARN_INT_CONVERSION = YES;
419422
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
423+
CLANG_WARN_SUSPICIOUS_MOVE = YES;
420424
CLANG_WARN_UNREACHABLE_CODE = YES;
421425
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
422426
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
@@ -460,8 +464,10 @@
460464
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
461465
CLANG_WARN_EMPTY_BODY = YES;
462466
CLANG_WARN_ENUM_CONVERSION = YES;
467+
CLANG_WARN_INFINITE_RECURSION = YES;
463468
CLANG_WARN_INT_CONVERSION = YES;
464469
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
470+
CLANG_WARN_SUSPICIOUS_MOVE = YES;
465471
CLANG_WARN_UNREACHABLE_CODE = YES;
466472
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
467473
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
@@ -480,6 +486,7 @@
480486
IPHONEOS_DEPLOYMENT_TARGET = 8.3;
481487
MTL_ENABLE_DEBUG_INFO = NO;
482488
SDKROOT = iphoneos;
489+
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
483490
VALIDATE_PRODUCT = YES;
484491
};
485492
name = Release;
@@ -488,25 +495,29 @@
488495
isa = XCBuildConfiguration;
489496
baseConfigurationReference = D673D308FB75CC4E84ACC397 /* Pods-LoadingViewController_Example.debug.xcconfig */;
490497
buildSettings = {
498+
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
491499
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
492500
INFOPLIST_FILE = LoadingViewController/Info.plist;
493501
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
494502
MODULE_NAME = ExampleApp;
495503
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)";
496504
PRODUCT_NAME = "$(TARGET_NAME)";
505+
SWIFT_VERSION = 3.0;
497506
};
498507
name = Debug;
499508
};
500509
607FACF11AFB9204008FA782 /* Release */ = {
501510
isa = XCBuildConfiguration;
502511
baseConfigurationReference = 50444AC1763F6E899C173F80 /* Pods-LoadingViewController_Example.release.xcconfig */;
503512
buildSettings = {
513+
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
504514
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
505515
INFOPLIST_FILE = LoadingViewController/Info.plist;
506516
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
507517
MODULE_NAME = ExampleApp;
508518
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)";
509519
PRODUCT_NAME = "$(TARGET_NAME)";
520+
SWIFT_VERSION = 3.0;
510521
};
511522
name = Release;
512523
};
@@ -526,6 +537,7 @@
526537
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
527538
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.$(PRODUCT_NAME:rfc1034identifier)";
528539
PRODUCT_NAME = "$(TARGET_NAME)";
540+
SWIFT_VERSION = 3.0;
529541
};
530542
name = Debug;
531543
};
@@ -541,6 +553,7 @@
541553
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
542554
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.$(PRODUCT_NAME:rfc1034identifier)";
543555
PRODUCT_NAME = "$(TARGET_NAME)";
556+
SWIFT_VERSION = 3.0;
544557
};
545558
name = Release;
546559
};

Example/LoadingViewController.xcodeproj/xcshareddata/xcschemes/LoadingViewController-Example.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "0720"
3+
LastUpgradeVersion = "0830"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

Example/LoadingViewController/AppDelegate.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,30 +13,30 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
1313

1414
var window: UIWindow?
1515

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

21-
func applicationWillResignActive(application: UIApplication) {
21+
func applicationWillResignActive(_ application: UIApplication) {
2222
// 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.
2323
// 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.
2424
}
2525

26-
func applicationDidEnterBackground(application: UIApplication) {
26+
func applicationDidEnterBackground(_ application: UIApplication) {
2727
// 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.
2828
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
2929
}
3030

31-
func applicationWillEnterForeground(application: UIApplication) {
31+
func applicationWillEnterForeground(_ application: UIApplication) {
3232
// 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.
3333
}
3434

35-
func applicationDidBecomeActive(application: UIApplication) {
35+
func applicationDidBecomeActive(_ application: UIApplication) {
3636
// 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.
3737
}
3838

39-
func applicationWillTerminate(application: UIApplication) {
39+
func applicationWillTerminate(_ application: UIApplication) {
4040
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
4141
}
4242

Example/LoadingViewController/ViewController.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class ViewController: LoadingViewController {
1919
delay(1.0) { [weak self] in
2020
self?.setVisibleScreen(.Loading)
2121
self?.delay(3, closure: { [weak self] in
22-
self?.noDataMessage = "You don't have any search results. Please, refine your search criteria and try again."
22+
self?.NoDataMessage = "You don't have any search results. Please, refine your search criteria and try again."
2323
self?.customErrorTitle = "Hello World!"
2424
self?.errorActionTitle = "Oops!"
2525
self?.setVisibleScreen(.Failure, actionHandler: {
@@ -35,7 +35,7 @@ class ViewController: LoadingViewController {
3535
}
3636

3737
override func loadingViewStyle() -> LoadingViewStyle {
38-
return .Indicator
38+
return .indicator
3939
}
4040
}
4141

Example/Pods/Pods.xcodeproj/project.pbxproj

Lines changed: 22 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Example/Tests/Tests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class Tests: XCTestCase {
2121

2222
func testPerformanceExample() {
2323
// This is an example of a performance test case.
24-
self.measureBlock() {
24+
self.measure() {
2525
// Put the code you want to measure the time of here.
2626
}
2727
}

LoadingViewController.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
Pod::Spec.new do |s|
1010
s.name = 'LoadingViewController'
11-
s.version = '0.2.1'
11+
s.version = '1.0.0'
1212
s.summary = 'LoadingViewController is a component for changing controller views: content -> loading -> content or content -> loading -> error.'
1313

1414
# This description is used to generate tags and improve search results.

LoadingViewController/Classes/Extensions/UIView+Nib.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ extension UIViewLoading where Self : UIView {
1515

1616
static func loadFromNib() -> Self {
1717
let nibName = "\(self)".characters.split{$0 == "."}.map(String.init).last!
18-
let bundle = NSBundle(forClass: self)
18+
let bundle = Bundle(for: self)
1919
let nib = UINib(nibName: nibName, bundle: bundle)
20-
return nib.instantiateWithOwner(self, options: nil).first as! Self
20+
return nib.instantiate(withOwner: self, options: nil).first as! Self
2121
}
2222
}

0 commit comments

Comments
 (0)