Skip to content

Commit f85bc14

Browse files
authored
Merge pull request #38 from CardinalNow/Swift_3_0
Swift 3 0
2 parents 51cbf21 + 37bf597 commit f85bc14

File tree

7 files changed

+184
-54
lines changed

7 files changed

+184
-54
lines changed

CircleProgressView.xcodeproj/project.pbxproj

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@
166166
attributes = {
167167
LastSwiftMigration = 0700;
168168
LastSwiftUpdateCheck = 0700;
169-
LastUpgradeCheck = 0700;
169+
LastUpgradeCheck = 0800;
170170
ORGANIZATIONNAME = "Eric Rolf";
171171
TargetAttributes = {
172172
CB095FC2199A8F44009C1C26 = {
@@ -282,6 +282,7 @@
282282
ENABLE_TESTABILITY = YES;
283283
GCC_C_LANGUAGE_STANDARD = gnu99;
284284
GCC_DYNAMIC_NO_PIC = NO;
285+
GCC_NO_COMMON_BLOCKS = YES;
285286
GCC_OPTIMIZATION_LEVEL = 0;
286287
GCC_PREPROCESSOR_DEFINITIONS = (
287288
"DEBUG=1",
@@ -294,7 +295,7 @@
294295
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
295296
GCC_WARN_UNUSED_FUNCTION = YES;
296297
GCC_WARN_UNUSED_VARIABLE = YES;
297-
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
298+
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
298299
MTL_ENABLE_DEBUG_INFO = YES;
299300
ONLY_ACTIVE_ARCH = YES;
300301
SDKROOT = iphoneos;
@@ -325,13 +326,14 @@
325326
ENABLE_NS_ASSERTIONS = NO;
326327
ENABLE_STRICT_OBJC_MSGSEND = YES;
327328
GCC_C_LANGUAGE_STANDARD = gnu99;
329+
GCC_NO_COMMON_BLOCKS = YES;
328330
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
329331
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
330332
GCC_WARN_UNDECLARED_SELECTOR = YES;
331333
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
332334
GCC_WARN_UNUSED_FUNCTION = YES;
333335
GCC_WARN_UNUSED_VARIABLE = YES;
334-
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
336+
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
335337
MTL_ENABLE_DEBUG_INFO = NO;
336338
SDKROOT = iphoneos;
337339
TARGETED_DEVICE_FAMILY = "1,2";
@@ -345,13 +347,14 @@
345347
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
346348
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
347349
CLANG_ENABLE_MODULES = YES;
350+
DEVELOPMENT_TEAM = "";
348351
INFOPLIST_FILE = CircleProgressView/Info.plist;
349352
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
350353
PRODUCT_BUNDLE_IDENTIFIER = "com.csg.$(PRODUCT_NAME:rfc1034identifier)";
351354
PRODUCT_NAME = "$(TARGET_NAME)";
352355
SWIFT_OBJC_BRIDGING_HEADER = "";
353356
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
354-
SWIFT_VERSION = 2.3;
357+
SWIFT_VERSION = 3.0;
355358
};
356359
name = Debug;
357360
};
@@ -361,12 +364,14 @@
361364
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
362365
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
363366
CLANG_ENABLE_MODULES = YES;
367+
DEVELOPMENT_TEAM = "";
364368
INFOPLIST_FILE = CircleProgressView/Info.plist;
365369
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
366370
PRODUCT_BUNDLE_IDENTIFIER = "com.csg.$(PRODUCT_NAME:rfc1034identifier)";
367371
PRODUCT_NAME = "$(TARGET_NAME)";
368372
SWIFT_OBJC_BRIDGING_HEADER = "";
369-
SWIFT_VERSION = 2.3;
373+
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
374+
SWIFT_VERSION = 3.0;
370375
};
371376
name = Release;
372377
};
@@ -386,7 +391,7 @@
386391
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
387392
PRODUCT_BUNDLE_IDENTIFIER = "com.csg.$(PRODUCT_NAME:rfc1034identifier)";
388393
PRODUCT_NAME = "$(TARGET_NAME)";
389-
SWIFT_VERSION = 2.3;
394+
SWIFT_VERSION = 3.0;
390395
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/CircleProgressView.app/CircleProgressView";
391396
};
392397
name = Debug;
@@ -403,7 +408,8 @@
403408
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
404409
PRODUCT_BUNDLE_IDENTIFIER = "com.csg.$(PRODUCT_NAME:rfc1034identifier)";
405410
PRODUCT_NAME = "$(TARGET_NAME)";
406-
SWIFT_VERSION = 2.3;
411+
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
412+
SWIFT_VERSION = 3.0;
407413
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/CircleProgressView.app/CircleProgressView";
408414
};
409415
name = Release;
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Scheme
3+
LastUpgradeVersion = "0800"
4+
version = "1.3">
5+
<BuildAction
6+
parallelizeBuildables = "YES"
7+
buildImplicitDependencies = "YES">
8+
<BuildActionEntries>
9+
<BuildActionEntry
10+
buildForTesting = "YES"
11+
buildForRunning = "YES"
12+
buildForProfiling = "YES"
13+
buildForArchiving = "YES"
14+
buildForAnalyzing = "YES">
15+
<BuildableReference
16+
BuildableIdentifier = "primary"
17+
BlueprintIdentifier = "CB095FC2199A8F44009C1C26"
18+
BuildableName = "CircleProgressView.app"
19+
BlueprintName = "CircleProgressView"
20+
ReferencedContainer = "container:CircleProgressView.xcodeproj">
21+
</BuildableReference>
22+
</BuildActionEntry>
23+
</BuildActionEntries>
24+
</BuildAction>
25+
<TestAction
26+
buildConfiguration = "Debug"
27+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
28+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29+
shouldUseLaunchSchemeArgsEnv = "YES">
30+
<Testables>
31+
<TestableReference
32+
skipped = "NO">
33+
<BuildableReference
34+
BuildableIdentifier = "primary"
35+
BlueprintIdentifier = "CB095FD4199A8F44009C1C26"
36+
BuildableName = "CircleProgressViewTests.xctest"
37+
BlueprintName = "CircleProgressViewTests"
38+
ReferencedContainer = "container:CircleProgressView.xcodeproj">
39+
</BuildableReference>
40+
</TestableReference>
41+
</Testables>
42+
<MacroExpansion>
43+
<BuildableReference
44+
BuildableIdentifier = "primary"
45+
BlueprintIdentifier = "CB095FC2199A8F44009C1C26"
46+
BuildableName = "CircleProgressView.app"
47+
BlueprintName = "CircleProgressView"
48+
ReferencedContainer = "container:CircleProgressView.xcodeproj">
49+
</BuildableReference>
50+
</MacroExpansion>
51+
<AdditionalOptions>
52+
</AdditionalOptions>
53+
</TestAction>
54+
<LaunchAction
55+
buildConfiguration = "Debug"
56+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
57+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
58+
launchStyle = "0"
59+
useCustomWorkingDirectory = "NO"
60+
ignoresPersistentStateOnLaunch = "NO"
61+
debugDocumentVersioning = "YES"
62+
debugServiceExtension = "internal"
63+
allowLocationSimulation = "YES">
64+
<BuildableProductRunnable
65+
runnableDebuggingMode = "0">
66+
<BuildableReference
67+
BuildableIdentifier = "primary"
68+
BlueprintIdentifier = "CB095FC2199A8F44009C1C26"
69+
BuildableName = "CircleProgressView.app"
70+
BlueprintName = "CircleProgressView"
71+
ReferencedContainer = "container:CircleProgressView.xcodeproj">
72+
</BuildableReference>
73+
</BuildableProductRunnable>
74+
<AdditionalOptions>
75+
</AdditionalOptions>
76+
</LaunchAction>
77+
<ProfileAction
78+
buildConfiguration = "Release"
79+
shouldUseLaunchSchemeArgsEnv = "YES"
80+
savedToolIdentifier = ""
81+
useCustomWorkingDirectory = "NO"
82+
debugDocumentVersioning = "YES">
83+
<BuildableProductRunnable
84+
runnableDebuggingMode = "0">
85+
<BuildableReference
86+
BuildableIdentifier = "primary"
87+
BlueprintIdentifier = "CB095FC2199A8F44009C1C26"
88+
BuildableName = "CircleProgressView.app"
89+
BlueprintName = "CircleProgressView"
90+
ReferencedContainer = "container:CircleProgressView.xcodeproj">
91+
</BuildableReference>
92+
</BuildableProductRunnable>
93+
</ProfileAction>
94+
<AnalyzeAction
95+
buildConfiguration = "Debug">
96+
</AnalyzeAction>
97+
<ArchiveAction
98+
buildConfiguration = "Release"
99+
revealArchiveInOrganizer = "YES">
100+
</ArchiveAction>
101+
</Scheme>
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>SchemeUserState</key>
6+
<dict>
7+
<key>CircleProgressView.xcscheme</key>
8+
<dict>
9+
<key>orderHint</key>
10+
<integer>0</integer>
11+
</dict>
12+
</dict>
13+
<key>SuppressBuildableAutocreation</key>
14+
<dict>
15+
<key>CB095FC2199A8F44009C1C26</key>
16+
<dict>
17+
<key>primary</key>
18+
<true/>
19+
</dict>
20+
<key>CB095FD4199A8F44009C1C26</key>
21+
<dict>
22+
<key>primary</key>
23+
<true/>
24+
</dict>
25+
</dict>
26+
</dict>
27+
</plist>

CircleProgressView/AppDelegate.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,31 +13,31 @@ 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: [NSObject : AnyObject]?) -> Bool {
1717

1818
// Override point for customization after application launch.
1919
return true
2020
}
2121

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

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

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

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

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

CircleProgressView/ViewController.swift

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,17 @@ class ViewController: UIViewController {
1515
@IBOutlet weak var progressSlider: UISlider!
1616
@IBOutlet weak var clockwiseSwitch: UISwitch!
1717

18-
let nf = NSNumberFormatter()
18+
let nf = NumberFormatter()
1919

2020
override func viewDidLoad() {
2121
super.viewDidLoad()
2222

23-
nf.numberStyle = NSNumberFormatterStyle.DecimalStyle
23+
nf.numberStyle = NumberFormatter.Style.decimal
2424
nf.maximumFractionDigits = 2
2525

2626
self.clockwiseSwitch.setOn(self.circleProgressView.clockwise, animated: false)
2727
self.progressSlider.value = Float(self.circleProgressView.progress)
28-
self.progressLabel.text = "Progress: " + nf.stringFromNumber(NSNumber(double: self.circleProgressView.progress))!
28+
self.progressLabel.text = "Progress: " + nf.string(from: NSNumber(value: self.circleProgressView.progress))!
2929
}
3030

3131
override func didReceiveMemoryWarning() {
@@ -34,26 +34,22 @@ class ViewController: UIViewController {
3434

3535
// MARK: - IBActions
3636

37-
@IBAction func sliderDidChangeValue(sender: AnyObject) {
37+
@IBAction func sliderDidChangeValue(_ sender: AnyObject) {
3838
let slider:UISlider = sender as! UISlider
3939
self.circleProgressView.progress = Double(slider.value)
40-
self.progressLabel.text = "Progress: " + nf.stringFromNumber(NSNumber(double: self.circleProgressView.progress))!
40+
self.progressLabel.text = "Progress: " + nf.string(from: NSNumber(value: self.circleProgressView.progress))!
4141
}
4242

43-
@IBAction func switchDidChangeValue(sender: AnyObject) {
43+
@IBAction func switchDidChangeValue(_ sender: AnyObject) {
4444
let mySwitch:UISwitch = sender as! UISwitch
45-
self.circleProgressView.clockwise = mySwitch.on
45+
self.circleProgressView.clockwise = mySwitch.isOn
4646
self.circleProgressView.progress = self.circleProgressView.progress
4747
}
4848

4949
// MARK: - Helpers
50-
func delay(delay:Double, closure:()->()) {
51-
dispatch_after(
52-
dispatch_time(
53-
DISPATCH_TIME_NOW,
54-
Int64(delay * Double(NSEC_PER_SEC))
55-
),
56-
dispatch_get_main_queue(), closure)
50+
func delay(_ delay:Double, closure: @escaping ()-> Void) {
51+
let delayTime = DispatchTime.now() + delay
52+
DispatchQueue.main.asyncAfter(deadline: delayTime, execute: closure)
5753
}
5854

5955
}

CircleProgressViewTests/CircleProgressViewTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class CircleProgressViewTests: XCTestCase {
2828

2929
func testPerformanceExample() {
3030
// This is an example of a performance test case.
31-
self.measureBlock() {
31+
self.measure() {
3232
// Put the code you want to measure the time of here.
3333
}
3434
}

0 commit comments

Comments
 (0)