Skip to content

Commit

Permalink
Add missing tvOS @available checks
Browse files Browse the repository at this point in the history
  • Loading branch information
tgoyne committed May 15, 2020
1 parent cc6b28f commit 91dc97e
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 26 deletions.
36 changes: 18 additions & 18 deletions RealmSwift/Combine.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ extension ObjectKeyIdentifable {
// MARK: - Combine

/// A type which can be passed to `publisher()` or `changesetPublisher()`.
@available(OSX 10.15, watchOS 6.0, iOS 13.0, iOSApplicationExtension 13.0, OSXApplicationExtension 10.15, *)
@available(OSX 10.15, watchOS 6.0, iOS 13.0, iOSApplicationExtension 13.0, OSXApplicationExtension 10.15, tvOS 13.0, *)
public protocol RealmSubscribable {
// swiftlint:disable identifier_name
/// :nodoc:
Expand All @@ -64,7 +64,7 @@ public protocol RealmSubscribable {
// swiftlint:enable identifier_name
}

@available(OSX 10.15, watchOS 6.0, iOS 13.0, iOSApplicationExtension 13.0, OSXApplicationExtension 10.15, *)
@available(OSX 10.15, watchOS 6.0, iOS 13.0, iOSApplicationExtension 13.0, OSXApplicationExtension 10.15, tvOS 13.0, *)
extension Publisher {
/// Freezes all Realm objects and collections emitted by the upstream publisher
///
Expand Down Expand Up @@ -159,7 +159,7 @@ extension Publisher {
}
}

@available(OSX 10.15, watchOS 6.0, iOS 13.0, iOSApplicationExtension 13.0, OSXApplicationExtension 10.15, *)
@available(OSX 10.15, watchOS 6.0, iOS 13.0, iOSApplicationExtension 13.0, OSXApplicationExtension 10.15, tvOS 13.0, *)
extension Publisher where Output: ThreadConfined {
/// Enables passing thread-confined objects to a different dispatch queue.
///
Expand Down Expand Up @@ -191,7 +191,7 @@ extension Publisher where Output: ThreadConfined {
}
}

@available(OSX 10.15, watchOS 6.0, iOS 13.0, iOSApplicationExtension 13.0, OSXApplicationExtension 10.15, *)
@available(OSX 10.15, watchOS 6.0, iOS 13.0, iOSApplicationExtension 13.0, OSXApplicationExtension 10.15, tvOS 13.0, *)
extension Publisher {
/// Enables passing object changesets to a different dispatch queue.
///
Expand Down Expand Up @@ -247,7 +247,7 @@ extension Publisher {
}
}

@available(OSX 10.15, watchOS 6.0, iOS 13.0, iOSApplicationExtension 13.0, OSXApplicationExtension 10.15, *)
@available(OSX 10.15, watchOS 6.0, iOS 13.0, iOSApplicationExtension 13.0, OSXApplicationExtension 10.15, tvOS 13.0, *)
extension RealmCollection where Self: RealmSubscribable {
/// A publisher that emits Void each time the collection changes.
///
Expand All @@ -272,7 +272,7 @@ extension RealmCollection where Self: RealmSubscribable {
/// - precondition: The object must be a managed object which has not been invalidated.
/// - parameter object: A managed object to observe.
/// - returns: A publisher that emits the object each time it changes.
@available(OSX 10.15, watchOS 6.0, iOS 13.0, iOSApplicationExtension 13.0, OSXApplicationExtension 10.15, *)
@available(OSX 10.15, watchOS 6.0, iOS 13.0, iOSApplicationExtension 13.0, OSXApplicationExtension 10.15, tvOS 13.0, *)
public func valuePublisher<T: Object>(_ object: T) -> Publishers.Value<T> {
Publishers.Value<T>(object)
}
Expand All @@ -282,7 +282,7 @@ public func valuePublisher<T: Object>(_ object: T) -> Publishers.Value<T> {
/// - precondition: The collection must be a managed collection which has not been invalidated.
/// - parameter object: A managed collection to observe.
/// - returns: A publisher that emits the collection each time it changes.
@available(OSX 10.15, watchOS 6.0, iOS 13.0, iOSApplicationExtension 13.0, OSXApplicationExtension 10.15, *)
@available(OSX 10.15, watchOS 6.0, iOS 13.0, iOSApplicationExtension 13.0, OSXApplicationExtension 10.15, tvOS 13.0, *)
public func valuePublisher<T: RealmCollection>(_ collection: T) -> Publishers.Value<T> {
Publishers.Value<T>(collection)
}
Expand All @@ -292,7 +292,7 @@ public func valuePublisher<T: RealmCollection>(_ collection: T) -> Publishers.Va
/// - precondition: The object must be a managed object which has not been invalidated.
/// - parameter object: A managed object to observe.
/// - returns: A publisher that emits an object changeset each time the object changes.
@available(OSX 10.15, watchOS 6.0, iOS 13.0, iOSApplicationExtension 13.0, OSXApplicationExtension 10.15, *)
@available(OSX 10.15, watchOS 6.0, iOS 13.0, iOSApplicationExtension 13.0, OSXApplicationExtension 10.15, tvOS 13.0, *)
public func changesetPublisher<T: Object>(_ object: T) -> Publishers.ObjectChangeset<T> {
Publishers.ObjectChangeset<T>(object)
}
Expand All @@ -302,14 +302,14 @@ public func changesetPublisher<T: Object>(_ object: T) -> Publishers.ObjectChang
/// - precondition: The collection must be a managed collection which has not been invalidated.
/// - parameter object: A managed collection to observe.
/// - returns: A publisher that emits a collection changeset each time the collection changes.
@available(OSX 10.15, watchOS 6.0, iOS 13.0, iOSApplicationExtension 13.0, OSXApplicationExtension 10.15, *)
@available(OSX 10.15, watchOS 6.0, iOS 13.0, iOSApplicationExtension 13.0, OSXApplicationExtension 10.15, tvOS 13.0, *)
public func changesetPublisher<T: RealmCollection>(_ collection: T) -> Publishers.CollectionChangeset<T> {
Publishers.CollectionChangeset<T>(collection)
}

// MARK: - Object

@available(OSX 10.15, watchOS 6.0, iOS 13.0, iOSApplicationExtension 13.0, OSXApplicationExtension 10.15, *)
@available(OSX 10.15, watchOS 6.0, iOS 13.0, iOSApplicationExtension 13.0, OSXApplicationExtension 10.15, tvOS 13.0, *)
extension Object: Combine.ObservableObject {
/// A publisher that emits Void each time the object changes.
///
Expand All @@ -319,7 +319,7 @@ extension Object: Combine.ObservableObject {
}
}

@available(OSX 10.15, watchOS 6.0, iOS 13.0, iOSApplicationExtension 13.0, OSXApplicationExtension 10.15, *)
@available(OSX 10.15, watchOS 6.0, iOS 13.0, iOSApplicationExtension 13.0, OSXApplicationExtension 10.15, tvOS 13.0, *)
extension Object: RealmSubscribable {
/// :nodoc:
// swiftlint:disable:next identifier_name
Expand All @@ -345,7 +345,7 @@ extension Object: RealmSubscribable {

// MARK: - List

@available(OSX 10.15, watchOS 6.0, iOS 13.0, iOSApplicationExtension 13.0, OSXApplicationExtension 10.15, *)
@available(OSX 10.15, watchOS 6.0, iOS 13.0, iOSApplicationExtension 13.0, OSXApplicationExtension 10.15, tvOS 13.0, *)
extension List: ObservableObject, RealmSubscribable {
/// A publisher that emits Void each time the collection changes.
///
Expand All @@ -357,7 +357,7 @@ extension List: ObservableObject, RealmSubscribable {

// MARK: - LinkingObjects

@available(OSX 10.15, watchOS 6.0, iOS 13.0, iOSApplicationExtension 13.0, OSXApplicationExtension 10.15, *)
@available(OSX 10.15, watchOS 6.0, iOS 13.0, iOSApplicationExtension 13.0, OSXApplicationExtension 10.15, tvOS 13.0, *)
extension LinkingObjects: RealmSubscribable {
/// A publisher that emits Void each time the collection changes.
///
Expand All @@ -369,7 +369,7 @@ extension LinkingObjects: RealmSubscribable {

// MARK: - Results

@available(OSX 10.15, watchOS 6.0, iOS 13.0, iOSApplicationExtension 13.0, OSXApplicationExtension 10.15, *)
@available(OSX 10.15, watchOS 6.0, iOS 13.0, iOSApplicationExtension 13.0, OSXApplicationExtension 10.15, tvOS 13.0, *)
extension Results: RealmSubscribable {
/// A publisher that emits Void each time the collection changes.
///
Expand All @@ -381,7 +381,7 @@ extension Results: RealmSubscribable {

// MARK: RealmCollection

@available(OSX 10.15, watchOS 6.0, iOS 13.0, iOSApplicationExtension 13.0, OSXApplicationExtension 10.15, *)
@available(OSX 10.15, watchOS 6.0, iOS 13.0, iOSApplicationExtension 13.0, OSXApplicationExtension 10.15, tvOS 13.0, *)
extension RealmCollection {
/// :nodoc:
// swiftlint:disable:next identifier_name
Expand All @@ -406,14 +406,14 @@ extension RealmCollection {
}
}

@available(OSX 10.15, watchOS 6.0, iOS 13.0, iOSApplicationExtension 13.0, OSXApplicationExtension 10.15, *)
@available(OSX 10.15, watchOS 6.0, iOS 13.0, iOSApplicationExtension 13.0, OSXApplicationExtension 10.15, tvOS 13.0, *)
extension AnyRealmCollection: RealmSubscribable {
}

// MARK: Subscriptions

/// A subscription which wraps a Realm notification.
@available(OSX 10.15, watchOS 6.0, iOS 13.0, iOSApplicationExtension 13.0, OSXApplicationExtension 10.15, *)
@available(OSX 10.15, watchOS 6.0, iOS 13.0, iOSApplicationExtension 13.0, OSXApplicationExtension 10.15, tvOS 13.0, *)
public struct ObservationSubscription: Subscription {
private var token: NotificationToken
internal init(token: NotificationToken) {
Expand Down Expand Up @@ -443,7 +443,7 @@ public struct ObservationSubscription: Subscription {
///
/// You normally should not create any of these types directly, and should
/// instead use the extension methods which create them.
@available(OSX 10.15, watchOS 6.0, iOS 13.0, iOSApplicationExtension 13.0, OSXApplicationExtension 10.15, *)
@available(OSX 10.15, watchOS 6.0, iOS 13.0, iOSApplicationExtension 13.0, OSXApplicationExtension 10.15, tvOS 13.0, *)
public enum Publishers {
static private func realm<S: Scheduler>(_ config: RLMRealmConfiguration, _ scheduler: S) -> Realm? {
try? Realm(RLMRealm(configuration: config, queue: scheduler as? DispatchQueue))
Expand Down
16 changes: 8 additions & 8 deletions RealmSwift/Tests/CombineTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import XCTest
import Combine
import RealmSwift

@available(OSX 10.15, watchOS 6.0, iOS 13.0, iOSApplicationExtension 13.0, OSXApplicationExtension 10.15, *)
@available(OSX 10.15, watchOS 6.0, iOS 13.0, iOSApplicationExtension 13.0, OSXApplicationExtension 10.15, tvOS 13.0, *)
extension Publisher {
public func signal(_ semaphore: DispatchSemaphore) -> Combine.Publishers.HandleEvents<Self> {
self.handleEvents(receiveOutput: { _ in semaphore.signal() })
Expand All @@ -33,13 +33,13 @@ extension Publisher {
// results in a warning about it being redundant due to the enclosing check, so
// it needs to be out of line.
func hasCombine() -> Bool {
if #available(OSX 10.15, watchOS 6.0, iOS 13.0, iOSApplicationExtension 13.0, OSXApplicationExtension 10.15, *) {
if #available(OSX 10.15, watchOS 6.0, iOS 13.0, iOSApplicationExtension 13.0, OSXApplicationExtension 10.15, tvOS 13.0, *) {
return true
}
return false
}

@available(OSX 10.15, watchOS 6.0, iOS 13.0, iOSApplicationExtension 13.0, OSXApplicationExtension 10.15, *)
@available(OSX 10.15, watchOS 6.0, iOS 13.0, iOSApplicationExtension 13.0, OSXApplicationExtension 10.15, tvOS 13.0, *)
class CombineObjectPublisherTests: TestCase {
var realm: Realm!
var token: AnyCancellable?
Expand Down Expand Up @@ -552,7 +552,7 @@ private protocol CombineTestCollection {
func appendObject()
}

@available(OSX 10.15, watchOS 6.0, iOS 13.0, iOSApplicationExtension 13.0, OSXApplicationExtension 10.15, *)
@available(OSX 10.15, watchOS 6.0, iOS 13.0, iOSApplicationExtension 13.0, OSXApplicationExtension 10.15, tvOS 13.0, *)
private class CombineCollectionPublisherTests<Collection: RealmCollection>: TestCase
where Collection: CombineTestCollection, Collection: RealmSubscribable {
var realm: Realm!
Expand Down Expand Up @@ -914,7 +914,7 @@ extension Results: CombineTestCollection where Element: Object {
}
}

@available(OSX 10.15, watchOS 6.0, iOS 13.0, iOSApplicationExtension 13.0, OSXApplicationExtension 10.15, *)
@available(OSX 10.15, watchOS 6.0, iOS 13.0, iOSApplicationExtension 13.0, OSXApplicationExtension 10.15, tvOS 13.0, *)
class ResultsPublisherTests: TestCase {
override class var defaultTestSuite: XCTestSuite {
return CombineCollectionPublisherTests<Results<SwiftIntObject>>.testSuite("Results")
Expand All @@ -931,7 +931,7 @@ extension List: CombineTestCollection where Element == SwiftIntObject {
}
}

@available(OSX 10.15, watchOS 6.0, iOS 13.0, iOSApplicationExtension 13.0, OSXApplicationExtension 10.15, *)
@available(OSX 10.15, watchOS 6.0, iOS 13.0, iOSApplicationExtension 13.0, OSXApplicationExtension 10.15, tvOS 13.0, *)
class ManagedListPublisherTests: TestCase {
override class var defaultTestSuite: XCTestSuite {
return CombineCollectionPublisherTests<List<SwiftIntObject>>.testSuite("List")
Expand All @@ -948,7 +948,7 @@ extension LinkingObjects: CombineTestCollection where Element == SwiftOwnerObjec
}
}

@available(OSX 10.15, watchOS 6.0, iOS 13.0, iOSApplicationExtension 13.0, OSXApplicationExtension 10.15, *)
@available(OSX 10.15, watchOS 6.0, iOS 13.0, iOSApplicationExtension 13.0, OSXApplicationExtension 10.15, tvOS 13.0, *)
class LinkingObjectsPublisherTests: TestCase {
override class var defaultTestSuite: XCTestSuite {
return CombineCollectionPublisherTests<LinkingObjects<SwiftOwnerObject>>.testSuite("LinkingObjects")
Expand All @@ -965,7 +965,7 @@ extension AnyRealmCollection: CombineTestCollection where Element == SwiftIntObj
}
}

@available(OSX 10.15, watchOS 6.0, iOS 13.0, iOSApplicationExtension 13.0, OSXApplicationExtension 10.15, *)
@available(OSX 10.15, watchOS 6.0, iOS 13.0, iOSApplicationExtension 13.0, OSXApplicationExtension 10.15, tvOS 13.0, *)
class AnyRealmCollectionPublisherTests: TestCase {
override class var defaultTestSuite: XCTestSuite {
return CombineCollectionPublisherTests<AnyRealmCollection<SwiftIntObject>>.testSuite("AnyRealmCollection")
Expand Down

0 comments on commit 91dc97e

Please sign in to comment.