Skip to content

Commit dd1ac86

Browse files
author
Fabian Muecke
committed
Added macOS support
1 parent bfa908a commit dd1ac86

File tree

9 files changed

+354
-69
lines changed

9 files changed

+354
-69
lines changed

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)