Use `canImport(ObjectiveC)` instead of `os(macOS) || os(iOS) || os(tvOS) || os(watchOS)`

This commit is contained in:
Quentin Jin 2019-04-03 17:51:14 +08:00
parent b0c871bf5f
commit 655c716b62
3 changed files with 3 additions and 3 deletions

View File

@ -1,6 +1,6 @@
import Foundation
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
#if canImport(ObjectiveC)
private var DEINIT_OBSERVER_KEY: Void = ()

View File

@ -130,7 +130,7 @@ open class Task {
execute()
}
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
#if canImport(ObjectiveC)
open func host(on target: AnyObject) {
DeinitObserver.observe(target) { [weak self] in
self?.cancel()

View File

@ -1,7 +1,7 @@
import XCTest
@testable import Schedule
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
#if canImport(ObjectiveC)
final class DeinitObserverTests: XCTestCase {