Skip to content

Commit 2fe0932

Browse files
committed
Update to swift 4
1 parent ff423bc commit 2fe0932

File tree

13 files changed

+126
-67
lines changed

13 files changed

+126
-67
lines changed

.swift-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.0
1+
4.0

.travis.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
language: objective-c
2+
osx_image: xcode9
3+
env:
4+
global:
5+
- LC_CTYPE=en_US.UTF-8
6+
- LANG=en_US.UTF-8
7+
- PROJECT=CallbackURLKit.xcodeproj
8+
- IOS_FRAMEWORK_SCHEME="CallbackURLKit"
9+
- MACOS_FRAMEWORK_SCHEME="CallbackURLKitOSX"
10+
- IOS_SDK=iphonesimulator11.0
11+
- MACOS_SDK=macosx10.13
12+
matrix:
13+
- DESTINATION="OS=11.0,name=iPhone 8" SCHEME="$IOS_FRAMEWORK_SCHEME" SDK="$IOS_SDK" RUN_TESTS="YES"
14+
- DESTINATION="arch=x86_64" SCHEME="$MACOS_FRAMEWORK_SCHEME" SDK=macosx10.13 RUN_TESTS="NO"
15+
before_install:
16+
- gem install xcpretty --no-rdoc --no-ri --no-document --quiet
17+
script:
18+
- set -o pipefail
19+
- xcodebuild -version
20+
- xcodebuild -showsdks
21+
22+
- if [ $RUN_TESTS == "YES" ]; then
23+
xcodebuild -project "$PROJECT" -scheme "$SCHEME" -sdk "$SDK" -destination "$DESTINATION" -configuration Release ONLY_ACTIVE_ARCH=NO ENABLE_TESTABILITY=YES test | xcpretty;
24+
else
25+
xcodebuild -project "$PROJECT" -scheme "$SCHEME" -sdk "$SDK" -destination "$DESTINATION" -configuration Release ONLY_ACTIVE_ARCH=NO build | xcpretty;
26+
fi
27+
after_success:
28+
- bash <(curl -s https://codecov.io/bash)
29+
30+
branches:
31+
only:
32+
- master

CallbackURLKit.podspec

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Pod::Spec.new do |s|
22

33
# ――― Spec Metadata ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
44
s.name = "CallbackURLKit"
5-
s.version = "1.0.1"
5+
s.version = "1.2.0"
66
s.summary = "Implemenation of x-callback-url in swift"
77
s.homepage = "https://github.com/phimage/CallbackURLKit"
88

@@ -13,8 +13,8 @@ Pod::Spec.new do |s|
1313
s.author = { "phimage" => "[email protected]" }
1414

1515
# ――― Platform Specifics ――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
16-
s.ios.deployment_target = '8.0'
17-
s.osx.deployment_target = '10.9'
16+
s.ios.deployment_target = '9.0'
17+
s.osx.deployment_target = '10.11'
1818
s.tvos.deployment_target = '9.0'
1919

2020
# ――― Source Location ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #

CallbackURLKit.xcodeproj/project.pbxproj

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -230,15 +230,15 @@
230230
C4A8D5071C37D84A00DB3306 /* Project object */ = {
231231
isa = PBXProject;
232232
attributes = {
233-
LastUpgradeCheck = 0800;
233+
LastUpgradeCheck = 0900;
234234
ORGANIZATIONNAME = phimage;
235235
TargetAttributes = {
236236
C418B1D91C386C160097FDD9 = {
237237
CreatedOnToolsVersion = 7.2;
238238
};
239239
C4A8D50F1C37D84A00DB3306 = {
240240
CreatedOnToolsVersion = 7.2;
241-
LastSwiftMigration = 0800;
241+
LastSwiftMigration = 0900;
242242
};
243243
C4E32D551C398AE1005CD033 = {
244244
CreatedOnToolsVersion = 7.2;
@@ -343,7 +343,8 @@
343343
PRODUCT_NAME = CallbackURLKit;
344344
SDKROOT = macosx;
345345
SKIP_INSTALL = YES;
346-
SWIFT_VERSION = 3.0;
346+
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
347+
SWIFT_VERSION = 4.0;
347348
};
348349
name = Debug;
349350
};
@@ -365,7 +366,8 @@
365366
PRODUCT_NAME = CallbackURLKit;
366367
SDKROOT = macosx;
367368
SKIP_INSTALL = YES;
368-
SWIFT_VERSION = 3.0;
369+
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
370+
SWIFT_VERSION = 4.0;
369371
};
370372
name = Release;
371373
};
@@ -377,14 +379,20 @@
377379
CLANG_CXX_LIBRARY = "libc++";
378380
CLANG_ENABLE_MODULES = YES;
379381
CLANG_ENABLE_OBJC_ARC = YES;
382+
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
380383
CLANG_WARN_BOOL_CONVERSION = YES;
384+
CLANG_WARN_COMMA = YES;
381385
CLANG_WARN_CONSTANT_CONVERSION = YES;
382386
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
383387
CLANG_WARN_EMPTY_BODY = YES;
384388
CLANG_WARN_ENUM_CONVERSION = YES;
385389
CLANG_WARN_INFINITE_RECURSION = YES;
386390
CLANG_WARN_INT_CONVERSION = YES;
391+
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
392+
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
387393
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
394+
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
395+
CLANG_WARN_STRICT_PROTOTYPES = YES;
388396
CLANG_WARN_SUSPICIOUS_MOVE = YES;
389397
CLANG_WARN_UNREACHABLE_CODE = YES;
390398
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
@@ -427,14 +435,20 @@
427435
CLANG_CXX_LIBRARY = "libc++";
428436
CLANG_ENABLE_MODULES = YES;
429437
CLANG_ENABLE_OBJC_ARC = YES;
438+
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
430439
CLANG_WARN_BOOL_CONVERSION = YES;
440+
CLANG_WARN_COMMA = YES;
431441
CLANG_WARN_CONSTANT_CONVERSION = YES;
432442
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
433443
CLANG_WARN_EMPTY_BODY = YES;
434444
CLANG_WARN_ENUM_CONVERSION = YES;
435445
CLANG_WARN_INFINITE_RECURSION = YES;
436446
CLANG_WARN_INT_CONVERSION = YES;
447+
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
448+
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
437449
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
450+
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
451+
CLANG_WARN_STRICT_PROTOTYPES = YES;
438452
CLANG_WARN_SUSPICIOUS_MOVE = YES;
439453
CLANG_WARN_UNREACHABLE_CODE = YES;
440454
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
@@ -480,7 +494,8 @@
480494
PRODUCT_NAME = "$(TARGET_NAME)";
481495
SKIP_INSTALL = YES;
482496
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
483-
SWIFT_VERSION = 3.0;
497+
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
498+
SWIFT_VERSION = 4.0;
484499
};
485500
name = Debug;
486501
};
@@ -500,7 +515,8 @@
500515
PRODUCT_BUNDLE_IDENTIFIER = fr.phimage.CallbackURLKit;
501516
PRODUCT_NAME = "$(TARGET_NAME)";
502517
SKIP_INSTALL = YES;
503-
SWIFT_VERSION = 3.0;
518+
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
519+
SWIFT_VERSION = 4.0;
504520
};
505521
name = Release;
506522
};
@@ -519,7 +535,8 @@
519535
PRODUCT_BUNDLE_IDENTIFIER = fr.phimage.CallbackURLKitClients;
520536
PRODUCT_NAME = "$(TARGET_NAME)";
521537
SKIP_INSTALL = YES;
522-
SWIFT_VERSION = 3.0;
538+
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
539+
SWIFT_VERSION = 4.0;
523540
};
524541
name = Debug;
525542
};
@@ -538,7 +555,8 @@
538555
PRODUCT_BUNDLE_IDENTIFIER = fr.phimage.CallbackURLKitClients;
539556
PRODUCT_NAME = "$(TARGET_NAME)";
540557
SKIP_INSTALL = YES;
541-
SWIFT_VERSION = 3.0;
558+
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
559+
SWIFT_VERSION = 4.0;
542560
};
543561
name = Release;
544562
};

CallbackURLKit.xcodeproj/xcshareddata/xcschemes/CallbackURLKit.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"

CallbackURLKit.xcodeproj/xcshareddata/xcschemes/CallbackURLKitOSX.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"

Clients/GoogleChrome.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// CallbackURLKit
44
/*
55
The MIT License (MIT)
6-
Copyright (c) 2016 Eric Marchand (phimage)
6+
Copyright (c) 2017 Eric Marchand (phimage)
77
Permission is hereby granted, free of charge, to any person obtaining a copy
88
of this software and associated documentation files (the "Software"), to deal
99
in the Software without restriction, including without limitation the rights
@@ -29,7 +29,7 @@
2929
https://developer.chrome.com/multidevice/ios/links
3030
*/
3131
public class GoogleChrome: Client {
32-
32+
3333
#if os(macOS)
3434
public static let DownloadURL = URL(string: "https://www.google.com/chrome/browser/desktop/index.html")
3535
#else
@@ -39,16 +39,16 @@ public class GoogleChrome: Client {
3939
public init() {
4040
super.init(urlScheme: "googlechrome-x-callback")
4141
}
42-
42+
4343
/*
4444
If chrome not installed open itunes.
4545
*/
4646
public func checkInstalled() {
4747
if !self.appInstalled, let url = GoogleChrome.DownloadURL {
48-
Manager.open(url: url)
48+
Manager.shared.open(url: url)
4949
}
5050
}
51-
51+
5252
public func open(url: String, newTab: Bool = false,
5353
onSuccess: SuccessCallback? = nil, onFailure: FailureCallback? = nil, onCancel: CancelCallback? = nil) throws {
5454
var parameters = ["url": url]

README.md

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ try Manager.shared.perform(action: "actionName", urlScheme: "application-name",
4040
```
4141

4242
#### Declare targeted applications URL schemes in iOS9
43-
In iOS 9 you must whitelist any URL schemes your app wants to query in Info.plist under the *LSApplicationQueriesSchemes* key (an array of strings)
43+
You must whitelist any URL schemes your app wants to query in Info.plist under the *LSApplicationQueriesSchemes* key (an array of strings)
4444

4545
![xcode-white-list](http://useyourloaf.com/assets/images/2015/2015-09-06-001.png)
4646

@@ -109,12 +109,6 @@ And finally to handle incoming URLs, your application delegate should implement
109109

110110
On iOS
111111
```swift
112-
func application(_ application: UIApplication, open url: NSURL, sourceApplication: String?, annotation: Any) -> Bool {
113-
manager.handleOpen(url: url)
114-
return true
115-
}
116-
117-
@available(iOS 9.0, *)
118112
func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool {
119113
manager.handleOpen(url: url)
120114
return true

Sources/CallbackURLKit.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// CallbackURLKit
44
/*
55
The MIT License (MIT)
6-
Copyright (c) 2016 Eric Marchand (phimage)
6+
Copyright (c) 2017 Eric Marchand (phimage)
77
Permission is hereby granted, free of charge, to any person obtaining a copy
88
of this software and associated documentation files (the "Software"), to deal
99
in the Software without restriction, including without limitation the rights
@@ -23,7 +23,6 @@ SOFTWARE.
2323

2424
import Foundation
2525

26-
2726
// action ie. url path
2827
public typealias Action = String
2928
// block which handle action and optionally respond to callback

Sources/Client.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// CallbackURLKit
44
/*
55
The MIT License (MIT)
6-
Copyright (c) 2016 Eric Marchand (phimage)
6+
Copyright (c) 2017 Eric Marchand (phimage)
77
Permission is hereby granted, free of charge, to any person obtaining a copy
88
of this software and associated documentation files (the "Software"), to deal
99
in the Software without restriction, including without limitation the rights
@@ -43,8 +43,9 @@ open class Client {
4343
}
4444
#if os(iOS) || os(tvOS)
4545
return UIApplication.shared.canOpenURL(url)
46+
4647
#elseif os(OSX)
47-
return NSWorkspace.shared().urlForApplication(toOpen: url) != nil
48+
return NSWorkspace.shared.urlForApplication(toOpen: url) != nil
4849
#endif
4950
}
5051

0 commit comments

Comments
 (0)