From 9fc2dd2bf706e39f7241c00c1ffa69883d11a302 Mon Sep 17 00:00:00 2001 From: Diogo Autilio Date: Sun, 22 Sep 2024 17:14:13 -0300 Subject: [PATCH] Fix compilation issues for tvOS --- Sources/SketchKit/Constrainable.swift | 2 ++ Sources/SketchKit/KeyboardLayoutGuide.swift | 2 ++ Sources/SketchKit/SketchKitDSL.swift | 2 ++ 3 files changed, 6 insertions(+) diff --git a/Sources/SketchKit/Constrainable.swift b/Sources/SketchKit/Constrainable.swift index 734140d..4f4e7e6 100644 --- a/Sources/SketchKit/Constrainable.swift +++ b/Sources/SketchKit/Constrainable.swift @@ -55,9 +55,11 @@ extension View: Constrainable { } /// A layout guide that dynamically adjusts to the keyboard's frame. +#if os(iOS) public var keyboardLayout: LayoutGuide { return SketchKitDSL(constrainable: self).resolveKeyboardLayoutGuide() } +#endif } /// LayoutGuide is an abstraction of Apple layout system diff --git a/Sources/SketchKit/KeyboardLayoutGuide.swift b/Sources/SketchKit/KeyboardLayoutGuide.swift index 55b1076..d6e1d74 100644 --- a/Sources/SketchKit/KeyboardLayoutGuide.swift +++ b/Sources/SketchKit/KeyboardLayoutGuide.swift @@ -6,6 +6,7 @@ // Copyright (c) 2021 Anykey Entertrainment. All rights reserved. // +#if os(iOS) import Foundation import UIKit @@ -139,3 +140,4 @@ extension Notification { return self.userInfo?[UIResponder.keyboardAnimationDurationUserInfoKey] as? CGFloat } } +#endif diff --git a/Sources/SketchKit/SketchKitDSL.swift b/Sources/SketchKit/SketchKitDSL.swift index 18c5a9f..b659ed7 100644 --- a/Sources/SketchKit/SketchKitDSL.swift +++ b/Sources/SketchKit/SketchKitDSL.swift @@ -56,6 +56,7 @@ public class SketchKitDSL { block(self.constrainable) } +#if os(iOS) func resolveKeyboardLayoutGuide() -> LayoutGuide { guard let view = constrainable as? View else { return LayoutGuide() } @@ -74,4 +75,5 @@ public class SketchKitDSL { return keyboardLayoutGuide } +#endif }