Compile for visionOS (#777)

This commit is contained in:
Alex Türk 2023-10-04 15:30:31 +02:00 committed by GitHub
parent 58320fe805
commit 4d52cc3768
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
40 changed files with 69 additions and 63 deletions

View File

@ -15,7 +15,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 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 listViewController:ListViewController = ListViewController()
let navigationController:UINavigationController = UINavigationController(rootViewController: listViewController); let navigationController:UINavigationController = UINavigationController(rootViewController: listViewController);

View File

@ -3,7 +3,7 @@
archiveVersion = 1; archiveVersion = 1;
classes = { classes = {
}; };
objectVersion = 52; objectVersion = 54;
objects = { objects = {
/* Begin PBXBuildFile section */ /* Begin PBXBuildFile section */
@ -310,8 +310,11 @@
); );
PRODUCT_BUNDLE_IDENTIFIER = "io.snapkit.Example-iOS"; PRODUCT_BUNDLE_IDENTIFIER = "io.snapkit.Example-iOS";
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator xros xrsimulator";
SUPPORTS_MACCATALYST = NO;
SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO;
SWIFT_VERSION = 5.0; SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2"; TARGETED_DEVICE_FAMILY = "1,2,7";
}; };
name = Debug; name = Debug;
}; };
@ -333,8 +336,11 @@
); );
PRODUCT_BUNDLE_IDENTIFIER = "io.snapkit.Example-iOS"; PRODUCT_BUNDLE_IDENTIFIER = "io.snapkit.Example-iOS";
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator xros xrsimulator";
SUPPORTS_MACCATALYST = NO;
SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO;
SWIFT_VERSION = 5.0; SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2"; TARGETED_DEVICE_FAMILY = "1,2,7";
}; };
name = Release; name = Release;
}; };

View File

@ -21,7 +21,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE. // THE SOFTWARE.
#if os(iOS) || os(tvOS) #if canImport(UIKit)
import UIKit import UIKit
#else #else
import AppKit import AppKit
@ -101,7 +101,7 @@ public final class Constraint {
for layoutFromAttribute in layoutFromAttributes { for layoutFromAttribute in layoutFromAttributes {
// get layout to attribute // get layout to attribute
let layoutToAttribute: LayoutAttribute let layoutToAttribute: LayoutAttribute
#if os(iOS) || os(tvOS) #if canImport(UIKit)
if layoutToAttributes.count > 0 { if layoutToAttributes.count > 0 {
if self.from.attributes == .edges && self.to.attributes == .margins { if self.from.attributes == .edges && self.to.attributes == .margins {
switch layoutFromAttribute { switch layoutFromAttribute {
@ -245,7 +245,7 @@ public final class Constraint {
return self return self
} }
#if os(iOS) || os(tvOS) #if canImport(UIKit)
@discardableResult @discardableResult
@available(iOS 11.0, tvOS 11.0, *) @available(iOS 11.0, tvOS 11.0, *)
public func update(inset: ConstraintDirectionalInsetTarget) -> Constraint { public func update(inset: ConstraintDirectionalInsetTarget) -> Constraint {

View File

@ -21,7 +21,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE. // THE SOFTWARE.
#if os(iOS) || os(tvOS) #if canImport(UIKit)
import UIKit import UIKit
#else #else
import AppKit import AppKit
@ -152,7 +152,7 @@ internal struct ConstraintAttributes : OptionSet, ExpressibleByIntegerLiteral {
attrs.append(.lastBaseline) attrs.append(.lastBaseline)
} }
#if os(iOS) || os(tvOS) #if canImport(UIKit)
if (self.contains(ConstraintAttributes.firstBaseline)) { if (self.contains(ConstraintAttributes.firstBaseline)) {
attrs.append(.firstBaseline) attrs.append(.firstBaseline)
} }

View File

@ -21,7 +21,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE. // THE SOFTWARE.
#if os(iOS) || os(tvOS) #if canImport(UIKit)
import UIKit import UIKit
public typealias ConstraintInterfaceLayoutDirection = UIUserInterfaceLayoutDirection public typealias ConstraintInterfaceLayoutDirection = UIUserInterfaceLayoutDirection
#else #else

View File

@ -21,7 +21,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE. // THE SOFTWARE.
#if os(iOS) || os(tvOS) #if canImport(UIKit)
import UIKit import UIKit
#else #else
import AppKit import AppKit
@ -40,7 +40,7 @@ extension CGSize: ConstraintConstantTarget {
extension ConstraintInsets: ConstraintConstantTarget { extension ConstraintInsets: ConstraintConstantTarget {
} }
#if os(iOS) || os(tvOS) #if canImport(UIKit)
@available(iOS 11.0, tvOS 11.0, *) @available(iOS 11.0, tvOS 11.0, *)
extension ConstraintDirectionalInsets: ConstraintConstantTarget { extension ConstraintDirectionalInsets: ConstraintConstantTarget {
} }
@ -80,7 +80,7 @@ extension ConstraintConstantTarget {
} }
if let value = self as? CGPoint { if let value = self as? CGPoint {
#if os(iOS) || os(tvOS) #if canImport(UIKit)
switch layoutAttribute { switch layoutAttribute {
case .left, .right, .leading, .trailing, .centerX, .leftMargin, .rightMargin, .leadingMargin, .trailingMargin, .centerXWithinMargins: case .left, .right, .leading, .trailing, .centerX, .leftMargin, .rightMargin, .leadingMargin, .trailingMargin, .centerXWithinMargins:
return value.x return value.x
@ -110,7 +110,7 @@ extension ConstraintConstantTarget {
} }
if let value = self as? ConstraintInsets { if let value = self as? ConstraintInsets {
#if os(iOS) || os(tvOS) #if canImport(UIKit)
switch layoutAttribute { switch layoutAttribute {
case .left, .leftMargin: case .left, .leftMargin:
return value.left return value.left
@ -171,7 +171,7 @@ extension ConstraintConstantTarget {
#endif #endif
} }
#if os(iOS) || os(tvOS) #if canImport(UIKit)
if #available(iOS 11.0, tvOS 11.0, *), let value = self as? ConstraintDirectionalInsets { if #available(iOS 11.0, tvOS 11.0, *), let value = self as? ConstraintDirectionalInsets {
switch layoutAttribute { switch layoutAttribute {
case .left, .leftMargin: case .left, .leftMargin:

View File

@ -21,7 +21,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE. // THE SOFTWARE.
#if os(iOS) || os(tvOS) #if canImport(UIKit)
import UIKit import UIKit
#else #else
import AppKit import AppKit

View File

@ -21,7 +21,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE. // THE SOFTWARE.
#if os(iOS) || os(tvOS) #if canImport(UIKit)
import UIKit import UIKit
#else #else
import AppKit import AppKit

View File

@ -21,13 +21,13 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE. // THE SOFTWARE.
#if os(iOS) || os(tvOS) #if canImport(UIKit)
import UIKit import UIKit
#else #else
import AppKit import AppKit
#endif #endif
#if os(iOS) || os(tvOS) #if canImport(UIKit)
public protocol ConstraintDirectionalInsetTarget: ConstraintConstantTarget { public protocol ConstraintDirectionalInsetTarget: ConstraintConstantTarget {
} }

View File

@ -21,14 +21,14 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE. // THE SOFTWARE.
#if os(iOS) || os(tvOS) #if canImport(UIKit)
import UIKit import UIKit
#else #else
import AppKit import AppKit
#endif #endif
#if os(iOS) || os(tvOS) #if canImport(UIKit)
@available(iOS 11.0, tvOS 11.0, *) @available(iOS 11.0, tvOS 11.0, *)
public typealias ConstraintDirectionalInsets = NSDirectionalEdgeInsets public typealias ConstraintDirectionalInsets = NSDirectionalEdgeInsets
#endif #endif

View File

@ -21,7 +21,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE. // THE SOFTWARE.
#if os(iOS) || os(tvOS) #if canImport(UIKit)
import UIKit import UIKit
#else #else
import AppKit import AppKit

View File

@ -21,14 +21,14 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE. // THE SOFTWARE.
#if os(iOS) || os(tvOS) #if canImport(UIKit)
import UIKit import UIKit
#else #else
import AppKit import AppKit
#endif #endif
#if os(iOS) || os(tvOS) #if canImport(UIKit)
public typealias ConstraintInsets = UIEdgeInsets public typealias ConstraintInsets = UIEdgeInsets
#else #else
public typealias ConstraintInsets = NSEdgeInsets public typealias ConstraintInsets = NSEdgeInsets

View File

@ -21,7 +21,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE. // THE SOFTWARE.
#if os(iOS) || os(tvOS) #if canImport(UIKit)
import UIKit import UIKit
#else #else
import AppKit import AppKit

View File

@ -21,7 +21,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE. // THE SOFTWARE.
#if os(iOS) || os(tvOS) #if canImport(UIKit)
import UIKit import UIKit
#endif #endif

View File

@ -21,14 +21,14 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE. // THE SOFTWARE.
#if os(iOS) || os(tvOS) #if canImport(UIKit)
import UIKit import UIKit
#else #else
import AppKit import AppKit
#endif #endif
#if os(iOS) || os(tvOS) #if canImport(UIKit)
@available(iOS 9.0, *) @available(iOS 9.0, *)
public typealias ConstraintLayoutGuide = UILayoutGuide public typealias ConstraintLayoutGuide = UILayoutGuide
#else #else

View File

@ -21,7 +21,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE. // THE SOFTWARE.
#if os(iOS) || os(tvOS) #if canImport(UIKit)
import UIKit import UIKit
#else #else
import AppKit import AppKit

View File

@ -21,14 +21,14 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE. // THE SOFTWARE.
#if os(iOS) || os(tvOS) #if canImport(UIKit)
import UIKit import UIKit
#else #else
import AppKit import AppKit
#endif #endif
#if os(iOS) || os(tvOS) #if canImport(UIKit)
@available(iOS 8.0, *) @available(iOS 8.0, *)
public typealias ConstraintLayoutSupport = UILayoutSupport public typealias ConstraintLayoutSupport = UILayoutSupport
#else #else

View File

@ -21,7 +21,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE. // THE SOFTWARE.
#if os(iOS) || os(tvOS) #if canImport(UIKit)
import UIKit import UIKit
#else #else
import AppKit import AppKit

View File

@ -21,7 +21,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE. // THE SOFTWARE.
#if os(iOS) || os(tvOS) #if canImport(UIKit)
import UIKit import UIKit
#else #else
import AppKit import AppKit

View File

@ -21,7 +21,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE. // THE SOFTWARE.
#if os(iOS) || os(tvOS) #if canImport(UIKit)
import UIKit import UIKit
#else #else
import AppKit import AppKit
@ -53,7 +53,7 @@ public class ConstraintMakerEditable: ConstraintMakerPrioritizable {
return self return self
} }
#if os(iOS) || os(tvOS) #if canImport(UIKit)
@discardableResult @discardableResult
@available(iOS 11.0, tvOS 11.0, *) @available(iOS 11.0, tvOS 11.0, *)
public func inset(_ amount: ConstraintDirectionalInsetTarget) -> ConstraintMakerEditable { public func inset(_ amount: ConstraintDirectionalInsetTarget) -> ConstraintMakerEditable {

View File

@ -21,7 +21,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE. // THE SOFTWARE.
#if os(iOS) || os(tvOS) #if canImport(UIKit)
import UIKit import UIKit
#else #else
import AppKit import AppKit

View File

@ -21,7 +21,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE. // THE SOFTWARE.
#if os(iOS) || os(tvOS) #if canImport(UIKit)
import UIKit import UIKit
#else #else
import AppKit import AppKit

View File

@ -21,7 +21,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE. // THE SOFTWARE.
#if os(iOS) || os(tvOS) #if canImport(UIKit)
import UIKit import UIKit
#else #else
import AppKit import AppKit

View File

@ -21,7 +21,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE. // THE SOFTWARE.
#if os(iOS) || os(tvOS) #if canImport(UIKit)
import UIKit import UIKit
#else #else
import AppKit import AppKit

View File

@ -21,7 +21,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE. // THE SOFTWARE.
#if os(iOS) || os(tvOS) #if canImport(UIKit)
import UIKit import UIKit
#else #else
import AppKit import AppKit

View File

@ -21,7 +21,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE. // THE SOFTWARE.
#if os(iOS) || os(tvOS) #if canImport(UIKit)
import UIKit import UIKit
#else #else
import AppKit import AppKit

View File

@ -21,7 +21,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE. // THE SOFTWARE.
#if os(iOS) || os(tvOS) #if canImport(UIKit)
import UIKit import UIKit
#else #else
import AppKit import AppKit

View File

@ -21,7 +21,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE. // THE SOFTWARE.
#if os(iOS) || os(tvOS) #if canImport(UIKit)
import UIKit import UIKit
#else #else
import AppKit import AppKit

View File

@ -21,7 +21,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE. // THE SOFTWARE.
#if os(iOS) || os(tvOS) #if canImport(UIKit)
import UIKit import UIKit
#else #else
import AppKit import AppKit
@ -74,7 +74,7 @@ extension CGFloat: ConstraintPriorityTarget {
} }
#if os(iOS) || os(tvOS) #if canImport(UIKit)
extension UILayoutPriority: ConstraintPriorityTarget { extension UILayoutPriority: ConstraintPriorityTarget {
public var constraintPriorityTargetValue: Float { public var constraintPriorityTargetValue: Float {

View File

@ -21,7 +21,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE. // THE SOFTWARE.
#if os(iOS) || os(tvOS) #if canImport(UIKit)
import UIKit import UIKit
#else #else
import AppKit import AppKit
@ -55,7 +55,7 @@ extension CGPoint: ConstraintRelatableTarget {
extension ConstraintInsets: ConstraintRelatableTarget { extension ConstraintInsets: ConstraintRelatableTarget {
} }
#if os(iOS) || os(tvOS) #if canImport(UIKit)
@available(iOS 11.0, tvOS 11.0, *) @available(iOS 11.0, tvOS 11.0, *)
extension ConstraintDirectionalInsets: ConstraintRelatableTarget { extension ConstraintDirectionalInsets: ConstraintRelatableTarget {
} }

View File

@ -21,7 +21,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE. // THE SOFTWARE.
#if os(iOS) || os(tvOS) #if canImport(UIKit)
import UIKit import UIKit
#else #else
import AppKit import AppKit

View File

@ -21,7 +21,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE. // THE SOFTWARE.
#if os(iOS) || os(tvOS) #if canImport(UIKit)
import UIKit import UIKit
#else #else
import AppKit import AppKit

View File

@ -21,14 +21,14 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE. // THE SOFTWARE.
#if os(iOS) || os(tvOS) #if canImport(UIKit)
import UIKit import UIKit
#else #else
import AppKit import AppKit
#endif #endif
#if os(iOS) || os(tvOS) #if canImport(UIKit)
public typealias ConstraintView = UIView public typealias ConstraintView = UIView
#else #else
public typealias ConstraintView = NSView public typealias ConstraintView = NSView

View File

@ -21,7 +21,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE. // THE SOFTWARE.
#if os(iOS) || os(tvOS) #if canImport(UIKit)
import UIKit import UIKit
#else #else
import AppKit import AppKit

View File

@ -21,7 +21,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE. // THE SOFTWARE.
#if os(iOS) || os(tvOS) #if canImport(UIKit)
import UIKit import UIKit
#else #else
import AppKit import AppKit
@ -89,7 +89,7 @@ private func descriptionForRelation(_ relation: LayoutRelation) -> String {
} }
private func descriptionForAttribute(_ attribute: LayoutAttribute) -> String { private func descriptionForAttribute(_ attribute: LayoutAttribute) -> String {
#if os(iOS) || os(tvOS) #if canImport(UIKit)
switch attribute { switch attribute {
case .notAnAttribute: return "notAnAttribute" case .notAnAttribute: return "notAnAttribute"
case .top: return "top" case .top: return "top"

View File

@ -21,7 +21,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE. // THE SOFTWARE.
#if os(iOS) || os(tvOS) #if canImport(UIKit)
import UIKit import UIKit
#else #else
import AppKit import AppKit

View File

@ -21,7 +21,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE. // THE SOFTWARE.
#if os(iOS) || os(tvOS) #if canImport(UIKit)
import UIKit import UIKit
#else #else
import AppKit import AppKit

View File

@ -23,7 +23,7 @@
import Foundation import Foundation
#if os(iOS) || os(tvOS) #if canImport(UIKit)
import UIKit import UIKit
#if swift(>=4.2) #if swift(>=4.2)
typealias LayoutRelation = NSLayoutConstraint.Relation typealias LayoutRelation = NSLayoutConstraint.Relation

View File

@ -21,7 +21,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE. // THE SOFTWARE.
#if os(iOS) || os(tvOS) #if canImport(UIKit)
import UIKit import UIKit
#endif #endif

View File

@ -1,4 +1,4 @@
#if os(iOS) || os(tvOS) #if canImport(UIKit)
import UIKit import UIKit
typealias View = UIView typealias View = UIView
extension View { extension View {
@ -453,7 +453,7 @@ class SnapKitTests: XCTestCase {
XCTAssertEqual(constraints[3].constant, -25, "Should be -25") XCTAssertEqual(constraints[3].constant, -25, "Should be -25")
} }
#if os(iOS) || os(tvOS) #if canImport(UIKit)
@available(iOS 11.0, tvOS 11.0, *) @available(iOS 11.0, tvOS 11.0, *)
func testConstraintDirectionalInsetsAsImpliedEqualToConstraints() { func testConstraintDirectionalInsetsAsImpliedEqualToConstraints() {
let view = View() let view = View()
@ -481,7 +481,7 @@ class SnapKitTests: XCTestCase {
} }
#endif #endif
#if os(iOS) || os(tvOS) #if canImport(UIKit)
@available(iOS 11.0, tvOS 11.0, *) @available(iOS 11.0, tvOS 11.0, *)
func testConstraintDirectionalInsetsAsConstraintsConstant() { func testConstraintDirectionalInsetsAsConstraintsConstant() {
let view = View() let view = View()
@ -509,7 +509,7 @@ class SnapKitTests: XCTestCase {
} }
#endif #endif
#if os(iOS) || os(tvOS) #if canImport(UIKit)
@available(iOS 11.0, tvOS 11.0, *) @available(iOS 11.0, tvOS 11.0, *)
func testConstraintDirectionalInsetsFallBackForNonDirectionalConstraints() { func testConstraintDirectionalInsetsFallBackForNonDirectionalConstraints() {
let view = View() let view = View()
@ -638,7 +638,7 @@ class SnapKitTests: XCTestCase {
XCTAssert(toAttributes == [.top, .leading, .bottom, .trailing]) XCTAssert(toAttributes == [.top, .leading, .bottom, .trailing])
} }
#if os(iOS) || os(tvOS) #if canImport(UIKit)
func testEdgesToMargins() { func testEdgesToMargins() {
var fromAttributes = Set<LayoutAttribute>() var fromAttributes = Set<LayoutAttribute>()
var toAttributes = Set<LayoutAttribute>() var toAttributes = Set<LayoutAttribute>()