Skip to content

Commit 532af85

Browse files
authored
Merge pull request #42 from fabianmuecke/master
Added macOS support
2 parents bfa908a + 7163c78 commit 532af85

File tree

10 files changed

+360
-75
lines changed

10 files changed

+360
-75
lines changed

.circleci/config.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
XCODE_TEST_REPORTS: /tmp/xcode-test-results
1010
LANG: en_US.UTF-8
1111
macos:
12-
xcode: '10.2.0'
12+
xcode: '11.4.1'
1313
steps:
1414
- checkout
1515
- run: mkdir -p $CIRCLE_ARTIFACTS $CIRCLE_TEST_REPORTS $XCODE_TEST_REPORTS
@@ -28,17 +28,17 @@ jobs:
2828
- run:
2929
name: Build (Swift 5.0)
3030
command: >
31-
set -o pipefail && xcodebuild build SWIFT_VERSION=5.0
31+
set -o pipefail && xcodebuild build SWIFT_VERSION=5.2.2
3232
-workspace RxWebKit.xcworkspace
3333
-scheme 'RxWebKit' -sdk iphonesimulator
34-
-destination "name=iPhone " | xcpretty -c
34+
-destination "name=iPhone 11" | xcpretty -c
3535
- run:
3636
name: Run Tests (Swift 5.0)
3737
command: >
38-
set -o pipefail && xcodebuild test SWIFT_VERSION=5.0
38+
set -o pipefail && xcodebuild test SWIFT_VERSION=5.2.2
3939
-workspace RxWebKit.xcworkspace
40-
-scheme 'RxWebKitTests' -sdk iphonesimulator
41-
-destination "name=iPhone " | xcpretty -c --test
40+
-scheme 'RxWebKitTests-iOS' -sdk iphonesimulator
41+
-destination "name=iPhone 11" | xcpretty -c --test
4242
- store_artifacts:
4343
path: /tmp/xcode-test-results
4444
workflows:

Cartfile.resolved

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
github "Quick/Nimble" "v8.0.1"
2-
github "Quick/Quick" "v2.1.0"
3-
github "ReactiveX/RxSwift" "5.0.1"
1+
github "Quick/Nimble" "v8.0.7"
2+
github "Quick/Quick" "v2.2.0"
3+
github "ReactiveX/RxSwift" "5.1.1"

RxWebKit.podspec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ Pod::Spec.new do |s|
3737
s.source_files = "RxWebKit/Sources/**/*.{swift}"
3838
s.exclude_files = "RxWebKit/Sources/**/*.{plist}"
3939
s.ios.deployment_target = '8.0'
40+
s.osx.deployment_target = '10.13'
4041
s.swift_version = '5.0'
4142
s.dependency 'RxSwift', '~> 5.0'
4243
s.dependency 'RxCocoa', '~> 5.0'

RxWebKit.xcodeproj/project.pbxproj

Lines changed: 217 additions & 41 deletions
Large diffs are not rendered by default.

RxWebKit.xcodeproj/xcshareddata/xcschemes/RxWebKit.xcscheme

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@
2727
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
2828
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
2929
shouldUseLaunchSchemeArgsEnv = "YES">
30-
<Testables>
31-
</Testables>
3230
<MacroExpansion>
3331
<BuildableReference
3432
BuildableIdentifier = "primary"
@@ -38,8 +36,8 @@
3836
ReferencedContainer = "container:RxWebKit.xcodeproj">
3937
</BuildableReference>
4038
</MacroExpansion>
41-
<AdditionalOptions>
42-
</AdditionalOptions>
39+
<Testables>
40+
</Testables>
4341
</TestAction>
4442
<LaunchAction
4543
buildConfiguration = "Debug"
@@ -60,8 +58,6 @@
6058
ReferencedContainer = "container:RxWebKit.xcodeproj">
6159
</BuildableReference>
6260
</MacroExpansion>
63-
<AdditionalOptions>
64-
</AdditionalOptions>
6561
</LaunchAction>
6662
<ProfileAction
6763
buildConfiguration = "Release"
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Scheme
3+
LastUpgradeVersion = "1140"
4+
version = "1.3">
5+
<BuildAction
6+
parallelizeBuildables = "YES"
7+
buildImplicitDependencies = "YES">
8+
</BuildAction>
9+
<TestAction
10+
buildConfiguration = "Debug"
11+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
12+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
13+
shouldUseLaunchSchemeArgsEnv = "YES">
14+
<Testables>
15+
<TestableReference
16+
skipped = "NO">
17+
<BuildableReference
18+
BuildableIdentifier = "primary"
19+
BlueprintIdentifier = "C4CB7D4222874E5600FB8D99"
20+
BuildableName = "RxWebKitTests-iOS.xctest"
21+
BlueprintName = "RxWebKitTests-iOS"
22+
ReferencedContainer = "container:RxWebKit.xcodeproj">
23+
</BuildableReference>
24+
</TestableReference>
25+
</Testables>
26+
</TestAction>
27+
<LaunchAction
28+
buildConfiguration = "Debug"
29+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
30+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
31+
launchStyle = "0"
32+
useCustomWorkingDirectory = "NO"
33+
ignoresPersistentStateOnLaunch = "NO"
34+
debugDocumentVersioning = "YES"
35+
debugServiceExtension = "internal"
36+
allowLocationSimulation = "YES">
37+
</LaunchAction>
38+
<ProfileAction
39+
buildConfiguration = "Release"
40+
shouldUseLaunchSchemeArgsEnv = "YES"
41+
savedToolIdentifier = ""
42+
useCustomWorkingDirectory = "NO"
43+
debugDocumentVersioning = "YES">
44+
</ProfileAction>
45+
<AnalyzeAction
46+
buildConfiguration = "Debug">
47+
</AnalyzeAction>
48+
<ArchiveAction
49+
buildConfiguration = "Release"
50+
revealArchiveInOrganizer = "YES">
51+
</ArchiveAction>
52+
</Scheme>
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Scheme
3+
LastUpgradeVersion = "1140"
4+
version = "1.3">
5+
<BuildAction
6+
parallelizeBuildables = "YES"
7+
buildImplicitDependencies = "YES">
8+
</BuildAction>
9+
<TestAction
10+
buildConfiguration = "Debug"
11+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
12+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
13+
shouldUseLaunchSchemeArgsEnv = "YES">
14+
<Testables>
15+
<TestableReference
16+
skipped = "NO">
17+
<BuildableReference
18+
BuildableIdentifier = "primary"
19+
BlueprintIdentifier = "EFC27F80246D7E9C0093D8B3"
20+
BuildableName = "RxWebKitTests-macOS.xctest"
21+
BlueprintName = "RxWebKitTests-macOS"
22+
ReferencedContainer = "container:RxWebKit.xcodeproj">
23+
</BuildableReference>
24+
</TestableReference>
25+
</Testables>
26+
</TestAction>
27+
<LaunchAction
28+
buildConfiguration = "Debug"
29+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
30+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
31+
launchStyle = "0"
32+
useCustomWorkingDirectory = "NO"
33+
ignoresPersistentStateOnLaunch = "NO"
34+
debugDocumentVersioning = "YES"
35+
debugServiceExtension = "internal"
36+
allowLocationSimulation = "YES">
37+
</LaunchAction>
38+
<ProfileAction
39+
buildConfiguration = "Release"
40+
shouldUseLaunchSchemeArgsEnv = "YES"
41+
savedToolIdentifier = ""
42+
useCustomWorkingDirectory = "NO"
43+
debugDocumentVersioning = "YES">
44+
</ProfileAction>
45+
<AnalyzeAction
46+
buildConfiguration = "Debug">
47+
</AnalyzeAction>
48+
<ArchiveAction
49+
buildConfiguration = "Release"
50+
revealArchiveInOrganizer = "YES">
51+
</ArchiveAction>
52+
</Scheme>

RxWebKit/RxWebKit.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,15 @@
66
// Copyright © 2016年 RxSwift Community. All rights reserved.
77
//
88

9+
#if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR
910
#import <UIKit/UIKit.h>
10-
11+
#elseif TARGET_OS_MAC
12+
#endif
1113
//! Project version number for RxWebKit.
12-
FOUNDATION_EXPORT double RxWebKitVersionNumber;
14+
extern double RxWebKitVersionNumber;
1315

1416
//! Project version string for RxWebKit.
15-
FOUNDATION_EXPORT const unsigned char RxWebKitVersionString[];
17+
extern const unsigned char RxWebKitVersionString[];
1618

1719
// In this header, you should import all the public headers of your framework using statements like #import <RxWebKit/PublicHeader.h>
1820

RxWebKit/Sources/RxWKUIDelegateEvents+Rx.swift

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ import WebKit
1616
extension Reactive where Base: WKWebView {
1717
public typealias JSAlertEvent = (webView: WKWebView, message: String, frame: WKFrameInfo, handler: () -> ())
1818
public typealias JSConfirmEvent = (webView: WKWebView, message: String, frame: WKFrameInfo, handler: (Bool) -> ())
19-
public typealias CommitPreviewEvent = (webView: WKWebView, controller: UIViewController)
19+
#if os(iOS)
20+
public typealias CommitPreviewEvent = (webView: WKWebView, controller: UIViewController)
21+
#endif
2022

2123
/// Reactive wrapper for `navigationDelegate`.
2224
public var uiDelegate: DelegateProxy<WKWebView, WKUIDelegate> {
@@ -65,24 +67,29 @@ extension Reactive where Base: WKWebView {
6567
return ControlEvent(events: source)
6668
}
6769

68-
/// Reactive wrappper for `func webView(_ webView: WKWebView, commitPreviewingViewController previewingViewController: UIViewController)`
69-
@available(iOS 10.0, *)
70-
public var commitPreviewing: ControlEvent<CommitPreviewEvent> {
71-
let source: Observable<CommitPreviewEvent> = uiDelegate
72-
.methodInvoked(.commitPreviewing)
73-
.map { args in
74-
let view = try castOrThrow(WKWebView.self, args[0])
75-
let controller = try castOrThrow(UIViewController.self, args[1])
76-
return (view, controller)
70+
#if os(iOS)
71+
/// Reactive wrappper for `func webView(_ webView: WKWebView, commitPreviewingViewController previewingViewController: UIViewController)`
72+
@available(iOS 10.0, *)
73+
public var commitPreviewing: ControlEvent<CommitPreviewEvent> {
74+
let source: Observable<CommitPreviewEvent> = uiDelegate
75+
.methodInvoked(.commitPreviewing)
76+
.map { args in
77+
let view = try castOrThrow(WKWebView.self, args[0])
78+
let controller = try castOrThrow(UIViewController.self, args[1])
79+
return (view, controller)
80+
}
81+
82+
return ControlEvent(events: source)
7783
}
78-
79-
return ControlEvent(events: source)
80-
}
84+
#endif
8185
}
8286

8387
fileprivate extension Selector {
8488
static let jsAlert = #selector(WKUIDelegate.webView(_:runJavaScriptAlertPanelWithMessage:initiatedByFrame:completionHandler:))
8589
static let jsConfirm = #selector(WKUIDelegate.webView(_:runJavaScriptConfirmPanelWithMessage:initiatedByFrame:completionHandler:))
86-
@available(iOS 10.0, *)
87-
static let commitPreviewing = #selector(WKUIDelegate.webView(_:commitPreviewingViewController:))
90+
91+
#if os(iOS)
92+
@available(iOS 10.0, *)
93+
static let commitPreviewing = #selector(WKUIDelegate.webView(_:commitPreviewingViewController:))
94+
#endif
8895
}

RxWebKitTests/RxWebKitTests.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import UIKit
21
import WebKit
32
import Quick
43
import Nimble

0 commit comments

Comments
 (0)