Skip to content

Commit

Permalink
VisionOS Support (#2564)
Browse files Browse the repository at this point in the history
* Enable many things for visionOS

* Remove outdated symlink
  • Loading branch information
nighthawk committed Apr 11, 2024
1 parent 92c4754 commit cf08cdc
Show file tree
Hide file tree
Showing 48 changed files with 66 additions and 61 deletions.
2 changes: 1 addition & 1 deletion Platform/Platform.Darwin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
//

#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) || os(visionOS)

import Darwin
import Foundation
Expand Down
10 changes: 5 additions & 5 deletions RxCocoa/Common/ControlTarget.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
//

#if os(iOS) || os(tvOS) || os(macOS)
#if os(iOS) || os(tvOS) || os(visionOS) || os(macOS)

import RxSwift

#if os(iOS) || os(tvOS)
#if os(iOS) || os(tvOS) || os(visionOS)
import UIKit

typealias Control = UIKit.UIControl
Expand All @@ -27,11 +27,11 @@ final class ControlTarget: RxTarget {
let selector: Selector = #selector(ControlTarget.eventHandler(_:))

weak var control: Control?
#if os(iOS) || os(tvOS)
#if os(iOS) || os(tvOS) || os(visionOS)
let controlEvents: UIControl.Event
#endif
var callback: Callback?
#if os(iOS) || os(tvOS)
#if os(iOS) || os(tvOS) || os(visionOS)
init(control: Control, controlEvents: UIControl.Event, callback: @escaping Callback) {
MainScheduler.ensureRunningOnMainThread()

Expand Down Expand Up @@ -75,7 +75,7 @@ final class ControlTarget: RxTarget {

override func dispose() {
super.dispose()
#if os(iOS) || os(tvOS)
#if os(iOS) || os(tvOS) || os(visionOS)
self.control?.removeTarget(self, action: self.selector, for: self.controlEvents)
#elseif os(macOS)
self.control?.target = nil
Expand Down
2 changes: 1 addition & 1 deletion RxCocoa/Common/DelegateProxyType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ extension DelegateProxyType where ParentObject: HasPrefetchDataSource, Self.Dele
}
}

#if os(iOS) || os(tvOS)
#if os(iOS) || os(tvOS) || os(visionOS)
import UIKit

extension ObservableType {
Expand Down
2 changes: 1 addition & 1 deletion RxCocoa/Common/TextInput.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import RxSwift

#if os(iOS) || os(tvOS)
#if os(iOS) || os(tvOS) || os(visionOS)
import UIKit

/// Represents text input with reactive extensions.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
//

#if os(iOS) || os(tvOS)
#if os(iOS) || os(tvOS) || os(visionOS)

import UIKit
import RxSwift
Expand Down
2 changes: 1 addition & 1 deletion RxCocoa/iOS/DataSources/RxPickerViewAdapter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Copyright © 2017 Krunoslav Zaher. All rights reserved.
//

#if os(iOS)
#if os(iOS) || os(visionOS)

import UIKit
import RxSwift
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
//

#if os(iOS) || os(tvOS)
#if os(iOS) || os(tvOS) || os(visionOS)

import UIKit
import RxSwift
Expand Down
2 changes: 1 addition & 1 deletion RxCocoa/iOS/Events/ItemEvents.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
//

#if os(iOS) || os(tvOS)
#if os(iOS) || os(tvOS) || os(visionOS)
import UIKit

public typealias ItemMovedEvent = (sourceIndex: IndexPath, destinationIndex: IndexPath)
Expand Down
2 changes: 1 addition & 1 deletion RxCocoa/iOS/NSTextStorage+Rx.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
//

#if os(iOS) || os(tvOS)
#if os(iOS) || os(tvOS) || os(visionOS)
import RxSwift
import UIKit

Expand Down
2 changes: 1 addition & 1 deletion RxCocoa/iOS/Protocols/RxCollectionViewDataSourceType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
//

#if os(iOS) || os(tvOS)
#if os(iOS) || os(tvOS) || os(visionOS)

import UIKit
import RxSwift
Expand Down
2 changes: 1 addition & 1 deletion RxCocoa/iOS/Protocols/RxPickerViewDataSourceType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Copyright © 2017 Krunoslav Zaher. All rights reserved.
//

#if os(iOS)
#if os(iOS) || os(visionOS)

import UIKit
import RxSwift
Expand Down
2 changes: 1 addition & 1 deletion RxCocoa/iOS/Protocols/RxTableViewDataSourceType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
//

#if os(iOS) || os(tvOS)
#if os(iOS) || os(tvOS) || os(visionOS)

import UIKit
import RxSwift
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Copyright © 2018 Krunoslav Zaher. All rights reserved.
//

#if os(iOS) || os(tvOS)
#if os(iOS) || os(tvOS) || os(visionOS)

import UIKit
import RxSwift
Expand Down
2 changes: 1 addition & 1 deletion RxCocoa/iOS/Proxies/RxCollectionViewDataSourceProxy.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
//

#if os(iOS) || os(tvOS)
#if os(iOS) || os(tvOS) || os(visionOS)

import UIKit
import RxSwift
Expand Down
2 changes: 1 addition & 1 deletion RxCocoa/iOS/Proxies/RxCollectionViewDelegateProxy.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
//

#if os(iOS) || os(tvOS)
#if os(iOS) || os(tvOS) || os(visionOS)

import UIKit
import RxSwift
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Copyright © 2017 Krunoslav Zaher. All rights reserved.
//

#if os(iOS) || os(tvOS)
#if os(iOS) || os(tvOS) || os(visionOS)

import UIKit
import RxSwift
Expand Down
2 changes: 1 addition & 1 deletion RxCocoa/iOS/Proxies/RxPickerViewDataSourceProxy.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Copyright © 2017 Krunoslav Zaher. All rights reserved.
//

#if os(iOS)
#if os(iOS) || os(visionOS)

import UIKit
import RxSwift
Expand Down
2 changes: 1 addition & 1 deletion RxCocoa/iOS/Proxies/RxPickerViewDelegateProxy.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Copyright © 2016 Krunoslav Zaher. All rights reserved.
//

#if os(iOS)
#if os(iOS) || os(visionOS)

import RxSwift
import UIKit
Expand Down
2 changes: 1 addition & 1 deletion RxCocoa/iOS/Proxies/RxScrollViewDelegateProxy.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
//

#if os(iOS) || os(tvOS)
#if os(iOS) || os(tvOS) || os(visionOS)

import RxSwift
import UIKit
Expand Down
2 changes: 1 addition & 1 deletion RxCocoa/iOS/Proxies/RxSearchBarDelegateProxy.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
//

#if os(iOS) || os(tvOS)
#if os(iOS) || os(tvOS) || os(visionOS)

import UIKit
import RxSwift
Expand Down
2 changes: 1 addition & 1 deletion RxCocoa/iOS/Proxies/RxSearchControllerDelegateProxy.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Copyright © 2016 Krunoslav Zaher. All rights reserved.
//

#if os(iOS)
#if os(iOS) || os(visionOS)

import RxSwift
import UIKit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Copyright © 2018 Krunoslav Zaher. All rights reserved.
//

#if os(iOS) || os(tvOS)
#if os(iOS) || os(tvOS) || os(visionOS)

import UIKit
import RxSwift
Expand Down
2 changes: 1 addition & 1 deletion RxCocoa/iOS/Proxies/RxTableViewDataSourceProxy.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
//

#if os(iOS) || os(tvOS)
#if os(iOS) || os(tvOS) || os(visionOS)

import UIKit
import RxSwift
Expand Down
2 changes: 1 addition & 1 deletion RxCocoa/iOS/Proxies/RxTableViewDelegateProxy.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
//

#if os(iOS) || os(tvOS)
#if os(iOS) || os(tvOS) || os(visionOS)

import UIKit
import RxSwift
Expand Down
2 changes: 1 addition & 1 deletion RxCocoa/iOS/Proxies/RxTextStorageDelegateProxy.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
//

#if os(iOS) || os(tvOS)
#if os(iOS) || os(tvOS) || os(visionOS)

import RxSwift
import UIKit
Expand Down
2 changes: 1 addition & 1 deletion RxCocoa/iOS/Proxies/RxTextViewDelegateProxy.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
//

#if os(iOS) || os(tvOS)
#if os(iOS) || os(tvOS) || os(visionOS)

import UIKit
import RxSwift
Expand Down
2 changes: 1 addition & 1 deletion RxCocoa/iOS/UIActivityIndicatorView+Rx.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
//

#if os(iOS) || os(tvOS)
#if os(iOS) || os(tvOS) || os(visionOS)

import UIKit
import RxSwift
Expand Down
20 changes: 13 additions & 7 deletions RxCocoa/iOS/UIApplication+Rx.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,25 @@
// Copyright © 2016 Krunoslav Zaher. All rights reserved.
//

#if os(iOS)
#if os(iOS) || os(visionOS)

import UIKit
import RxSwift
#endif

#if os(iOS)
extension Reactive where Base: UIApplication {
/// Bindable sink for `isNetworkActivityIndicatorVisible`.
public var isNetworkActivityIndicatorVisible: Binder<Bool> {
return Binder(self.base) { application, active in
application.isNetworkActivityIndicatorVisible = active
}
/// Bindable sink for `isNetworkActivityIndicatorVisible`.
public var isNetworkActivityIndicatorVisible: Binder<Bool> {
return Binder(self.base) { application, active in
application.isNetworkActivityIndicatorVisible = active
}

}
}
#endif

#if os(iOS) || os(visionOS)
extension Reactive where Base: UIApplication {
/// Reactive wrapper for `UIApplication.didEnterBackgroundNotification`
public static var didEnterBackground: ControlEvent<Void> {
let source = NotificationCenter.default.rx.notification(UIApplication.didEnterBackgroundNotification).map { _ in }
Expand Down
2 changes: 1 addition & 1 deletion RxCocoa/iOS/UIBarButtonItem+Rx.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
//

#if os(iOS) || os(tvOS)
#if os(iOS) || os(tvOS) || os(visionOS)

import UIKit
import RxSwift
Expand Down
6 changes: 3 additions & 3 deletions RxCocoa/iOS/UIButton+Rx.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
//

#if os(iOS)
#if os(iOS) || os(visionOS)

import RxSwift
import UIKit
Expand Down Expand Up @@ -37,7 +37,7 @@ extension Reactive where Base: UIButton {

#endif

#if os(iOS) || os(tvOS)
#if os(iOS) || os(tvOS) || os(visionOS)

import RxSwift
import UIKit
Expand Down Expand Up @@ -67,7 +67,7 @@ extension Reactive where Base: UIButton {
}
#endif

#if os(iOS) || os(tvOS)
#if os(iOS) || os(tvOS) || os(visionOS)
import RxSwift
import UIKit

Expand Down
2 changes: 1 addition & 1 deletion RxCocoa/iOS/UICollectionView+Rx.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
//

#if os(iOS) || os(tvOS)
#if os(iOS) || os(tvOS) || os(visionOS)

import RxSwift
import UIKit
Expand Down
2 changes: 1 addition & 1 deletion RxCocoa/iOS/UIControl+Rx.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
//

#if os(iOS) || os(tvOS)
#if os(iOS) || os(tvOS) || os(visionOS)

import RxSwift
import UIKit
Expand Down
2 changes: 1 addition & 1 deletion RxCocoa/iOS/UIDatePicker+Rx.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
//

#if os(iOS)
#if os(iOS) || os(visionOS)

import RxSwift
import UIKit
Expand Down
2 changes: 1 addition & 1 deletion RxCocoa/iOS/UIGestureRecognizer+Rx.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
//

#if os(iOS) || os(tvOS)
#if os(iOS) || os(tvOS) || os(visionOS)

import UIKit
import RxSwift
Expand Down
2 changes: 1 addition & 1 deletion RxCocoa/iOS/UINavigationController+Rx.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Copyright © 2017 Krunoslav Zaher. All rights reserved.
//

#if os(iOS) || os(tvOS)
#if os(iOS) || os(tvOS) || os(visionOS)

import RxSwift
import UIKit
Expand Down
2 changes: 1 addition & 1 deletion RxCocoa/iOS/UIPickerView+Rx.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Copyright © 2016 Krunoslav Zaher. All rights reserved.
//

#if os(iOS)
#if os(iOS) || os(visionOS)

import RxSwift
import UIKit
Expand Down
Loading

0 comments on commit cf08cdc

Please sign in to comment.