diff --git a/Example-iOS/AppDelegate.swift b/Example-iOS/AppDelegate.swift index cb672ba..7fd340b 100644 --- a/Example-iOS/AppDelegate.swift +++ b/Example-iOS/AppDelegate.swift @@ -15,7 +15,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { - self.window = UIWindow(frame: UIScreen.main.bounds) + self.window = UIWindow() let listViewController:ListViewController = ListViewController() let navigationController:UINavigationController = UINavigationController(rootViewController: listViewController); diff --git a/Example-iOS/Example-iOS.xcodeproj/project.pbxproj b/Example-iOS/Example-iOS.xcodeproj/project.pbxproj index 697906a..5e97d60 100644 --- a/Example-iOS/Example-iOS.xcodeproj/project.pbxproj +++ b/Example-iOS/Example-iOS.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 52; + objectVersion = 54; objects = { /* Begin PBXBuildFile section */ @@ -310,8 +310,11 @@ ); PRODUCT_BUNDLE_IDENTIFIER = "io.snapkit.Example-iOS"; PRODUCT_NAME = "$(TARGET_NAME)"; + SUPPORTED_PLATFORMS = "iphoneos iphonesimulator xros xrsimulator"; + SUPPORTS_MACCATALYST = NO; + SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO; SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; + TARGETED_DEVICE_FAMILY = "1,2,7"; }; name = Debug; }; @@ -333,8 +336,11 @@ ); PRODUCT_BUNDLE_IDENTIFIER = "io.snapkit.Example-iOS"; PRODUCT_NAME = "$(TARGET_NAME)"; + SUPPORTED_PLATFORMS = "iphoneos iphonesimulator xros xrsimulator"; + SUPPORTS_MACCATALYST = NO; + SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO; SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; + TARGETED_DEVICE_FAMILY = "1,2,7"; }; name = Release; }; diff --git a/Sources/Constraint.swift b/Sources/Constraint.swift index 37409b3..b890152 100644 --- a/Sources/Constraint.swift +++ b/Sources/Constraint.swift @@ -21,7 +21,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. -#if os(iOS) || os(tvOS) +#if canImport(UIKit) import UIKit #else import AppKit @@ -101,7 +101,7 @@ public final class Constraint { for layoutFromAttribute in layoutFromAttributes { // get layout to attribute let layoutToAttribute: LayoutAttribute - #if os(iOS) || os(tvOS) + #if canImport(UIKit) if layoutToAttributes.count > 0 { if self.from.attributes == .edges && self.to.attributes == .margins { switch layoutFromAttribute { @@ -245,7 +245,7 @@ public final class Constraint { return self } - #if os(iOS) || os(tvOS) + #if canImport(UIKit) @discardableResult @available(iOS 11.0, tvOS 11.0, *) public func update(inset: ConstraintDirectionalInsetTarget) -> Constraint { diff --git a/Sources/ConstraintAttributes.swift b/Sources/ConstraintAttributes.swift index 408308b..c1a79c2 100644 --- a/Sources/ConstraintAttributes.swift +++ b/Sources/ConstraintAttributes.swift @@ -21,7 +21,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. -#if os(iOS) || os(tvOS) +#if canImport(UIKit) import UIKit #else import AppKit @@ -152,7 +152,7 @@ internal struct ConstraintAttributes : OptionSet, ExpressibleByIntegerLiteral { attrs.append(.lastBaseline) } - #if os(iOS) || os(tvOS) + #if canImport(UIKit) if (self.contains(ConstraintAttributes.firstBaseline)) { attrs.append(.firstBaseline) } diff --git a/Sources/ConstraintConfig.swift b/Sources/ConstraintConfig.swift index 2746b7d..9bd0f23 100644 --- a/Sources/ConstraintConfig.swift +++ b/Sources/ConstraintConfig.swift @@ -21,7 +21,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. -#if os(iOS) || os(tvOS) +#if canImport(UIKit) import UIKit public typealias ConstraintInterfaceLayoutDirection = UIUserInterfaceLayoutDirection #else diff --git a/Sources/ConstraintConstantTarget.swift b/Sources/ConstraintConstantTarget.swift index 7f54907..e16f503 100644 --- a/Sources/ConstraintConstantTarget.swift +++ b/Sources/ConstraintConstantTarget.swift @@ -21,7 +21,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. -#if os(iOS) || os(tvOS) +#if canImport(UIKit) import UIKit #else import AppKit @@ -40,7 +40,7 @@ extension CGSize: ConstraintConstantTarget { extension ConstraintInsets: ConstraintConstantTarget { } -#if os(iOS) || os(tvOS) +#if canImport(UIKit) @available(iOS 11.0, tvOS 11.0, *) extension ConstraintDirectionalInsets: ConstraintConstantTarget { } @@ -80,7 +80,7 @@ extension ConstraintConstantTarget { } if let value = self as? CGPoint { - #if os(iOS) || os(tvOS) + #if canImport(UIKit) switch layoutAttribute { case .left, .right, .leading, .trailing, .centerX, .leftMargin, .rightMargin, .leadingMargin, .trailingMargin, .centerXWithinMargins: return value.x @@ -110,7 +110,7 @@ extension ConstraintConstantTarget { } if let value = self as? ConstraintInsets { - #if os(iOS) || os(tvOS) + #if canImport(UIKit) switch layoutAttribute { case .left, .leftMargin: return value.left @@ -171,7 +171,7 @@ extension ConstraintConstantTarget { #endif } - #if os(iOS) || os(tvOS) + #if canImport(UIKit) if #available(iOS 11.0, tvOS 11.0, *), let value = self as? ConstraintDirectionalInsets { switch layoutAttribute { case .left, .leftMargin: diff --git a/Sources/ConstraintDSL.swift b/Sources/ConstraintDSL.swift index 20f153d..5683b7f 100644 --- a/Sources/ConstraintDSL.swift +++ b/Sources/ConstraintDSL.swift @@ -21,7 +21,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. -#if os(iOS) || os(tvOS) +#if canImport(UIKit) import UIKit #else import AppKit diff --git a/Sources/ConstraintDescription.swift b/Sources/ConstraintDescription.swift index 3521f9f..b9d476c 100644 --- a/Sources/ConstraintDescription.swift +++ b/Sources/ConstraintDescription.swift @@ -21,7 +21,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. -#if os(iOS) || os(tvOS) +#if canImport(UIKit) import UIKit #else import AppKit diff --git a/Sources/ConstraintDirectionalInsetTarget.swift b/Sources/ConstraintDirectionalInsetTarget.swift index 955aec3..4c3c418 100644 --- a/Sources/ConstraintDirectionalInsetTarget.swift +++ b/Sources/ConstraintDirectionalInsetTarget.swift @@ -21,13 +21,13 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. -#if os(iOS) || os(tvOS) +#if canImport(UIKit) import UIKit #else import AppKit #endif -#if os(iOS) || os(tvOS) +#if canImport(UIKit) public protocol ConstraintDirectionalInsetTarget: ConstraintConstantTarget { } diff --git a/Sources/ConstraintDirectionalInsets.swift b/Sources/ConstraintDirectionalInsets.swift index ada8ed5..056b5c8 100644 --- a/Sources/ConstraintDirectionalInsets.swift +++ b/Sources/ConstraintDirectionalInsets.swift @@ -21,14 +21,14 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. -#if os(iOS) || os(tvOS) +#if canImport(UIKit) import UIKit #else import AppKit #endif -#if os(iOS) || os(tvOS) +#if canImport(UIKit) @available(iOS 11.0, tvOS 11.0, *) public typealias ConstraintDirectionalInsets = NSDirectionalEdgeInsets #endif diff --git a/Sources/ConstraintInsetTarget.swift b/Sources/ConstraintInsetTarget.swift index ba8a0f3..43c0220 100644 --- a/Sources/ConstraintInsetTarget.swift +++ b/Sources/ConstraintInsetTarget.swift @@ -21,7 +21,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. -#if os(iOS) || os(tvOS) +#if canImport(UIKit) import UIKit #else import AppKit diff --git a/Sources/ConstraintInsets.swift b/Sources/ConstraintInsets.swift index 738ca05..64d781d 100644 --- a/Sources/ConstraintInsets.swift +++ b/Sources/ConstraintInsets.swift @@ -21,14 +21,14 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. -#if os(iOS) || os(tvOS) +#if canImport(UIKit) import UIKit #else import AppKit #endif -#if os(iOS) || os(tvOS) +#if canImport(UIKit) public typealias ConstraintInsets = UIEdgeInsets #else public typealias ConstraintInsets = NSEdgeInsets diff --git a/Sources/ConstraintItem.swift b/Sources/ConstraintItem.swift index a342c1d..2f92221 100644 --- a/Sources/ConstraintItem.swift +++ b/Sources/ConstraintItem.swift @@ -21,7 +21,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. -#if os(iOS) || os(tvOS) +#if canImport(UIKit) import UIKit #else import AppKit diff --git a/Sources/ConstraintLayoutGuide+Extensions.swift b/Sources/ConstraintLayoutGuide+Extensions.swift index d429e0c..e9fd9b3 100644 --- a/Sources/ConstraintLayoutGuide+Extensions.swift +++ b/Sources/ConstraintLayoutGuide+Extensions.swift @@ -21,7 +21,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. -#if os(iOS) || os(tvOS) +#if canImport(UIKit) import UIKit #endif diff --git a/Sources/ConstraintLayoutGuide.swift b/Sources/ConstraintLayoutGuide.swift index e3e50c8..fd89556 100644 --- a/Sources/ConstraintLayoutGuide.swift +++ b/Sources/ConstraintLayoutGuide.swift @@ -21,14 +21,14 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. -#if os(iOS) || os(tvOS) +#if canImport(UIKit) import UIKit #else import AppKit #endif -#if os(iOS) || os(tvOS) +#if canImport(UIKit) @available(iOS 9.0, *) public typealias ConstraintLayoutGuide = UILayoutGuide #else diff --git a/Sources/ConstraintLayoutGuideDSL.swift b/Sources/ConstraintLayoutGuideDSL.swift index 0007819..7e78261 100644 --- a/Sources/ConstraintLayoutGuideDSL.swift +++ b/Sources/ConstraintLayoutGuideDSL.swift @@ -21,7 +21,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. -#if os(iOS) || os(tvOS) +#if canImport(UIKit) import UIKit #else import AppKit diff --git a/Sources/ConstraintLayoutSupport.swift b/Sources/ConstraintLayoutSupport.swift index e92e9fb..085f5cd 100644 --- a/Sources/ConstraintLayoutSupport.swift +++ b/Sources/ConstraintLayoutSupport.swift @@ -21,14 +21,14 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. -#if os(iOS) || os(tvOS) +#if canImport(UIKit) import UIKit #else import AppKit #endif -#if os(iOS) || os(tvOS) +#if canImport(UIKit) @available(iOS 8.0, *) public typealias ConstraintLayoutSupport = UILayoutSupport #else diff --git a/Sources/ConstraintLayoutSupportDSL.swift b/Sources/ConstraintLayoutSupportDSL.swift index 5d6ae89..71e1158 100644 --- a/Sources/ConstraintLayoutSupportDSL.swift +++ b/Sources/ConstraintLayoutSupportDSL.swift @@ -21,7 +21,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. -#if os(iOS) || os(tvOS) +#if canImport(UIKit) import UIKit #else import AppKit diff --git a/Sources/ConstraintMaker.swift b/Sources/ConstraintMaker.swift index 50d7402..7c352f6 100644 --- a/Sources/ConstraintMaker.swift +++ b/Sources/ConstraintMaker.swift @@ -21,7 +21,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. -#if os(iOS) || os(tvOS) +#if canImport(UIKit) import UIKit #else import AppKit diff --git a/Sources/ConstraintMakerEditable.swift b/Sources/ConstraintMakerEditable.swift index 4869bc2..0e08e38 100644 --- a/Sources/ConstraintMakerEditable.swift +++ b/Sources/ConstraintMakerEditable.swift @@ -21,7 +21,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. -#if os(iOS) || os(tvOS) +#if canImport(UIKit) import UIKit #else import AppKit @@ -53,7 +53,7 @@ public class ConstraintMakerEditable: ConstraintMakerPrioritizable { return self } - #if os(iOS) || os(tvOS) + #if canImport(UIKit) @discardableResult @available(iOS 11.0, tvOS 11.0, *) public func inset(_ amount: ConstraintDirectionalInsetTarget) -> ConstraintMakerEditable { diff --git a/Sources/ConstraintMakerExtendable.swift b/Sources/ConstraintMakerExtendable.swift index d834649..b30688e 100644 --- a/Sources/ConstraintMakerExtendable.swift +++ b/Sources/ConstraintMakerExtendable.swift @@ -21,7 +21,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. -#if os(iOS) || os(tvOS) +#if canImport(UIKit) import UIKit #else import AppKit diff --git a/Sources/ConstraintMakerFinalizable.swift b/Sources/ConstraintMakerFinalizable.swift index 4e1379e..8342476 100644 --- a/Sources/ConstraintMakerFinalizable.swift +++ b/Sources/ConstraintMakerFinalizable.swift @@ -21,7 +21,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. -#if os(iOS) || os(tvOS) +#if canImport(UIKit) import UIKit #else import AppKit diff --git a/Sources/ConstraintMakerPrioritizable.swift b/Sources/ConstraintMakerPrioritizable.swift index 5af5303..05451e6 100644 --- a/Sources/ConstraintMakerPrioritizable.swift +++ b/Sources/ConstraintMakerPrioritizable.swift @@ -21,7 +21,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. -#if os(iOS) || os(tvOS) +#if canImport(UIKit) import UIKit #else import AppKit diff --git a/Sources/ConstraintMakerRelatable+Extensions.swift b/Sources/ConstraintMakerRelatable+Extensions.swift index 9fca160..bfde272 100644 --- a/Sources/ConstraintMakerRelatable+Extensions.swift +++ b/Sources/ConstraintMakerRelatable+Extensions.swift @@ -21,7 +21,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. -#if os(iOS) || os(tvOS) +#if canImport(UIKit) import UIKit #else import AppKit diff --git a/Sources/ConstraintMakerRelatable.swift b/Sources/ConstraintMakerRelatable.swift index 7889532..0a3d5ee 100644 --- a/Sources/ConstraintMakerRelatable.swift +++ b/Sources/ConstraintMakerRelatable.swift @@ -21,7 +21,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. -#if os(iOS) || os(tvOS) +#if canImport(UIKit) import UIKit #else import AppKit diff --git a/Sources/ConstraintMultiplierTarget.swift b/Sources/ConstraintMultiplierTarget.swift index 6fecd33..ac537ba 100644 --- a/Sources/ConstraintMultiplierTarget.swift +++ b/Sources/ConstraintMultiplierTarget.swift @@ -21,7 +21,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. -#if os(iOS) || os(tvOS) +#if canImport(UIKit) import UIKit #else import AppKit diff --git a/Sources/ConstraintOffsetTarget.swift b/Sources/ConstraintOffsetTarget.swift index bd9e0a1..6ec1107 100644 --- a/Sources/ConstraintOffsetTarget.swift +++ b/Sources/ConstraintOffsetTarget.swift @@ -21,7 +21,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. -#if os(iOS) || os(tvOS) +#if canImport(UIKit) import UIKit #else import AppKit diff --git a/Sources/ConstraintPriority.swift b/Sources/ConstraintPriority.swift index f9dab16..bf90693 100644 --- a/Sources/ConstraintPriority.swift +++ b/Sources/ConstraintPriority.swift @@ -21,7 +21,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. -#if os(iOS) || os(tvOS) +#if canImport(UIKit) import UIKit #else import AppKit diff --git a/Sources/ConstraintPriorityTarget.swift b/Sources/ConstraintPriorityTarget.swift index 064f750..1aa701e 100644 --- a/Sources/ConstraintPriorityTarget.swift +++ b/Sources/ConstraintPriorityTarget.swift @@ -21,7 +21,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. -#if os(iOS) || os(tvOS) +#if canImport(UIKit) import UIKit #else import AppKit @@ -74,7 +74,7 @@ extension CGFloat: ConstraintPriorityTarget { } -#if os(iOS) || os(tvOS) +#if canImport(UIKit) extension UILayoutPriority: ConstraintPriorityTarget { public var constraintPriorityTargetValue: Float { diff --git a/Sources/ConstraintRelatableTarget.swift b/Sources/ConstraintRelatableTarget.swift index d517a61..df04464 100644 --- a/Sources/ConstraintRelatableTarget.swift +++ b/Sources/ConstraintRelatableTarget.swift @@ -21,7 +21,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. -#if os(iOS) || os(tvOS) +#if canImport(UIKit) import UIKit #else import AppKit @@ -55,7 +55,7 @@ extension CGPoint: ConstraintRelatableTarget { extension ConstraintInsets: ConstraintRelatableTarget { } -#if os(iOS) || os(tvOS) +#if canImport(UIKit) @available(iOS 11.0, tvOS 11.0, *) extension ConstraintDirectionalInsets: ConstraintRelatableTarget { } diff --git a/Sources/ConstraintRelation.swift b/Sources/ConstraintRelation.swift index 446aaf7..643d499 100644 --- a/Sources/ConstraintRelation.swift +++ b/Sources/ConstraintRelation.swift @@ -21,7 +21,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. -#if os(iOS) || os(tvOS) +#if canImport(UIKit) import UIKit #else import AppKit diff --git a/Sources/ConstraintView+Extensions.swift b/Sources/ConstraintView+Extensions.swift index e0f71c1..1225c04 100644 --- a/Sources/ConstraintView+Extensions.swift +++ b/Sources/ConstraintView+Extensions.swift @@ -21,7 +21,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. -#if os(iOS) || os(tvOS) +#if canImport(UIKit) import UIKit #else import AppKit diff --git a/Sources/ConstraintView.swift b/Sources/ConstraintView.swift index 6ff8a76..1203300 100644 --- a/Sources/ConstraintView.swift +++ b/Sources/ConstraintView.swift @@ -21,14 +21,14 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. -#if os(iOS) || os(tvOS) +#if canImport(UIKit) import UIKit #else import AppKit #endif -#if os(iOS) || os(tvOS) +#if canImport(UIKit) public typealias ConstraintView = UIView #else public typealias ConstraintView = NSView diff --git a/Sources/ConstraintViewDSL.swift b/Sources/ConstraintViewDSL.swift index a0187f9..8567e54 100644 --- a/Sources/ConstraintViewDSL.swift +++ b/Sources/ConstraintViewDSL.swift @@ -21,7 +21,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. -#if os(iOS) || os(tvOS) +#if canImport(UIKit) import UIKit #else import AppKit diff --git a/Sources/Debugging.swift b/Sources/Debugging.swift index a78579a..f4120b2 100644 --- a/Sources/Debugging.swift +++ b/Sources/Debugging.swift @@ -21,7 +21,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. -#if os(iOS) || os(tvOS) +#if canImport(UIKit) import UIKit #else import AppKit @@ -89,7 +89,7 @@ private func descriptionForRelation(_ relation: LayoutRelation) -> String { } private func descriptionForAttribute(_ attribute: LayoutAttribute) -> String { - #if os(iOS) || os(tvOS) + #if canImport(UIKit) switch attribute { case .notAnAttribute: return "notAnAttribute" case .top: return "top" diff --git a/Sources/LayoutConstraint.swift b/Sources/LayoutConstraint.swift index 5425ea8..607616d 100644 --- a/Sources/LayoutConstraint.swift +++ b/Sources/LayoutConstraint.swift @@ -21,7 +21,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. -#if os(iOS) || os(tvOS) +#if canImport(UIKit) import UIKit #else import AppKit diff --git a/Sources/LayoutConstraintItem.swift b/Sources/LayoutConstraintItem.swift index 9b61d18..4f41b5d 100644 --- a/Sources/LayoutConstraintItem.swift +++ b/Sources/LayoutConstraintItem.swift @@ -21,7 +21,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. -#if os(iOS) || os(tvOS) +#if canImport(UIKit) import UIKit #else import AppKit diff --git a/Sources/Typealiases.swift b/Sources/Typealiases.swift index ded96cc..c0e6982 100644 --- a/Sources/Typealiases.swift +++ b/Sources/Typealiases.swift @@ -23,7 +23,7 @@ import Foundation -#if os(iOS) || os(tvOS) +#if canImport(UIKit) import UIKit #if swift(>=4.2) typealias LayoutRelation = NSLayoutConstraint.Relation diff --git a/Sources/UILayoutSupport+Extensions.swift b/Sources/UILayoutSupport+Extensions.swift index 8e7644c..801cc3c 100644 --- a/Sources/UILayoutSupport+Extensions.swift +++ b/Sources/UILayoutSupport+Extensions.swift @@ -21,7 +21,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. -#if os(iOS) || os(tvOS) +#if canImport(UIKit) import UIKit #endif diff --git a/Tests/SnapKitTests/Tests.swift b/Tests/SnapKitTests/Tests.swift index eaaf231..99ec633 100644 --- a/Tests/SnapKitTests/Tests.swift +++ b/Tests/SnapKitTests/Tests.swift @@ -1,4 +1,4 @@ -#if os(iOS) || os(tvOS) +#if canImport(UIKit) import UIKit typealias View = UIView extension View { @@ -453,7 +453,7 @@ class SnapKitTests: XCTestCase { XCTAssertEqual(constraints[3].constant, -25, "Should be -25") } - #if os(iOS) || os(tvOS) + #if canImport(UIKit) @available(iOS 11.0, tvOS 11.0, *) func testConstraintDirectionalInsetsAsImpliedEqualToConstraints() { let view = View() @@ -481,7 +481,7 @@ class SnapKitTests: XCTestCase { } #endif - #if os(iOS) || os(tvOS) + #if canImport(UIKit) @available(iOS 11.0, tvOS 11.0, *) func testConstraintDirectionalInsetsAsConstraintsConstant() { let view = View() @@ -509,7 +509,7 @@ class SnapKitTests: XCTestCase { } #endif - #if os(iOS) || os(tvOS) + #if canImport(UIKit) @available(iOS 11.0, tvOS 11.0, *) func testConstraintDirectionalInsetsFallBackForNonDirectionalConstraints() { let view = View() @@ -638,7 +638,7 @@ class SnapKitTests: XCTestCase { XCTAssert(toAttributes == [.top, .leading, .bottom, .trailing]) } - #if os(iOS) || os(tvOS) + #if canImport(UIKit) func testEdgesToMargins() { var fromAttributes = Set() var toAttributes = Set()