Skip to content

Commit

Permalink
Change pod dependencies SwiftUI and Combine to weak to ensure c…
Browse files Browse the repository at this point in the history
…ompatibility with iOS 12 (airbnb#2219)
  • Loading branch information
florianrhein authored and Igor Moroz committed May 22, 2024
1 parent abc6306 commit 0aed8ae
Show file tree
Hide file tree
Showing 17 changed files with 31 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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`.
Expand Down Expand Up @@ -387,5 +386,4 @@ struct EpoxyHostingWrapper<Content: View>: View {
.environment(\.epoxyIntrinsicContentSizeInvalidator, environment.intrinsicContentSizeInvalidator)
}
}

#endif
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -42,3 +43,4 @@ extension EnvironmentValues {
private struct EpoxyIntrinsicContentSizeInvalidatorKey: EnvironmentKey {
static let defaultValue = EpoxyIntrinsicContentSizeInvalidator(invalidate: { })
}
#endif
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -49,3 +50,4 @@ private struct EpoxyLayoutMarginsPadding: ViewModifier {
content.padding(epoxyLayoutMargins)
}
}
#endif
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -170,3 +171,4 @@ extension StyledView
}
}
}
#endif
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -126,3 +127,4 @@ extension MeasuringViewRepresentable {
#endif
}
#endif
#endif
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -450,3 +451,4 @@ extension CGSize {
height: height == ViewType.noIntrinsicMetric ? fallback.height : height)
}
}
#endif
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -146,3 +147,4 @@ extension SwiftUIView {
fileprivate(set) var storage: Storage
}
}
#endif
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -38,3 +39,4 @@ protocol ViewTypeProtocol: ViewType { }
// MARK: - ViewType + ViewTypeProtocol

extension ViewType: ViewTypeProtocol { }
#endif
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -41,3 +42,4 @@ extension UIViewConfiguringSwiftUIView {
return copy
}
}
#endif
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -49,3 +49,4 @@ extension ViewRepresentableType {
typealias RepresentableViewType = NSViewType
}
#endif
#endif
2 changes: 2 additions & 0 deletions Sources/Private/Utility/Helpers/Binding+Map.swift
Original file line number Diff line number Diff line change
@@ -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, *)
Expand All @@ -16,3 +17,4 @@ extension Binding {
}
}
}
#endif
2 changes: 2 additions & 0 deletions Sources/Private/Utility/Helpers/View+ValueChanged.swift
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -18,3 +19,4 @@ extension View {
}
}
}
#endif
2 changes: 2 additions & 0 deletions Sources/Public/Animation/LottieView.swift
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -480,3 +481,4 @@ public struct LottieView<Placeholder: View>: UIViewConfiguringSwiftUIView {
loadAnimationIfNecessary()
}
}
#endif
3 changes: 2 additions & 1 deletion Sources/Public/Controls/LottieButton.swift
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -118,5 +119,5 @@ public struct LottieButton: UIViewConfiguringSwiftUIView {
private let animation: LottieAnimation?
private let action: () -> Void
private var configuration: LottieConfiguration = .shared

}
#endif
2 changes: 2 additions & 0 deletions Sources/Public/Controls/LottieSwitch.swift
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -142,3 +143,4 @@ public struct LottieSwitch: UIViewConfiguringSwiftUIView {
private var isOn: Binding<Bool>?

}
#endif
1 change: 1 addition & 0 deletions lottie-ios.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 0aed8ae

Please sign in to comment.