diff --git a/Sources/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/EpoxySwiftUIHostingController.swift b/Sources/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/EpoxySwiftUIHostingController.swift index e303814217..10e99a956a 100644 --- a/Sources/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/EpoxySwiftUIHostingController.swift +++ b/Sources/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/EpoxySwiftUIHostingController.swift @@ -1,9 +1,9 @@ // Created by eric_horacek on 10/8/21. // Copyright © 2021 Airbnb Inc. All rights reserved. +#if canImport(SwiftUI) && !os(macOS) import SwiftUI -#if !os(macOS) // MARK: - EpoxySwiftUIUIHostingController /// A `UIHostingController` that hosts SwiftUI views within an Epoxy container, e.g. an Epoxy diff --git a/Sources/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/EpoxySwiftUIHostingView.swift b/Sources/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/EpoxySwiftUIHostingView.swift index 44bcaf4b39..c1b8c52790 100644 --- a/Sources/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/EpoxySwiftUIHostingView.swift +++ b/Sources/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/EpoxySwiftUIHostingView.swift @@ -1,11 +1,10 @@ // Created by eric_horacek on 9/16/21. // Copyright © 2021 Airbnb Inc. All rights reserved. +#if canImport(Combine) && canImport(SwiftUI) && !os(macOS) import Combine import SwiftUI -#if !os(macOS) - // MARK: - SwiftUIHostingViewReuseBehavior /// The reuse behavior of an `EpoxySwiftUIHostingView`. @@ -387,5 +386,4 @@ struct EpoxyHostingWrapper: View { .environment(\.epoxyIntrinsicContentSizeInvalidator, environment.intrinsicContentSizeInvalidator) } } - #endif diff --git a/Sources/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/EpoxySwiftUIIntrinsicContentSizeInvalidator.swift b/Sources/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/EpoxySwiftUIIntrinsicContentSizeInvalidator.swift index 928d0c63a8..47ebde44b4 100644 --- a/Sources/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/EpoxySwiftUIIntrinsicContentSizeInvalidator.swift +++ b/Sources/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/EpoxySwiftUIIntrinsicContentSizeInvalidator.swift @@ -1,6 +1,7 @@ // Created by matthew_cheok on 11/19/21. // Copyright © 2021 Airbnb Inc. All rights reserved. +#if canImport(SwiftUI) import SwiftUI // MARK: - EpoxyIntrinsicContentSizeInvalidator @@ -42,3 +43,4 @@ extension EnvironmentValues { private struct EpoxyIntrinsicContentSizeInvalidatorKey: EnvironmentKey { static let defaultValue = EpoxyIntrinsicContentSizeInvalidator(invalidate: { }) } +#endif diff --git a/Sources/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/EpoxySwiftUILayoutMargins.swift b/Sources/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/EpoxySwiftUILayoutMargins.swift index c997a64837..44fc83fbac 100644 --- a/Sources/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/EpoxySwiftUILayoutMargins.swift +++ b/Sources/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/EpoxySwiftUILayoutMargins.swift @@ -1,6 +1,7 @@ // Created by eric_horacek on 10/8/21. // Copyright © 2021 Airbnb Inc. All rights reserved. +#if canImport(SwiftUI) import SwiftUI // MARK: - View @@ -49,3 +50,4 @@ private struct EpoxyLayoutMarginsPadding: ViewModifier { content.padding(epoxyLayoutMargins) } } +#endif diff --git a/Sources/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/EpoxyableView+SwiftUIView.swift b/Sources/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/EpoxyableView+SwiftUIView.swift index 4c263297d3..06febc2cc4 100644 --- a/Sources/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/EpoxyableView+SwiftUIView.swift +++ b/Sources/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/EpoxyableView+SwiftUIView.swift @@ -1,6 +1,7 @@ // Created by eric_horacek on 9/13/21. // Copyright © 2021 Airbnb Inc. All rights reserved. +#if canImport(SwiftUI) import SwiftUI // MARK: - StyledView @@ -170,3 +171,4 @@ extension StyledView } } } +#endif diff --git a/Sources/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/LayoutUtilities/MeasuringViewRepresentable.swift b/Sources/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/LayoutUtilities/MeasuringViewRepresentable.swift index 1dc33afab9..065aaa7104 100644 --- a/Sources/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/LayoutUtilities/MeasuringViewRepresentable.swift +++ b/Sources/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/LayoutUtilities/MeasuringViewRepresentable.swift @@ -1,6 +1,7 @@ // Created by eric_horacek on 6/22/22. // Copyright © 2022 Airbnb Inc. All rights reserved. +#if canImport(SwiftUI) import SwiftUI // MARK: - MeasuringViewRepresentable @@ -126,3 +127,4 @@ extension MeasuringViewRepresentable { #endif } #endif +#endif diff --git a/Sources/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/LayoutUtilities/SwiftUIMeasurementContainer.swift b/Sources/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/LayoutUtilities/SwiftUIMeasurementContainer.swift index 2bef72e5a5..5dcf7b2217 100644 --- a/Sources/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/LayoutUtilities/SwiftUIMeasurementContainer.swift +++ b/Sources/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/LayoutUtilities/SwiftUIMeasurementContainer.swift @@ -1,6 +1,7 @@ // Created by Bryn Bodayle on 1/24/22. // Copyright © 2022 Airbnb Inc. All rights reserved. +#if canImport(SwiftUI) import SwiftUI // MARK: - SwiftUIMeasurementContainer @@ -450,3 +451,4 @@ extension CGSize { height: height == ViewType.noIntrinsicMetric ? fallback.height : height) } } +#endif diff --git a/Sources/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/SwiftUIView.swift b/Sources/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/SwiftUIView.swift index 69c2b4fe80..8be06f2893 100644 --- a/Sources/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/SwiftUIView.swift +++ b/Sources/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/SwiftUIView.swift @@ -1,6 +1,7 @@ // Created by eric_horacek on 9/8/22. // Copyright © 2022 Airbnb Inc. All rights reserved. +#if canImport(SwiftUI) import SwiftUI // MARK: - SwiftUIView @@ -146,3 +147,4 @@ extension SwiftUIView { fileprivate(set) var storage: Storage } } +#endif diff --git a/Sources/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/UIView+SwiftUIView.swift b/Sources/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/UIView+SwiftUIView.swift index 4c3a12907f..4984ea0d08 100644 --- a/Sources/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/UIView+SwiftUIView.swift +++ b/Sources/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/UIView+SwiftUIView.swift @@ -1,6 +1,7 @@ // Created by eric_horacek on 3/3/22. // Copyright © 2022 Airbnb Inc. All rights reserved. +#if canImport(SwiftUI) import SwiftUI // MARK: - ViewTypeProtocol + swiftUIView @@ -38,3 +39,4 @@ protocol ViewTypeProtocol: ViewType { } // MARK: - ViewType + ViewTypeProtocol extension ViewType: ViewTypeProtocol { } +#endif diff --git a/Sources/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/UIViewConfiguringSwiftUIView.swift b/Sources/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/UIViewConfiguringSwiftUIView.swift index 119cefb989..7a2405823c 100644 --- a/Sources/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/UIViewConfiguringSwiftUIView.swift +++ b/Sources/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/UIViewConfiguringSwiftUIView.swift @@ -1,6 +1,7 @@ // Created by eric_horacek on 3/4/22. // Copyright © 2022 Airbnb Inc. All rights reserved. +#if canImport(SwiftUI) import SwiftUI // MARK: - UIViewConfiguringSwiftUIView @@ -41,3 +42,4 @@ extension UIViewConfiguringSwiftUIView { return copy } } +#endif diff --git a/Sources/Private/EmbeddedLibraries/EpoxyCore/Views/ViewType.swift b/Sources/Private/EmbeddedLibraries/EpoxyCore/Views/ViewType.swift index 753e3137b9..c673d28746 100644 --- a/Sources/Private/EmbeddedLibraries/EpoxyCore/Views/ViewType.swift +++ b/Sources/Private/EmbeddedLibraries/EpoxyCore/Views/ViewType.swift @@ -1,8 +1,8 @@ // Created by Cal Stephens on 6/26/23. // Copyright © 2023 Airbnb Inc. All rights reserved. +#if canImport(SwiftUI) import SwiftUI - #if canImport(UIKit) import UIKit @@ -49,3 +49,4 @@ extension ViewRepresentableType { typealias RepresentableViewType = NSViewType } #endif +#endif diff --git a/Sources/Private/Utility/Helpers/Binding+Map.swift b/Sources/Private/Utility/Helpers/Binding+Map.swift index 6c657bff19..5dba75478a 100644 --- a/Sources/Private/Utility/Helpers/Binding+Map.swift +++ b/Sources/Private/Utility/Helpers/Binding+Map.swift @@ -1,6 +1,7 @@ // Created by miguel_jimenez on 7/27/23. // Copyright © 2023 Airbnb Inc. All rights reserved. +#if canImport(SwiftUI) import SwiftUI @available(iOS 13.0, tvOS 13.0, macOS 10.15, *) @@ -16,3 +17,4 @@ extension Binding { } } } +#endif diff --git a/Sources/Private/Utility/Helpers/View+ValueChanged.swift b/Sources/Private/Utility/Helpers/View+ValueChanged.swift index 2341297fae..68d6a86a35 100644 --- a/Sources/Private/Utility/Helpers/View+ValueChanged.swift +++ b/Sources/Private/Utility/Helpers/View+ValueChanged.swift @@ -1,6 +1,7 @@ // Created by miguel_jimenez on 7/26/23. // Copyright © 2023 Airbnb Inc. All rights reserved. +#if canImport(Combine) && canImport(SwiftUI) import Combine import SwiftUI @@ -18,3 +19,4 @@ extension View { } } } +#endif diff --git a/Sources/Public/Animation/LottieView.swift b/Sources/Public/Animation/LottieView.swift index 68dbaa2c0b..39482eb44e 100644 --- a/Sources/Public/Animation/LottieView.swift +++ b/Sources/Public/Animation/LottieView.swift @@ -1,6 +1,7 @@ // Created by Bryn Bodayle on 1/20/22. // Copyright © 2022 Airbnb Inc. All rights reserved. +#if canImport(SwiftUI) import SwiftUI // MARK: - LottieView @@ -480,3 +481,4 @@ public struct LottieView: UIViewConfiguringSwiftUIView { loadAnimationIfNecessary() } } +#endif diff --git a/Sources/Public/Controls/LottieButton.swift b/Sources/Public/Controls/LottieButton.swift index bb8ac2ce09..577f9db432 100644 --- a/Sources/Public/Controls/LottieButton.swift +++ b/Sources/Public/Controls/LottieButton.swift @@ -1,6 +1,7 @@ // Created by Cal Stephens on 8/14/23. // Copyright © 2023 Airbnb Inc. All rights reserved. +#if canImport(SwiftUI) import SwiftUI /// A wrapper which exposes Lottie's `AnimatedButton` to SwiftUI @@ -118,5 +119,5 @@ public struct LottieButton: UIViewConfiguringSwiftUIView { private let animation: LottieAnimation? private let action: () -> Void private var configuration: LottieConfiguration = .shared - } +#endif diff --git a/Sources/Public/Controls/LottieSwitch.swift b/Sources/Public/Controls/LottieSwitch.swift index ff328e3c15..ffb026955c 100644 --- a/Sources/Public/Controls/LottieSwitch.swift +++ b/Sources/Public/Controls/LottieSwitch.swift @@ -1,6 +1,7 @@ // Created by Cal Stephens on 8/11/23. // Copyright © 2023 Airbnb Inc. All rights reserved. +#if canImport(SwiftUI) import SwiftUI /// A wrapper which exposes Lottie's `AnimatedSwitch` to SwiftUI @@ -142,3 +143,4 @@ public struct LottieSwitch: UIViewConfiguringSwiftUIView { private var isOn: Binding? } +#endif diff --git a/lottie-ios.podspec b/lottie-ios.podspec index aedf9c145f..f347b61143 100644 --- a/lottie-ios.podspec +++ b/lottie-ios.podspec @@ -36,5 +36,6 @@ Lottie enables designers to create and ship beautiful animations without an engi s.ios.frameworks = ['UIKit', 'CoreGraphics', 'QuartzCore'] s.tvos.frameworks = ['UIKit', 'CoreGraphics', 'QuartzCore'] s.osx.frameworks = ['AppKit', 'CoreGraphics', 'QuartzCore'] + s.weak_frameworks = ['SwiftUI', 'Combine'] s.module_name = 'Lottie' end