Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conditionally import swift ui #26

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if canImport(SwiftUI)
import SwiftUI

@available(iOS 13.0, macOS 10.15, macCatalyst 13, tvOS 13.0, watchOS 6.0, *)
Expand Down Expand Up @@ -29,3 +30,4 @@ extension LocalizedStringKey: CustomDebugOutputConvertible {
self.formatted().debugDescription
}
}
#endif
2 changes: 2 additions & 0 deletions Sources/ComposableArchitecture/SwiftUI/ActionSheet.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if canImport(SwiftUI)
import SwiftUI

/// A data type that describes the state of an action sheet that can be shown to the user. The
Expand Down Expand Up @@ -221,3 +222,4 @@ extension ActionSheetState {
)
}
}
#endif
2 changes: 2 additions & 0 deletions Sources/ComposableArchitecture/SwiftUI/Alert.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if canImport(SwiftUI)
import SwiftUI

/// A data type that describes the state of an alert that can be shown to the user. The `Action`
Expand Down Expand Up @@ -298,3 +299,4 @@ extension AlertState {
}
}
}
#endif
2 changes: 2 additions & 0 deletions Sources/ComposableArchitecture/SwiftUI/ForEachStore.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if canImport(SwiftUI)
import SwiftUI

/// A structure that computes views on demand from a store on a collection of data.
Expand Down Expand Up @@ -119,3 +120,4 @@ where Data: Collection, ID: Hashable, Content: View {
self.content()
}
}
#endif
2 changes: 2 additions & 0 deletions Sources/ComposableArchitecture/SwiftUI/IfLetStore.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if canImport(SwiftUI)
import SwiftUI

/// A view that safely unwraps a store of optional state in order to show one of two views.
Expand Down Expand Up @@ -83,3 +84,4 @@ public struct IfLetStore<State, Action, Content>: View where Content: View {
)
}
}
#endif
2 changes: 2 additions & 0 deletions Sources/ComposableArchitecture/SwiftUI/WithViewStore.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if canImport(Combine) && canImport(SwiftUI)
import Combine
import SwiftUI

Expand Down Expand Up @@ -105,3 +106,4 @@ extension WithViewStore: DynamicViewContent where State: Collection, Content: Dy
self.viewStore.state
}
}
#endif