Skip to content

Commit 42630c9

Browse files
authored
Merge pull request #118 from devxoul/swift-4.0
Let's Swift 4.0
2 parents cde1481 + 07390d3 commit 42630c9

File tree

7 files changed

+39
-23
lines changed

7 files changed

+39
-23
lines changed

.travis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
os: osx
2-
osx_image: xcode8
2+
osx_image: xcode9
33
sudo: false
44
language: objective-c
55

66
env:
7-
- SDK="iphoneos10.0"
7+
- SDK="iphoneos11.0"
88

99
script:
10-
- xcodebuild clean build -sdk $SDK -configuration Debug CODE_SIGN_IDENTITY=\"\" CODE_SIGNING_REQUIRED=NO
10+
- xcodebuild clean build -sdk $SDK -configuration Debug CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO
1111

1212
before_install:
1313
- xcodebuild -showsdks

Demo/RootViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ final class RootViewController: UIViewController {
6464
appearance.cornerRadius = 20
6565
}
6666

67-
dynamic func showButtonTouchUpInside() {
67+
@objc dynamic func showButtonTouchUpInside() {
6868
Toast(text: "Basic Toast").show()
6969
Toast(text: "You can set duration. `Delay.short` means 2 seconds.\n" +
7070
"`Delay.long` means 3.5 seconds.",

Sources/ToastCenter.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ open class ToastCenter {
6666

6767
// MARK: Notifications
6868

69-
dynamic func deviceOrientationDidChange() {
69+
@objc dynamic func deviceOrientationDidChange() {
7070
if let lastToast = self.queue.operations.first as? Toast {
7171
lastToast.view.setNeedsLayout()
7272
}

Sources/ToastView.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,28 +38,28 @@ open class ToastView: UIView {
3838
}
3939

4040
/// The background view's corner radius.
41-
open dynamic var cornerRadius: CGFloat {
41+
@objc open dynamic var cornerRadius: CGFloat {
4242
get { return self.backgroundView.layer.cornerRadius }
4343
set { self.backgroundView.layer.cornerRadius = newValue }
4444
}
4545

4646
/// The inset of the text label.
47-
open dynamic var textInsets = UIEdgeInsets(top: 6, left: 10, bottom: 6, right: 10)
47+
@objc open dynamic var textInsets = UIEdgeInsets(top: 6, left: 10, bottom: 6, right: 10)
4848

4949
/// The color of the text label's text.
50-
open dynamic var textColor: UIColor? {
50+
@objc open dynamic var textColor: UIColor? {
5151
get { return self.textLabel.textColor }
5252
set { self.textLabel.textColor = newValue }
5353
}
5454

5555
/// The font of the text label.
56-
open dynamic var font: UIFont? {
56+
@objc open dynamic var font: UIFont? {
5757
get { return self.textLabel.font }
5858
set { self.textLabel.font = newValue }
5959
}
6060

6161
/// The bottom offset from the screen's bottom in portrait mode.
62-
open dynamic var bottomOffsetPortrait: CGFloat = {
62+
@objc open dynamic var bottomOffsetPortrait: CGFloat = {
6363
switch UIDevice.current.userInterfaceIdiom {
6464
case .unspecified: return 30
6565
case .phone: return 30
@@ -70,7 +70,7 @@ open class ToastView: UIView {
7070
}()
7171

7272
/// The bottom offset from the screen's bottom in landscape mode.
73-
open dynamic var bottomOffsetLandscape: CGFloat = {
73+
@objc open dynamic var bottomOffsetLandscape: CGFloat = {
7474
switch UIDevice.current.userInterfaceIdiom {
7575
case .unspecified: return 20
7676
case .phone: return 20

Sources/ToastWindow.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,24 +98,24 @@ open class ToastWindow: UIWindow {
9898
}
9999

100100
/// Bring ToastWindow to top when another window is being shown.
101-
func bringWindowToTop(_ notification: Notification) {
101+
@objc func bringWindowToTop(_ notification: Notification) {
102102
if !(notification.object is ToastWindow) {
103103
ToastWindow.shared.isHidden = true
104104
ToastWindow.shared.isHidden = false
105105
}
106106
}
107107

108-
dynamic func statusBarOrientationWillChange() {
108+
@objc dynamic func statusBarOrientationWillChange() {
109109
self.isStatusBarOrientationChanging = true
110110
}
111111

112-
dynamic func statusBarOrientationDidChange() {
112+
@objc dynamic func statusBarOrientationDidChange() {
113113
let orientation = UIApplication.shared.statusBarOrientation
114114
self.handleRotate(orientation)
115115
self.isStatusBarOrientationChanging = false
116116
}
117117

118-
func applicationDidBecomeActive() {
118+
@objc func applicationDidBecomeActive() {
119119
let orientation = UIApplication.shared.statusBarOrientation
120120
self.handleRotate(orientation)
121121
}

Toaster.xcodeproj/project.pbxproj

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -172,16 +172,16 @@
172172
isa = PBXProject;
173173
attributes = {
174174
LastSwiftUpdateCheck = 0700;
175-
LastUpgradeCheck = 0800;
175+
LastUpgradeCheck = 0900;
176176
ORGANIZATIONNAME = "Suyeol Jeon";
177177
TargetAttributes = {
178178
03A75E2A1BCF2066002E46C4 = {
179179
CreatedOnToolsVersion = 7.0.1;
180-
LastSwiftMigration = 0800;
180+
LastSwiftMigration = 0900;
181181
};
182182
03A75E4E1BCF20D4002E46C4 = {
183183
CreatedOnToolsVersion = 7.0.1;
184-
LastSwiftMigration = 0800;
184+
LastSwiftMigration = 0900;
185185
};
186186
};
187187
};
@@ -274,14 +274,20 @@
274274
CLANG_CXX_LIBRARY = "libc++";
275275
CLANG_ENABLE_MODULES = YES;
276276
CLANG_ENABLE_OBJC_ARC = YES;
277+
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
277278
CLANG_WARN_BOOL_CONVERSION = YES;
279+
CLANG_WARN_COMMA = YES;
278280
CLANG_WARN_CONSTANT_CONVERSION = YES;
279281
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
280282
CLANG_WARN_EMPTY_BODY = YES;
281283
CLANG_WARN_ENUM_CONVERSION = YES;
282284
CLANG_WARN_INFINITE_RECURSION = YES;
283285
CLANG_WARN_INT_CONVERSION = YES;
286+
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
287+
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
284288
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
289+
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
290+
CLANG_WARN_STRICT_PROTOTYPES = YES;
285291
CLANG_WARN_SUSPICIOUS_MOVE = YES;
286292
CLANG_WARN_UNREACHABLE_CODE = YES;
287293
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
@@ -324,14 +330,20 @@
324330
CLANG_CXX_LIBRARY = "libc++";
325331
CLANG_ENABLE_MODULES = YES;
326332
CLANG_ENABLE_OBJC_ARC = YES;
333+
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
327334
CLANG_WARN_BOOL_CONVERSION = YES;
335+
CLANG_WARN_COMMA = YES;
328336
CLANG_WARN_CONSTANT_CONVERSION = YES;
329337
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
330338
CLANG_WARN_EMPTY_BODY = YES;
331339
CLANG_WARN_ENUM_CONVERSION = YES;
332340
CLANG_WARN_INFINITE_RECURSION = YES;
333341
CLANG_WARN_INT_CONVERSION = YES;
342+
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
343+
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
334344
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
345+
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
346+
CLANG_WARN_STRICT_PROTOTYPES = YES;
335347
CLANG_WARN_SUSPICIOUS_MOVE = YES;
336348
CLANG_WARN_UNREACHABLE_CODE = YES;
337349
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
@@ -363,6 +375,7 @@
363375
isa = XCBuildConfiguration;
364376
buildSettings = {
365377
CLANG_ENABLE_MODULES = YES;
378+
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
366379
DEFINES_MODULE = YES;
367380
DYLIB_COMPATIBILITY_VERSION = 1;
368381
DYLIB_CURRENT_VERSION = 1;
@@ -375,14 +388,15 @@
375388
PRODUCT_NAME = "$(TARGET_NAME)";
376389
SKIP_INSTALL = YES;
377390
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
378-
SWIFT_VERSION = 3.0;
391+
SWIFT_VERSION = 4.0;
379392
};
380393
name = Debug;
381394
};
382395
03A75E411BCF2066002E46C4 /* Release */ = {
383396
isa = XCBuildConfiguration;
384397
buildSettings = {
385398
CLANG_ENABLE_MODULES = YES;
399+
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
386400
DEFINES_MODULE = YES;
387401
DYLIB_COMPATIBILITY_VERSION = 1;
388402
DYLIB_CURRENT_VERSION = 1;
@@ -395,7 +409,7 @@
395409
PRODUCT_NAME = "$(TARGET_NAME)";
396410
SKIP_INSTALL = YES;
397411
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
398-
SWIFT_VERSION = 3.0;
412+
SWIFT_VERSION = 4.0;
399413
};
400414
name = Release;
401415
};
@@ -408,7 +422,7 @@
408422
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
409423
PRODUCT_BUNDLE_IDENTIFIER = kr.xoul.ToasterDemo;
410424
PRODUCT_NAME = "$(TARGET_NAME)";
411-
SWIFT_VERSION = 3.0;
425+
SWIFT_VERSION = 4.0;
412426
};
413427
name = Debug;
414428
};
@@ -422,7 +436,7 @@
422436
PRODUCT_BUNDLE_IDENTIFIER = kr.xoul.ToasterDemo;
423437
PRODUCT_NAME = "$(TARGET_NAME)";
424438
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
425-
SWIFT_VERSION = 3.0;
439+
SWIFT_VERSION = 4.0;
426440
};
427441
name = Release;
428442
};

Toaster.xcodeproj/xcshareddata/xcschemes/Toaster.xcscheme

Lines changed: 3 additions & 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 = "0800"
3+
LastUpgradeVersion = "0900"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"
@@ -26,6 +26,7 @@
2626
buildConfiguration = "Debug"
2727
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
2828
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29+
language = ""
2930
shouldUseLaunchSchemeArgsEnv = "YES">
3031
<Testables>
3132
</Testables>
@@ -36,6 +37,7 @@
3637
buildConfiguration = "Debug"
3738
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
3839
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
40+
language = ""
3941
launchStyle = "0"
4042
useCustomWorkingDirectory = "NO"
4143
ignoresPersistentStateOnLaunch = "NO"

0 commit comments

Comments
 (0)