diff --git a/Packages/ShapsBenkau_SwiftUIBackports/.gitignore b/Packages/ShapsBenkau_SwiftUIBackports/.gitignore
deleted file mode 100755
index 3b298120..00000000
--- a/Packages/ShapsBenkau_SwiftUIBackports/.gitignore
+++ /dev/null
@@ -1,9 +0,0 @@
-.DS_Store
-/.build
-/Packages
-/*.xcodeproj
-xcuserdata/
-DerivedData/
-.swiftpm/config/registries.json
-.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
-.netrc
diff --git a/Packages/ShapsBenkau_SwiftUIBackports/.spi.yml b/Packages/ShapsBenkau_SwiftUIBackports/.spi.yml
deleted file mode 100755
index ac7ecfd8..00000000
--- a/Packages/ShapsBenkau_SwiftUIBackports/.spi.yml
+++ /dev/null
@@ -1,5 +0,0 @@
-version: 1.8.2
-builder:
- configs:
- - platform: ios
- documentation_targets: [SwiftUIBackports]
\ No newline at end of file
diff --git a/Packages/ShapsBenkau_SwiftUIBackports/LICENSE.md b/Packages/ShapsBenkau_SwiftUIBackports/LICENSE.md
deleted file mode 100755
index 129722a6..00000000
--- a/Packages/ShapsBenkau_SwiftUIBackports/LICENSE.md
+++ /dev/null
@@ -1,9 +0,0 @@
-MIT License
-
-Copyright (c) 2021 Shaps Benkau
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\ No newline at end of file
diff --git a/Packages/ShapsBenkau_SwiftUIBackports/Package.swift b/Packages/ShapsBenkau_SwiftUIBackports/Package.swift
deleted file mode 100755
index 823340bc..00000000
--- a/Packages/ShapsBenkau_SwiftUIBackports/Package.swift
+++ /dev/null
@@ -1,22 +0,0 @@
-// swift-tools-version:5.3
-import PackageDescription
-
-let package = Package(
- name: "SwiftUIBackports",
- platforms: [
- .iOS(.v13),
- .tvOS(.v13),
- .watchOS(.v6),
- .macOS(.v10_11),
- ],
- products: [
- .library(
- name: "SwiftUIBackports",
- targets: ["SwiftUIBackports"]
- ),
- ],
- targets: [
- .target(name: "SwiftUIBackports"),
- ],
- swiftLanguageVersions: [.v5]
-)
diff --git a/Packages/ShapsBenkau_SwiftUIBackports/README.md b/Packages/ShapsBenkau_SwiftUIBackports/README.md
deleted file mode 100755
index 0b3eb879..00000000
--- a/Packages/ShapsBenkau_SwiftUIBackports/README.md
+++ /dev/null
@@ -1,131 +0,0 @@
-## NOTICE
-
-- This package copy is clang-formatted according to vChewing's clang-format style, with removal of certain dependencies / features not-required by vChewing.
-- **If you want to use this package**, you might want to consult its original repository: https://github.com/shaps80/SwiftUIBackports
-
-
-
-
-
-[](https://swiftpackageindex.com/shaps80/SwiftUIBackports)
-
-# SwiftUI Backports
-
-Introducing a collection of SwiftUI backports to make your iOS development easier.
-
-Many backports support iOS 13+ but where UIKIt features were introduced in later versions, the same will be applicable to these backports, to keep parity with UIKit.
-
-In some cases, I've also included additional APIs that bring more features to your SwiftUI development.
-
-> Note, **all** backports will be API-matching to Apple's offical APIs, any additional features will be provided separately.
-
-All backports are fully documented, in most cases using Apple's own documentation for consistency. Please refer to the header docs or Apple's original documentation for more details.
-
-There is also a [Demo project](https://github.com/shaps80/SwiftUIBackportsDemo) available where you can see full demonstrations of all backports and additional features, including reference code to help you get started.
-
-> Lastly, I hope this repo also serves as a great resource for _how_ you can backport effectively with minimal hacks π
-
-## Sponsor
-
-Building useful libraries like these, takes time away from my family. I build these tools in my spare time because I feel its important to give back to the community. Please consider [Sponsoring](https://github.com/sponsors/shaps80) me as it helps keep me working on useful libraries like these π¬
-
-You can also give me a follow and a 'thanks' anytime.
-
-[](http://twitter.com/shaps)
-
-## Usage
-
-The library adopts a backport design by [Dave DeLong](https://davedelong.com/blog/2021/10/09/simplifying-backwards-compatibility-in-swift/) that makes use of a single type to improve discoverability and maintainability when the time comes to remove your backport implementations, in favour of official APIs.
-
-Backports of pure types, can easily be discovered under the `Backport` namespace. Similarly, modifiers are discoverable under the `.backport` namespace.
-
-> Unfortuantely `Environment` backports cannot be access this way, in those cases the Apple API values will be prefixed with `backport` to simplify discovery.
-
-Types:
-
-```swift
-@Backport.AppStorage("filter-enabled")
-private var filterEnabled: Bool = false
-```
-
-Modifier:
-
-```swift
-Button("Show Prompt") {
- showPrompt = true
-}
-.sheet(isPresented: $showPrompt) {
- Prompt()
- .backport.presentationDetents([.medium, .large])
-}
-```
-
-Environment:
-
-```swift
-@Environment(\.backportRefresh) private var refreshAction
-```
-
-## Backports
-
-**SwiftUI**
-
-- `asyncImage`
-- `AppStorage`
-- `background` β ViewBuilder API
-- `DismissAction`
-- `DynamicTypeSize`
-β `Label`
-β `LabeledContent`
-- `NavigationDestination` β uses a standard NavigationView
-- `navigationTitle` β newer API
-- `overlay` β ViewBuilder API
-- `onChange`
-- `openURL`
-- `ProgressView`
-- `presentationDetents`
-- `presentationDragIndicator`
-- `quicklookPreview`
-- `requestReview`
-- `Refreshable` β includes pull-to-refreshΒ
-- `ScaledMetric`
-- `StateObject`
-- `scrollDisabled`
-- `scrollDismissesKeyboard`
-- `scrollIndicators`
-- `Section(_ header:)`
-- `task` β async/await modifier
-
-**UIKit**
-
-- `UIHostingConfiguration` β simplifies embedding SwiftUI in `UICollectionViewCell` and `UITableViewCell`
-
-## Extras
-
-**Modal Presentations**
-
-Adding this to your presented view, you can use the provided closure to present an `ActionSheet` to a user when they attempt to dismiss interactively. You can also use this to disable interactive dismissals entirely.
-
-```swift
-presentation(isModal: true) { /* attempt */ }
-```
-
-**FittingGeometryReader**
-
-A custom `GeometryReader` implementation that correctly auto-sizes itself to its content. This is useful in many cases where you need a `GeometryReader` but don't want it to implicitly take up its parent View's bounds.
-
-**FittingScrollView**
-
-A custom `ScrollView` that respects `Spacer`'s when the content is not scrollable. This is useful when you need to place a view at the edges of your scrollview while its content is small enough to not require scrolling. Another great use case is vertically centered content that becomes `top` aligned once the content requires scrolling.
-
-**PageView**
-
-A pure SwiftUI implementation of a page-based view, using the native `TabView` and my custom `FittingGeometryReader` to size itself correctly. Since this uses a `TabView` under-the-hood, this allows you to use the same APIs and features from that view.
-
-## Installation
-
-You can install manually (by copying the files in the `Sources` directory) or using Swift Package Manager (**preferred**)
-
-To install using Swift Package Manager, add this to the `dependencies` section of your `Package.swift` file:
-
-`.package(url: "https://github.com/shaps80/SwiftUIBackports.git", .upToNextMinor(from: "1.0.0"))`
diff --git a/Packages/ShapsBenkau_SwiftUIBackports/Sources/SwiftUIBackports/Backport.swift b/Packages/ShapsBenkau_SwiftUIBackports/Sources/SwiftUIBackports/Backport.swift
deleted file mode 100755
index 15d3115e..00000000
--- a/Packages/ShapsBenkau_SwiftUIBackports/Sources/SwiftUIBackports/Backport.swift
+++ /dev/null
@@ -1,62 +0,0 @@
-import ObjectiveC
-import SwiftUI
-
-@available(macOS 10.15, *)
-/// Provides a convenient method for backporting API,
-/// including types, functions, properties, property wrappers and more.
-///
-/// To backport a SwiftUI Label for example, you could apply the
-/// following extension:
-///
-/// extension Backport where Content == Any {
-/// public struct Label
{ }
-/// }
-///
-/// Now if we want to provide further extensions to our backport type,
-/// we need to ensure we retain the `Content == Any` generic requirement:
-///
-/// extension Backport.Label where Content == Any, Title == Text, Icon == Image {
-/// public init(_ title: S, systemName: String) { }
-/// }
-///
-/// In addition to types, we can also provide backports for properties
-/// and methods:
-///
-/// extension Backport.Label where Content: View {
-/// func onChange(of value: Value, perform action: (Value) -> Void) -> some View {
-/// // `content` provides access to the extended type
-/// content.modifier(OnChangeModifier(value, action))
-/// }
-/// }
-///
-public struct Backport {
- /// The underlying content this backport represents.
- public let content: Wrapped
-
- @available(macOS 10.15, *)
- /// Initializes a new Backport for the specified content.
- /// - Parameter content: The content (type) that's being backported
- public init(_ content: Wrapped) {
- self.content = content
- }
-}
-
-@available(macOS 10.15, *)
-public extension View {
- /// Wraps a SwiftUI `View` that can be extended to provide backport functionality.
- var backport: Backport { .init(self) }
-}
-
-@available(macOS 10.15, *)
-public extension NSObjectProtocol {
- /// Wraps an `NSObject` that can be extended to provide backport functionality.
- var backport: Backport { .init(self) }
-}
-
-@available(macOS 10.15, *)
-public extension AnyTransition {
- /// Wraps an `AnyTransition` that can be extended to provide backport functionality.
- static var backport: Backport {
- Backport(.identity)
- }
-}
diff --git a/Packages/ShapsBenkau_SwiftUIBackports/Sources/SwiftUIBackports/Extras/FittingGeometryReader.swift b/Packages/ShapsBenkau_SwiftUIBackports/Sources/SwiftUIBackports/Extras/FittingGeometryReader.swift
deleted file mode 100755
index c2fa4ec5..00000000
--- a/Packages/ShapsBenkau_SwiftUIBackports/Sources/SwiftUIBackports/Extras/FittingGeometryReader.swift
+++ /dev/null
@@ -1,52 +0,0 @@
-// (c) 2022 and onwards Shaps Benkau (MIT License).
-// ====================
-// This code is released under the MIT license (SPDX-License-Identifier: MIT)
-
-import SwiftUI
-
-@available(macOS 10.15, *)
-/// A geometry reader that automatically sizes its height to 'fit' its content.
-public struct FittingGeometryReader: View where Content: View {
- @State private var height: CGFloat = 10 // must be non-zero
- private var content: (GeometryProxy) -> Content
-
- @available(macOS 10.15, *)
- public init(@ViewBuilder content: @escaping (GeometryProxy) -> Content) {
- self.content = content
- }
-
- @available(macOS 10.15, *)
- public var body: some View {
- GeometryReader { geo in
- content(geo)
- .fixedSize(horizontal: false, vertical: true)
- .modifier(SizeModifier())
- .onPreferenceChange(SizePreferenceKey.self) {
- height = $0.height
- }
- }
- .frame(height: height)
- }
-}
-
-@available(macOS 10.15, *)
-private struct SizePreferenceKey: PreferenceKey {
- static var defaultValue: CGSize = .zero
- static func reduce(value: inout CGSize, nextValue: () -> CGSize) {
- value = nextValue()
- }
-}
-
-@available(macOS 10.15, *)
-private struct SizeModifier: ViewModifier {
- func body(content: Content) -> some View {
- content.overlay(
- GeometryReader { geo in
- Color.clear.preference(
- key: SizePreferenceKey.self,
- value: geo.size
- )
- }
- )
- }
-}
diff --git a/Packages/ShapsBenkau_SwiftUIBackports/Sources/SwiftUIBackports/Extras/FittingScrollView.swift b/Packages/ShapsBenkau_SwiftUIBackports/Sources/SwiftUIBackports/Extras/FittingScrollView.swift
deleted file mode 100755
index 1e357059..00000000
--- a/Packages/ShapsBenkau_SwiftUIBackports/Sources/SwiftUIBackports/Extras/FittingScrollView.swift
+++ /dev/null
@@ -1,37 +0,0 @@
-// (c) 2022 and onwards Shaps Benkau (MIT License).
-// ====================
-// This code is released under the MIT license (SPDX-License-Identifier: MIT)
-
-import SwiftUI
-
-@available(macOS 10.15, *)
-/// A scrollview that behaves more similarly to a `VStack` when its content size is small enough.
-public struct FittingScrollView: View {
- private let content: Content
- private let showsIndicators: Bool
-
- @available(macOS 10.15, *)
- /// A new scrollview
- /// - Parameters:
- /// - showsIndicators: If true, the scroll view will show indicators when necessary
- /// - content: The content for this scroll view
- public init(showsIndicators: Bool = true, @ViewBuilder content: () -> Content) {
- self.showsIndicators = showsIndicators
- self.content = content()
- }
-
- @available(macOS 10.15, *)
- public var body: some View {
- GeometryReader { geo in
- SwiftUI.ScrollView(showsIndicators: showsIndicators) {
- VStack(spacing: 10) {
- content
- }
- .frame(
- maxWidth: geo.size.width,
- minHeight: geo.size.height
- )
- }
- }
- }
-}
diff --git a/Packages/ShapsBenkau_SwiftUIBackports/Sources/SwiftUIBackports/Extras/Presenatation+Deprecations.swift b/Packages/ShapsBenkau_SwiftUIBackports/Sources/SwiftUIBackports/Extras/Presenatation+Deprecations.swift
deleted file mode 100755
index 847cb2d3..00000000
--- a/Packages/ShapsBenkau_SwiftUIBackports/Sources/SwiftUIBackports/Extras/Presenatation+Deprecations.swift
+++ /dev/null
@@ -1,47 +0,0 @@
-// (c) 2022 and onwards Shaps Benkau (MIT License).
-// ====================
-// This code is released under the MIT license (SPDX-License-Identifier: MIT)
-
-import SwiftUI
-
-@available(macOS 10.15, *)
-@available(tvOS, deprecated: 13)
-@available(macOS, deprecated: 10.15)
-@available(watchOS, deprecated: 6)
-extension View {
- /// Sets whether this presentation should act as a `modal`, preventing interactive dismissals
- /// - Parameter isModal: If `true` the user will not be able to interactively dismiss
- @ViewBuilder
- @available(iOS, deprecated: 13, renamed: "backport.interactiveDismissDisabled(_:)")
- public func presentation(isModal: Bool) -> some View {
- #if os(iOS)
- if #available(iOS 15, *) {
- backport.interactiveDismissDisabled(isModal)
- } else {
- self
- }
- #else
- self
- #endif
- }
-
- @available(macOS 10.15, *)
- /// Provides fine-grained control over the dismissal.
- /// - Parameters:
- /// - isModal: If `true`, the user will not be able to interactively dismiss
- /// - onAttempt: A closure that will be called when an interactive dismiss attempt occurs.
- /// You can use this as an opportunity to present an ActionSheet to prompt the user.
- @ViewBuilder
- @available(iOS, deprecated: 13, renamed: "backport.interactiveDismissDisabled(_:onAttempt:)")
- public func presentation(isModal: Bool = true, _ onAttempt: @escaping () -> Void) -> some View {
- #if os(iOS)
- if #available(iOS 15, *) {
- backport.interactiveDismissDisabled(isModal, onAttempt: onAttempt)
- } else {
- self
- }
- #else
- self
- #endif
- }
-}
diff --git a/Packages/ShapsBenkau_SwiftUIBackports/Sources/SwiftUIBackports/Internal/Environment+String.swift b/Packages/ShapsBenkau_SwiftUIBackports/Sources/SwiftUIBackports/Internal/Environment+String.swift
deleted file mode 100755
index 1635fc45..00000000
--- a/Packages/ShapsBenkau_SwiftUIBackports/Sources/SwiftUIBackports/Internal/Environment+String.swift
+++ /dev/null
@@ -1,152 +0,0 @@
-// (c) 2022 and onwards Shaps Benkau (MIT License).
-// ====================
-// This code is released under the MIT license (SPDX-License-Identifier: MIT)
-
-import SwiftUI
-
-@available(macOS 10.15, *)
-private extension EnvironmentValues {
- func containsValue(forKey key: String) -> Bool {
- value(forKey: key) != nil
- }
-
- func value(forKey key: String, from mirror: Mirror, as _: T.Type) -> T? {
- // Found a match
- if let value = mirror.descendant("value", "some") {
- if let typedValue = value as? T {
- print("Found value")
- return typedValue
- } else {
- print(
- "Value for key '\(key)' in the environment is of type '\(type(of: value))', but we expected '\(String(describing: T.self))'."
- )
- }
- } else {
- print(
- "Found key '\(key)' in the environment, but it doesn't have the expected structure. The type hierarchy may have changed in your SwiftUI version."
- )
- }
-
- return nil
- }
-
- /// Extracts a value from the environment by the name of its associated EnvironmentKey.
- /// Can be used to grab private environment values such as foregroundColor ("ForegroundColorKey").
- func value(forKey key: String, as _: T.Type) -> T? {
- if let mirror = value(forKey: key) as? Mirror {
- return value(forKey: key, from: mirror, as: T.self)
- } else if let value = value(forKey: key) as? T {
- return value
- } else {
- return nil
- }
- }
-
- func value(forKey key: String) -> Any? {
- func keyFromTypeName(typeName: String) -> String? {
- let expectedPrefix = "TypedElement>`
- /// TypedElement.value contains the value of the key.
- func extract(startingAt environmentNode: Any) -> Any? {
- let mirror = Mirror(reflecting: environmentNode)
-
- let typeName = String(describing: type(of: environmentNode))
- if let nodeKey = keyFromTypeName(typeName: typeName) {
- if key == nodeKey {
- return mirror
- }
- }
-
- // Environment values are stored in a doubly linked list. The "before" and "after" keys point
- // to the next environment member.
- if let linkedListMirror = mirror.superclassMirror,
- let nextNode = linkedListMirror.descendant("after", "some")
- {
- return extract(startingAt: nextNode)
- }
-
- return nil
- }
-
- let mirror = Mirror(reflecting: self)
-
- if let firstEnvironmentValue = mirror.descendant("_plist", "elements", "some") {
- if let node = extract(startingAt: firstEnvironmentValue) {
- return node
- } else {
- return nil
- }
- } else {
- return nil
- }
- }
-}
-
-@available(macOS 10.15, *)
-@propertyWrapper
-internal struct StringlyTypedEnvironment {
- final class Store: ObservableObject {
- var value: StoredValue?
- }
-
- @Environment(\.self) private var env
- @ObservedObject private var store = Store()
-
- var key: String
-
- init(key: String) {
- self.key = key
- }
-
- private(set) var wrappedValue: Value? {
- get { store.value }
- nonmutating set { store.value = newValue }
- }
-}
-
-@available(macOS 10.15, *)
-extension StringlyTypedEnvironment: DynamicProperty {
- func update() {
- wrappedValue = env.value(forKey: key, as: Value.self)
- }
-}
-
-@available(macOS 10.15, *)
-@propertyWrapper
-internal struct EnvironmentContains: DynamicProperty {
- final class Store: ObservableObject {
- var contains: Bool = false
- }
-
- @Environment(\.self) private var env
-
- var key: String
- @ObservedObject private var store = Store()
-
- init(key: String) {
- self.key = key
- }
-
- var wrappedValue: Bool {
- get { store.contains }
- nonmutating set { store.contains = newValue }
- }
-
- func update() {
- wrappedValue = env.containsValue(forKey: key)
- }
-}
diff --git a/Packages/ShapsBenkau_SwiftUIBackports/Sources/SwiftUIBackports/Internal/Environment.swift b/Packages/ShapsBenkau_SwiftUIBackports/Sources/SwiftUIBackports/Internal/Environment.swift
deleted file mode 100755
index ccd1ea17..00000000
--- a/Packages/ShapsBenkau_SwiftUIBackports/Sources/SwiftUIBackports/Internal/Environment.swift
+++ /dev/null
@@ -1,44 +0,0 @@
-// (c) 2022 and onwards Shaps Benkau (MIT License).
-// ====================
-// This code is released under the MIT license (SPDX-License-Identifier: MIT)
-
-// (c) 2022 and onwards Shaps Benkau (MIT License).
-// ====================
-// This code is released under the MIT license (SPDX-License-Identifier: MIT)
-
-import SwiftUI
-
-/*
- The following code is for debugging purposes only!
- */
-
-#if DEBUG
- @available(macOS 10.15, *)
- extension EnvironmentValues: CustomDebugStringConvertible {
- public var debugDescription: String {
- "\(self)"
- .trimmingCharacters(in: .init(["[", "]"]))
- .replacingOccurrences(of: "EnvironmentPropertyKey", with: "")
- .replacingOccurrences(of: ", ", with: "\n")
- }
- }
-
- @available(macOS 10.15, *)
- struct EnvironmentOutputModifier: ViewModifier {
- @Environment(\.self) private var environment
-
- func body(content: Content) -> some View {
- content
- .onAppear {
- print(environment.debugDescription)
- }
- }
- }
-
- @available(macOS 10.15, *)
- extension View {
- func printEnvironment() -> some View {
- modifier(EnvironmentOutputModifier())
- }
- }
-#endif
diff --git a/Packages/ShapsBenkau_SwiftUIBackports/Sources/SwiftUIBackports/Internal/Inspect+UIKit.swift b/Packages/ShapsBenkau_SwiftUIBackports/Sources/SwiftUIBackports/Internal/Inspect+UIKit.swift
deleted file mode 100755
index 5bbd97d1..00000000
--- a/Packages/ShapsBenkau_SwiftUIBackports/Sources/SwiftUIBackports/Internal/Inspect+UIKit.swift
+++ /dev/null
@@ -1,175 +0,0 @@
-// (c) 2022 and onwards Shaps Benkau (MIT License).
-// ====================
-// This code is released under the MIT license (SPDX-License-Identifier: MIT)
-
-import SwiftUI
-
-#if os(iOS)
- internal typealias PlatformView = UIView
- internal typealias PlatformViewController = UIViewController
-#elseif os(macOS)
- internal typealias PlatformView = NSView
- internal typealias PlatformViewController = NSViewController
-#endif
-
-#if os(iOS) || os(macOS)
- extension PlatformView {
- func ancestor(ofType _: ViewType.Type) -> ViewType? {
- var view = superview
-
- while let s = view {
- if let typed = s as? ViewType {
- return typed
- }
- view = s.superview
- }
-
- return nil
- }
-
- var host: PlatformView? {
- var view = superview
-
- while let s = view {
- if NSStringFromClass(type(of: s)).contains("ViewHost") {
- return s
- }
- view = s.superview
- }
-
- return nil
- }
-
- func sibling(ofType type: ViewType.Type) -> ViewType? {
- guard let superview = superview, let index = superview.subviews.firstIndex(of: self) else { return nil }
-
- var views = superview.subviews
- views.remove(at: index)
-
- for subview in views.reversed() {
- if let typed = subview.child(ofType: type) {
- return typed
- }
- }
-
- return nil
- }
-
- func child(ofType type: ViewType.Type) -> ViewType? {
- for subview in subviews {
- if let typed = subview as? ViewType {
- return typed
- } else if let typed = subview.child(ofType: type) {
- return typed
- }
- }
-
- return nil
- }
- }
-
- internal struct Inspector {
- var hostView: PlatformView
- var sourceView: PlatformView
- var sourceController: PlatformViewController
-
- func ancestor(ofType _: ViewType.Type) -> ViewType? {
- hostView.ancestor(ofType: ViewType.self)
- }
-
- func sibling(ofType _: ViewType.Type) -> ViewType? {
- hostView.sibling(ofType: ViewType.self)
- }
- }
-
- @available(macOS 10.15, *)
- extension View {
- private func inject(_ content: Wrapped) -> some View where Wrapped: View {
- overlay(content.frame(width: 0, height: 0))
- }
-
- func inspect(
- selector: @escaping (_ inspector: Inspector) -> ViewType?, customize: @escaping (ViewType) -> Void
- ) -> some View {
- inject(InspectionView(selector: selector, customize: customize))
- }
- }
-
- @available(macOS 10.15, *)
- private struct InspectionView: View {
- let selector: (Inspector) -> ViewType?
- let customize: (ViewType) -> Void
-
- var body: some View {
- Representable(parent: self)
- }
- }
-
- private class SourceView: PlatformView {
- required init() {
- super.init(frame: .zero)
- isHidden = true
- #if os(iOS)
- isUserInteractionEnabled = false
- #endif
- }
-
- @available(*, unavailable)
- required init?(coder _: NSCoder) {
- fatalError("init(coder:) has not been implemented")
- }
- }
-#endif
-
-#if os(iOS)
- extension InspectionView {
- struct Representable: UIViewRepresentable {
- let parent: InspectionView
-
- func makeUIView(context _: Context) -> UIView { .init() }
- func updateUIView(_ view: UIView, context _: Context) {
- DispatchQueue.main.async {
- guard let host = view.host else { return }
-
- let inspector = Inspector(
- hostView: host,
- sourceView: view,
- sourceController: view.parentController
- ?? view.window?.rootViewController
- ?? UIViewController()
- )
-
- guard let targetView = parent.selector(inspector) else { return }
- parent.customize(targetView)
- }
- }
- }
- }
-
-#elseif os(macOS)
- @available(macOS 10.15, *)
- extension InspectionView {
- struct Representable: NSViewRepresentable {
- let parent: InspectionView
-
- func makeNSView(context _: Context) -> NSView {
- .init(frame: .zero)
- }
-
- func updateNSView(_ view: NSView, context _: Context) {
- DispatchQueue.main.async {
- guard let host = view.host else { return }
-
- let inspector = Inspector(
- hostView: host,
- sourceView: view,
- sourceController: view.parentController ?? NSViewController(nibName: nil, bundle: nil)
- )
-
- guard let targetView = parent.selector(inspector) else { return }
- parent.customize(targetView)
- }
- }
- }
- }
-#endif
diff --git a/Packages/ShapsBenkau_SwiftUIBackports/Sources/SwiftUIBackports/Internal/OwningController.swift b/Packages/ShapsBenkau_SwiftUIBackports/Sources/SwiftUIBackports/Internal/OwningController.swift
deleted file mode 100755
index 18d52078..00000000
--- a/Packages/ShapsBenkau_SwiftUIBackports/Sources/SwiftUIBackports/Internal/OwningController.swift
+++ /dev/null
@@ -1,40 +0,0 @@
-// (c) 2022 and onwards Shaps Benkau (MIT License).
-// ====================
-// This code is released under the MIT license (SPDX-License-Identifier: MIT)
-
-#if os(iOS)
- import UIKit
-
- public extension UIView {
- var parentController: UIViewController? {
- var responder: UIResponder? = self
-
- while !(responder is UIViewController), superview != nil {
- if let next = responder?.next {
- responder = next
- }
- }
-
- return responder as? UIViewController
- }
- }
-#endif
-
-#if os(macOS)
- import AppKit
-
- @available(macOS 10.15, *)
- public extension NSView {
- var parentController: NSViewController? {
- var responder: NSResponder? = self
-
- while !(responder is NSViewController), superview != nil {
- if let next = responder?.nextResponder {
- responder = next
- }
- }
-
- return responder as? NSViewController
- }
- }
-#endif
diff --git a/Packages/ShapsBenkau_SwiftUIBackports/Sources/SwiftUIBackports/Internal/SafeArea.swift b/Packages/ShapsBenkau_SwiftUIBackports/Sources/SwiftUIBackports/Internal/SafeArea.swift
deleted file mode 100755
index 32e88e5f..00000000
--- a/Packages/ShapsBenkau_SwiftUIBackports/Sources/SwiftUIBackports/Internal/SafeArea.swift
+++ /dev/null
@@ -1,47 +0,0 @@
-// (c) 2022 and onwards Shaps Benkau (MIT License).
-// ====================
-// This code is released under the MIT license (SPDX-License-Identifier: MIT)
-
-import SwiftUI
-
-#if os(iOS) || os(tvOS)
- /*
- Since UICollectionView is not designed to support SwiftUI out of the box,
- we need to use a little trick to get the SwiftUI View's to ignore safeArea
- insets, otherwise our cell's will not always layout correctly.
- */
- extension UIHostingController {
- convenience init(rootView: Content, ignoreSafeArea: Bool) {
- self.init(rootView: rootView)
-
- if ignoreSafeArea {
- disableSafeArea()
- }
- }
-
- func disableSafeArea() {
- guard let viewClass = object_getClass(view) else { return }
-
- let viewSubclassName = String(cString: class_getName(viewClass)).appending("_IgnoreSafeArea")
- if let viewSubclass = NSClassFromString(viewSubclassName) {
- object_setClass(view, viewSubclass)
- } else {
- guard let viewClassNameUtf8 = (viewSubclassName as NSString).utf8String else { return }
- guard let viewSubclass = objc_allocateClassPair(viewClass, viewClassNameUtf8, 0) else { return }
-
- if let method = class_getInstanceMethod(UIView.self, #selector(getter: UIView.safeAreaInsets)) {
- let safeAreaInsets: @convention(block) (AnyObject) -> UIEdgeInsets = { _ in
- .zero
- }
- class_addMethod(
- viewSubclass, #selector(getter: UIView.safeAreaInsets), imp_implementationWithBlock(safeAreaInsets),
- method_getTypeEncoding(method)
- )
- }
-
- objc_registerClassPair(viewSubclass)
- object_setClass(view, viewSubclass)
- }
- }
- }
-#endif
diff --git a/Packages/ShapsBenkau_SwiftUIBackports/Sources/SwiftUIBackports/Internal/UIScene.swift b/Packages/ShapsBenkau_SwiftUIBackports/Sources/SwiftUIBackports/Internal/UIScene.swift
deleted file mode 100755
index 986471c7..00000000
--- a/Packages/ShapsBenkau_SwiftUIBackports/Sources/SwiftUIBackports/Internal/UIScene.swift
+++ /dev/null
@@ -1,15 +0,0 @@
-// (c) 2022 and onwards Shaps Benkau (MIT License).
-// ====================
-// This code is released under the MIT license (SPDX-License-Identifier: MIT)
-
-#if os(iOS)
- import UIKit
-
- extension UIApplication {
- static var activeScene: UIWindowScene? {
- shared.connectedScenes
- .first { $0.activationState == .foregroundActive }
- as? UIWindowScene
- }
- }
-#endif
diff --git a/Packages/ShapsBenkau_SwiftUIBackports/Sources/SwiftUIBackports/Shared/AppStorage/AppStorage.swift b/Packages/ShapsBenkau_SwiftUIBackports/Sources/SwiftUIBackports/Shared/AppStorage/AppStorage.swift
deleted file mode 100755
index 867d83e3..00000000
--- a/Packages/ShapsBenkau_SwiftUIBackports/Sources/SwiftUIBackports/Shared/AppStorage/AppStorage.swift
+++ /dev/null
@@ -1,408 +0,0 @@
-// (c) 2022 and onwards Shaps Benkau (MIT License).
-// ====================
-// This code is released under the MIT license (SPDX-License-Identifier: MIT)
-
-import SwiftUI
-
-@available(iOS, deprecated: 14)
-@available(macOS, deprecated: 11)
-@available(tvOS, deprecated: 14)
-@available(watchOS, deprecated: 7)
-@available(macOS 10.15, *)
-extension Backport where Wrapped == Any {
- /// A property wrapper type that reflects a value from `Store` and
- /// invalidates a view on a change in value in that store.
- @propertyWrapper
- public struct AppStorage: DynamicProperty {
- @ObservedObject
- private var _value: RefStorage
- private let commitHandler: (Value) -> Void
-
- public var wrappedValue: Value {
- get { _value.value }
- nonmutating set {
- commitHandler(newValue)
- _value.value = newValue
- }
- }
-
- public var projectedValue: Binding {
- Binding(
- get: { wrappedValue },
- set: { wrappedValue = $0 }
- )
- }
-
- private init(
- value: Value, store: UserDefaults, key: String, get: @escaping (Any?) -> Value?, set: @escaping (Value) -> Void
- ) {
- _value = RefStorage(value: value, store: store, key: key, transform: get)
- commitHandler = set
- }
- }
-}
-
-@available(macOS 10.15, *)
-public extension Backport.AppStorage {
- /// Creates a property that can read and write to a boolean user default.
- ///
- /// - Parameters:
- /// - wrappedValue: The default value if a boolean value is not specified
- /// for the given key.
- /// - key: The key to read and write the value to in the store
- /// store.
- /// - store: The store to read and write to. A value
- /// of `nil` will use the user default store from the environment.
- init(wrappedValue: Value, _ key: String, store: UserDefaults = .standard) where Value == Bool {
- let value = store.value(forKey: key) as? Value ?? wrappedValue
- self.init(
- value: value, store: store, key: key,
- get: { $0 as? Value },
- set: { store.set($0, forKey: key) }
- )
- }
-
- /// Creates a property that can read and write to an integer user default.
- ///
- /// - Parameters:
- /// - wrappedValue: The default value if an integer value is not specified
- /// for the given key.
- /// - key: The key to read and write the value to in the store
- /// store.
- /// - store: The store to read and write to. A value
- /// of `nil` will use the user default store from the environment.
- init(wrappedValue: Value, _ key: String, store: UserDefaults = .standard) where Value == Int {
- let value = store.value(forKey: key) as? Value ?? wrappedValue
- self.init(
- value: value, store: store, key: key,
- get: { $0 as? Value },
- set: { store.set($0, forKey: key) }
- )
- }
-
- /// Creates a property that can read and write to a double user default.
- ///
- /// - Parameters:
- /// - wrappedValue: The default value if a double value is not specified
- /// for the given key.
- /// - key: The key to read and write the value to in the store
- /// store.
- /// - store: The store to read and write to. A value
- /// of `nil` will use the user default store from the environment.
- init(wrappedValue: Value, _ key: String, store: UserDefaults = .standard) where Value == Double {
- let value = store.value(forKey: key) as? Value ?? wrappedValue
- self.init(
- value: value, store: store, key: key,
- get: { $0 as? Value },
- set: { store.set($0, forKey: key) }
- )
- }
-
- /// Creates a property that can read and write to a string user default.
- ///
- /// - Parameters:
- /// - wrappedValue: The default value if a string value is not specified
- /// for the given key.
- /// - key: The key to read and write the value to in the store
- /// store.
- /// - store: The store to read and write to. A value
- /// of `nil` will use the user default store from the environment.
- init(wrappedValue: Value, _ key: String, store: UserDefaults = .standard) where Value == String {
- let value = store.value(forKey: key) as? Value ?? wrappedValue
- self.init(
- value: value, store: store, key: key,
- get: { $0 as? Value },
- set: { store.set($0, forKey: key) }
- )
- }
-
- /// Creates a property that can read and write to a [string] user default.
- ///
- /// - Parameters:
- /// - wrappedValue: The default value if a string value is not specified
- /// for the given key.
- /// - key: The key to read and write the value to in the store
- /// store.
- /// - store: The store to read and write to. A value
- /// of `nil` will use the user default store from the environment.
- init(wrappedValue: Value, _ key: String, store: UserDefaults = .standard) where Value == [String] {
- let value = store.value(forKey: key) as? Value ?? wrappedValue
- self.init(
- value: value, store: store, key: key,
- get: { $0 as? Value },
- set: { store.set($0, forKey: key) }
- )
- }
-
- /// Creates a property that can read and write to a [String: Bool] user default.
- ///
- /// - Parameters:
- /// - wrappedValue: The default value if a string value is not specified
- /// for the given key.
- /// - key: The key to read and write the value to in the store
- /// store.
- /// - store: The store to read and write to. A value
- /// of `nil` will use the user default store from the environment.
- init(wrappedValue: Value, _ key: String, store: UserDefaults = .standard) where Value == [String: Bool] {
- let value = store.value(forKey: key) as? Value ?? wrappedValue
- self.init(
- value: value, store: store, key: key,
- get: { $0 as? Value },
- set: { store.set($0, forKey: key) }
- )
- }
-
- /// Creates a property that can read and write to a url user default.
- ///
- /// - Parameters:
- /// - wrappedValue: The default value if a url value is not specified for
- /// the given key.
- /// - key: The key to read and write the value to in the store
- /// store.
- /// - store: The store to read and write to. A value
- /// of `nil` will use the user default store from the environment.
- init(wrappedValue: Value, _ key: String, store: UserDefaults = .standard) where Value == URL {
- let value = store.url(forKey: key) ?? wrappedValue
- self.init(
- value: value, store: store, key: key,
- get: { ($0 as? String).flatMap(URL.init) },
- set: { store.set($0.absoluteString, forKey: key) }
- )
- }
-
- /// Creates a property that can read and write to a user default as data.
- ///
- /// Avoid storing large data blobs in store, such as image data,
- /// as it can negatively affect performance of your app.
- ///
- /// - Parameters:
- /// - wrappedValue: The default value if a data value is not specified for
- /// the given key.
- /// - key: The key to read and write the value to in the store
- /// store.
- /// - store: The store to read and write to. A value
- /// of `nil` will use the user default store from the environment.
- init(wrappedValue: Value, _ key: String, store: UserDefaults = .standard) where Value == Data {
- let value = store.value(forKey: key) as? Data ?? wrappedValue
- self.init(
- value: value, store: store, key: key,
- get: { $0 as? Value },
- set: { store.set($0, forKey: key) }
- )
- }
-}
-
-@available(macOS 10.15, *)
-public extension Backport.AppStorage where Wrapped == Any, Value: ExpressibleByNilLiteral {
- /// Creates a property that can read and write an Optional boolean user
- /// default.
- ///
- /// Defaults to nil if there is no restored value.
- ///
- /// - Parameters:
- /// - key: The key to read and write the value to in the store
- /// store.
- /// - store: The store to read and write to. A value
- /// of `nil` will use the user default store from the environment.
- init(_ key: String, store: UserDefaults = .standard) where Value == Bool? {
- let value = store.value(forKey: key) as? Value ?? .none
- self.init(
- value: value, store: store, key: key,
- get: { $0 as? Value },
- set: { store.set($0, forKey: key) }
- )
- }
-
- /// Creates a property that can read and write an Optional integer user
- /// default.
- ///
- /// Defaults to nil if there is no restored value.
- ///
- /// - Parameters:
- /// - key: The key to read and write the value to in the store
- /// store.
- /// - store: The store to read and write to. A value
- /// of `nil` will use the user default store from the environment.
- init(_ key: String, store: UserDefaults = .standard) where Value == Int? {
- let value = store.value(forKey: key) as? Value ?? .none
- self.init(
- value: value, store: store, key: key,
- get: { $0 as? Value },
- set: { store.set($0, forKey: key) }
- )
- }
-
- /// Creates a property that can read and write an Optional double user
- /// default.
- ///
- /// Defaults to nil if there is no restored value.
- ///
- /// - Parameters:
- /// - key: The key to read and write the value to in the store
- /// store.
- /// - store: The store to read and write to. A value
- /// of `nil` will use the user default store from the environment.
- init(_ key: String, store: UserDefaults = .standard) where Value == Double? {
- let value = store.value(forKey: key) as? Value ?? .none
- self.init(
- value: value, store: store, key: key,
- get: { $0 as? Value },
- set: { store.set($0, forKey: key) }
- )
- }
-
- /// Creates a property that can read and write an Optional string user
- /// default.
- ///
- /// Defaults to nil if there is no restored value.
- ///
- /// - Parameters:
- /// - key: The key to read and write the value to in the store
- /// store.
- /// - store: The store to read and write to. A value
- /// of `nil` will use the user default store from the environment.
- init(_ key: String, store: UserDefaults = .standard) where Value == String? {
- let value = store.value(forKey: key) as? Value ?? .none
- self.init(
- value: value, store: store, key: key,
- get: { $0 as? Value },
- set: { store.set($0, forKey: key) }
- )
- }
-
- /// Creates a property that can read and write an Optional URL user
- /// default.
- ///
- /// Defaults to nil if there is no restored value.
- ///
- /// - Parameters:
- /// - key: The key to read and write the value to in the store
- /// store.
- /// - store: The store to read and write to. A value
- /// of `nil` will use the user default store from the environment.
- init(_ key: String, store: UserDefaults = .standard) where Value == URL? {
- let value = store.url(forKey: key) ?? .none
- self.init(
- value: value, store: store, key: key,
- get: { ($0 as? String).flatMap(URL.init) },
- set: { store.set($0?.absoluteString, forKey: key) }
- )
- }
-
- /// Creates a property that can read and write an Optional data user
- /// default.
- ///
- /// Defaults to nil if there is no restored value.
- ///
- /// - Parameters:
- /// - key: The key to read and write the value to in the store
- /// store.
- /// - store: The store to read and write to. A value
- /// of `nil` will use the user default store from the environment.
- init(_ key: String, store: UserDefaults = .standard) where Value == Data? {
- let value = store.value(forKey: key) as? Value ?? .none
- self.init(
- value: value, store: store, key: key,
- get: { $0 as? Value },
- set: { store.set($0, forKey: key) }
- )
- }
-}
-
-@available(macOS 10.15, *)
-public extension Backport.AppStorage where Wrapped == Any, Value: RawRepresentable {
- /// Creates a property that can read and write to a string user default,
- /// transforming that to `RawRepresentable` data type.
- ///
- /// A common usage is with enumerations:
- ///
- /// enum MyEnum: String {
- /// case a
- /// case b
- /// case c
- /// }
- ///
- /// @AppStorage("MyEnumValue") private var value = MyEnum.a
- ///
- /// - Parameters:
- /// - wrappedValue: The default value if a string value
- /// is not specified for the given key.
- /// - key: The key to read and write the value to in the store
- /// store.
- /// - store: The store to read and write to. A value
- /// of `nil` will use the user default store from the environment.
- init(wrappedValue: Value, _ key: String, store: UserDefaults = .standard) where Value.RawValue == String {
- let rawValue = store.value(forKey: key) as? Value.RawValue
- let value = rawValue.flatMap(Value.init) ?? wrappedValue
- self.init(
- value: value, store: store, key: key,
- get: { $0 as? Value },
- set: { store.setValue($0.rawValue, forKey: key) }
- )
- }
-
- /// Creates a property that can read and write to an integer user default,
- /// transforming that to `RawRepresentable` data type.
- ///
- /// A common usage is with enumerations:
- ///
- /// enum MyEnum: Int {
- /// case a
- /// case b
- /// case c
- /// }
- ///
- /// @AppStorage("MyEnumValue") private var value = MyEnum.a
- ///
- /// - Parameters:
- /// - wrappedValue: The default value if an integer value
- /// is not specified for the given key.
- /// - key: The key to read and write the value to in the store
- /// store.
- /// - store: The store to read and write to. A value
- /// of `nil` will use the user default store from the environment.
- init(wrappedValue: Value, _ key: String, store: UserDefaults = .standard) where Value.RawValue == Int {
- let rawValue = store.value(forKey: key) as? Value.RawValue
- let value = rawValue.flatMap(Value.init) ?? wrappedValue
- self.init(
- value: value, store: store, key: key,
- get: { $0 as? Value },
- set: { store.setValue($0.rawValue, forKey: key) }
- )
- }
-}
-
-@available(macOS 10.15, *)
-private final class RefStorage: NSObject, ObservableObject {
- @Published
- fileprivate var value: Value
-
- private let defaultValue: Value
- private let store: UserDefaults
- private let key: String
- private let transform: (Any?) -> Value?
-
- deinit {
- store.removeObserver(self, forKeyPath: key)
- }
-
- init(value: Value, store: UserDefaults, key: String, transform: @escaping (Any?) -> Value?) {
- self.value = value
- defaultValue = value
- self.store = store
- self.key = key
- self.transform = transform
-
- super.init()
- store.addObserver(self, forKeyPath: key, options: .new, context: nil)
- }
-
- override func observeValue(
- forKeyPath _: String?,
- of _: Any?,
- change: [NSKeyValueChangeKey: Any]?,
- context _: UnsafeMutableRawPointer?
- ) {
- value = change?[.newKey].flatMap(transform) ?? defaultValue
- }
-}
diff --git a/Packages/ShapsBenkau_SwiftUIBackports/Sources/SwiftUIBackports/Shared/AsyncImage/AsyncImage.swift b/Packages/ShapsBenkau_SwiftUIBackports/Sources/SwiftUIBackports/Shared/AsyncImage/AsyncImage.swift
deleted file mode 100755
index e41d7b17..00000000
--- a/Packages/ShapsBenkau_SwiftUIBackports/Sources/SwiftUIBackports/Shared/AsyncImage/AsyncImage.swift
+++ /dev/null
@@ -1,226 +0,0 @@
-// (c) 2022 and onwards Shaps Benkau (MIT License).
-// ====================
-// This code is released under the MIT license (SPDX-License-Identifier: MIT)
-
-import SwiftUI
-
-@available(iOS, deprecated: 15.0)
-@available(macOS 10.15, *)
-extension Backport where Wrapped == Any {
- /// Loads and displays an image from the specified URL.
- ///
- /// Until the image loads, SwiftUI displays a default placeholder. When
- /// the load operation completes successfully, SwiftUI updates the
- /// view to show the loaded image. If the operation fails, SwiftUI
- /// continues to display the placeholder. The following example loads
- /// and displays an icon from an example server:
- ///
- /// asyncImage(url: URL(string: "https://example.com/icon.png"))
- ///
- /// If you want to customize the placeholder or apply image-specific
- /// modifiers --- like ``Image/resizable(capInsets:resizingMode:)`` ---
- /// to the loaded image, use the ``init(url:scale:content:placeholder:)``
- /// initializer instead.
- ///
- /// - Parameters:
- /// - url: The URL of the image to display.
- /// - scale: The scale to use for the image. The default is `1`. Set a
- /// different value when loading images designed for higher resolution
- /// displays. For example, set a value of `2` for an image that you
- /// would name with the `@2x` suffix if stored in a file on disk.
- @ViewBuilder
- public static func asyncImage(url: URL?, scale: CGFloat = 1) -> some View {
- _asyncImage(url: url, scale: scale)
- }
-
- /// Loads and displays a modifiable image from the specified URL using
- /// a custom placeholder until the image loads.
- ///
- /// Until the image loads, SwiftUI displays the placeholder view that
- /// you specify. When the load operation completes successfully, SwiftUI
- /// updates the view to show content that you specify, which you
- /// create using the loaded image. For example, you can show a green
- /// placeholder, followed by a tiled version of the loaded image:
- ///
- /// asyncImage(url: URL(string: "https://example.com/icon.png")) { image in
- /// image.resizable(resizingMode: .tile)
- /// } placeholder: {
- /// Color.green
- /// }
- ///
- /// If the load operation fails, SwiftUI continues to display the
- /// placeholder. To be able to display a different view on a load error,
- /// use the ``init(url:scale:transaction:content:)`` initializer instead.
- ///
- /// - Parameters:
- /// - url: The URL of the image to display.
- /// - scale: The scale to use for the image. The default is `1`. Set a
- /// different value when loading images designed for higher resolution
- /// displays. For example, set a value of `2` for an image that you
- /// would name with the `@2x` suffix if stored in a file on disk.
- /// - content: A closure that takes the loaded image as an input, and
- /// returns the view to show. You can return the image directly, or
- /// modify it as needed before returning it.
- /// - placeholder: A closure that returns the view to show until the
- /// load operation completes successfully.
- @ViewBuilder
- public static func asyncImage(
- url: URL?, scale: CGFloat = 1, @ViewBuilder content: @escaping (Image) -> I,
- @ViewBuilder placeholder: @escaping () -> P
- ) -> some View {
- _asyncImage(url: url, scale: scale, content: content, placeholder: placeholder)
- }
-
- /// Loads and displays a modifiable image from the specified URL in phases.
- ///
- /// If you set the asynchronous image's URL to `nil`, or after you set the
- /// URL to a value but before the load operation completes, the phase is
- /// ``asyncImagePhase/empty``. After the operation completes, the phase
- /// becomes either ``asyncImagePhase/failure(_:)`` or
- /// ``asyncImagePhase/success(_:)``. In the first case, the phase's
- /// ``asyncImagePhase/error`` value indicates the reason for failure.
- /// In the second case, the phase's ``asyncImagePhase/image`` property
- /// contains the loaded image. Use the phase to drive the output of the
- /// `content` closure, which defines the view's appearance:
- ///
- /// asyncImage(url: URL(string: "https://example.com/icon.png")) { phase in
- /// if let image = phase.image {
- /// image // Displays the loaded image.
- /// } else if phase.error != nil {
- /// Color.red // Indicates an error.
- /// } else {
- /// Color.blue // Acts as a placeholder.
- /// }
- /// }
- ///
- /// To add transitions when you change the URL, apply an identifier to the
- /// ``asyncImage``.
- ///
- /// - Parameters:
- /// - url: The URL of the image to display.
- /// - scale: The scale to use for the image. The default is `1`. Set a
- /// different value when loading images designed for higher resolution
- /// displays. For example, set a value of `2` for an image that you
- /// would name with the `@2x` suffix if stored in a file on disk.
- /// - transaction: The transaction to use when the phase changes.
- /// - content: A closure that takes the load phase as an input, and
- /// returns the view to display for the specified phase.
- @ViewBuilder
- public static func asyncImage(
- url: URL?, scale: CGFloat = 1, transaction: Transaction = Transaction(),
- @ViewBuilder content: @escaping (asyncImagePhase) -> Content
- ) -> some View {
- _asyncImage(url: url, scale: scale, transaction: transaction, content: content)
- }
-
- /// The current phase of the asynchronous image loading operation.
- ///
- /// When you create an ``asyncImage`` instance with the
- /// ``asyncImage/init(url:scale:transaction:content:)`` initializer, you define
- /// the appearance of the view using a `content` closure. SwiftUI calls the
- /// closure with a phase value at different points during the load operation
- /// to indicate the current state. Use the phase to decide what to draw.
- /// For example, you can draw the loaded image if it exists, a view that
- /// indicates an error, or a placeholder:
- ///
- /// asyncImage(url: URL(string: "https://example.com/icon.png")) { phase in
- /// if let image = phase.image {
- /// image // Displays the loaded image.
- /// } else if phase.error != nil {
- /// Color.red // Indicates an error.
- /// } else {
- /// Color.blue // Acts as a placeholder.
- /// }
- /// }
- public enum asyncImagePhase {
- /// No image is loaded.
- case empty
- /// An image succesfully loaded.
- case success(Image)
- /// An image failed to load with an error.
- case failure(Error)
-
- /// The loaded image, if any.
- public var image: Image? {
- guard case let .success(image) = self else { return nil }
- return image
- }
-
- /// The error that occurred when attempting to load an image, if any.
- public var error: Error? {
- guard case let .failure(error) = self else { return nil }
- return error
- }
- }
-
- // An iOS 13+ async/await backport implementation
- private struct _asyncImage: View {
- @State private var phase: asyncImagePhase = .empty
-
- var url: URL?
- var scale: CGFloat = 1
- var transaction: Transaction = .init()
- var content: (Backport.asyncImagePhase) -> Content
-
- public var body: some View {
- ZStack {
- content(phase)
- }
- .backport.task(id: url) {
- do {
- guard !Task.isCancelled, let url = url else { return }
- let (data, _) = try await URLSession.shared.backport.data(from: url)
- guard !Task.isCancelled else { return }
-
- #if os(macOS)
- if let image = NSImage(data: data) {
- withTransaction(transaction) {
- phase = .success(Image(nsImage: image))
- }
- }
- #else
- if let image = UIImage(data: data, scale: scale) {
- withTransaction(transaction) {
- phase = .success(Image(uiImage: image))
- }
- }
- #endif
- } catch {
- phase = .failure(error)
- }
- }
- }
-
- init(url: URL?, scale: CGFloat = 1) where Content == AnyView {
- self.url = url
- self.scale = scale
- content = { AnyView($0.image) }
- }
-
- init(
- url: URL?, scale: CGFloat = 1, @ViewBuilder content: @escaping (Image) -> I,
- @ViewBuilder placeholder: @escaping () -> P
- ) where Content == _ConditionalContent {
- self.url = url
- self.scale = scale
- transaction = Transaction()
- self.content = { phase -> _ConditionalContent in
- if let image = phase.image {
- return ViewBuilder.buildEither(first: content(image))
- } else {
- return ViewBuilder.buildEither(second: placeholder())
- }
- }
- }
-
- init(
- url: URL?, scale: CGFloat = 1, transaction: Transaction = Transaction(),
- @ViewBuilder content: @escaping (Backport.asyncImagePhase) -> Content
- ) {
- self.url = url
- self.scale = scale
- self.transaction = transaction
- self.content = content
- }
- }
-}
diff --git a/Packages/ShapsBenkau_SwiftUIBackports/Sources/SwiftUIBackports/Shared/Background/Background.swift b/Packages/ShapsBenkau_SwiftUIBackports/Sources/SwiftUIBackports/Shared/Background/Background.swift
deleted file mode 100755
index f2bcf4ab..00000000
--- a/Packages/ShapsBenkau_SwiftUIBackports/Sources/SwiftUIBackports/Shared/Background/Background.swift
+++ /dev/null
@@ -1,136 +0,0 @@
-// (c) 2022 and onwards Shaps Benkau (MIT License).
-// ====================
-// This code is released under the MIT license (SPDX-License-Identifier: MIT)
-
-import SwiftUI
-
-@available(macOS 10.15, *)
-public extension Backport where Wrapped: View {
- /// Layers the views that you specify behind this view.
- ///
- /// Use this modifier to place one or more views behind another view.
- /// For example, you can place a collection of stars beind a ``Text`` view:
- ///
- /// Text("ABCDEF")
- /// .background(alignment: .leading) { Star(color: .red) }
- /// .background(alignment: .center) { Star(color: .green) }
- /// .background(alignment: .trailing) { Star(color: .blue) }
- ///
- /// The example above assumes that you've defined a `Star` view with a
- /// parameterized color:
- ///
- /// struct Star: View {
- /// var color: Color
- ///
- /// var body: some View {
- /// Image(systemName: "star.fill")
- /// .foregroundStyle(color)
- /// }
- /// }
- ///
- /// By setting different `alignment` values for each modifier, you make the
- /// stars appear in different places behind the text:
- ///
- /// 
- ///
- /// If you specify more than one view in the `content` closure, the modifier
- /// collects all of the views in the closure into an implicit ``ZStack``,
- /// taking them in order from back to front. For example, you can layer a
- /// vertical bar behind a circle, with both of those behind a horizontal
- /// bar:
- ///
- /// Color.blue
- /// .frame(width: 200, height: 10) // Creates a horizontal bar.
- /// .background {
- /// Color.green
- /// .frame(width: 10, height: 100) // Creates a vertical bar.
- /// Circle()
- /// .frame(width: 50, height: 50)
- /// }
- ///
- /// Both the background modifier and the implicit ``ZStack`` composed from
- /// the background content --- the circle and the vertical bar --- use a
- /// default ``Alignment/center`` alignment. The vertical bar appears
- /// centered behind the circle, and both appear as a composite view centered
- /// behind the horizontal bar:
- ///
- /// 
- ///
- /// If you specify an alignment for the background, it applies to the
- /// implicit stack rather than to the individual views in the closure. You
- /// can see this if you add the ``Alignment/leading`` alignment:
- ///
- /// Color.blue
- /// .frame(width: 200, height: 10)
- /// .background(alignment: .leading) {
- /// Color.green
- /// .frame(width: 10, height: 100)
- /// Circle()
- /// .frame(width: 50, height: 50)
- /// }
- ///
- /// The vertical bar and the circle move as a unit to align the stack
- /// with the leading edge of the horizontal bar, while the
- /// vertical bar remains centered on the circle:
- ///
- /// 
- ///
- /// To control the placement of individual items inside the `content`
- /// closure, either use a different background modifier for each item, as
- /// the earlier example of stars under text demonstrates, or add an explicit
- /// ``ZStack`` inside the content closure with its own alignment:
- ///
- /// Color.blue
- /// .frame(width: 200, height: 10)
- /// .background(alignment: .leading) {
- /// ZStack(alignment: .leading) {
- /// Color.green
- /// .frame(width: 10, height: 100)
- /// Circle()
- /// .frame(width: 50, height: 50)
- /// }
- /// }
- ///
- /// The stack alignment ensures that the circle's leading edge aligns with
- /// the vertical bar's, while the background modifier aligns the composite
- /// view with the horizontal bar:
- ///
- /// 
- ///
- /// You can achieve layering without a background modifier by putting both
- /// the modified view and the background content into a ``ZStack``. This
- /// produces a simpler view hierarchy, but it changes the layout priority
- /// that SwiftUI applies to the views. Use the background modifier when you
- /// want the modified view to dominate the layout.
- ///
- /// If you want to specify a ``ShapeStyle`` like a
- /// ``HierarchicalShapeStyle`` or a ``Material`` as the background, use
- /// ``View/background(_:ignoresSafeAreaEdges:)`` instead.
- /// To specify a ``Shape`` or ``InsettableShape``, use
- /// ``View/background(_:in:fillStyle:)-89n7j`` or
- /// ``View/background(_:in:fillStyle:)-20tq5``, respectively.
- ///
- /// - Parameters:
- /// - alignment: The alignment that the modifier uses to position the
- /// implicit ``ZStack`` that groups the background views. The default
- /// is ``Alignment/center``.
- /// - content: A ``ViewBuilder`` that you use to declare the views to draw
- /// behind this view, stacked in a cascading order from bottom to top.
- /// The last view that you list appears at the front of the stack.
- ///
- /// - Returns: A view that uses the specified content as a background.
- func background(alignment: Alignment = .center, @ViewBuilder _ content: () -> Content)
- -> some View
- {
- self.content.background(content(), alignment: alignment)
- }
-}
diff --git a/Packages/ShapsBenkau_SwiftUIBackports/Sources/SwiftUIBackports/Shared/Dismiss/Dismiss.swift b/Packages/ShapsBenkau_SwiftUIBackports/Sources/SwiftUIBackports/Shared/Dismiss/Dismiss.swift
deleted file mode 100755
index 0a27f290..00000000
--- a/Packages/ShapsBenkau_SwiftUIBackports/Sources/SwiftUIBackports/Shared/Dismiss/Dismiss.swift
+++ /dev/null
@@ -1,191 +0,0 @@
-// (c) 2022 and onwards Shaps Benkau (MIT License).
-// ====================
-// This code is released under the MIT license (SPDX-License-Identifier: MIT)
-
-import SwiftUI
-
-@available(macOS 10.15, *)
-public extension EnvironmentValues {
- /// An action that dismisses the current presentation.
- ///
- /// Use this environment value to get the ``Backport.DismissAction`` instance
- /// for the current ``Environment``. Then call the instance
- /// to perform the dismissal. You call the instance directly because
- /// it defines a ``Backport.DismissAction/callAsFunction()``
- /// method that Swift calls when you call the instance.
- ///
- /// For example, you can create a button that calls the ``Backport.DismissAction``:
- ///
- /// private struct SheetContents: View {
- /// @Environment(\.backportDismiss) private var dismiss
- ///
- /// var body: some View {
- /// Button("Done") {
- /// dismiss()
- /// }
- /// }
- /// }
- ///
- /// If you present the `SheetContents` view in a sheet, the user can dismiss
- /// the sheet by tapping or clicking the sheet's button:
- ///
- /// private struct DetailView: View {
- /// @State private var isSheetPresented = false
- ///
- /// var body: some View {
- /// Button("Show Sheet") {
- /// isSheetPresented = true
- /// }
- /// .sheet(isPresented: $isSheetPresented) {
- /// SheetContents()
- /// }
- /// }
- /// }
- ///
- /// Be sure that you define the action in the appropriate environment.
- /// For example, don't reorganize the `DetailView` in the example above
- /// so that it creates the `dismiss` property and calls it from the
- /// ``View/sheet(item:onDismiss:content:)`` view modifier's `content`
- /// closure:
- ///
- /// private struct DetailView: View {
- /// @State private var isSheetPresented = false
- /// @Environment(\.backportDismiss) private var dismiss // Applies to DetailView.
- ///
- /// var body: some View {
- /// Button("Show Sheet") {
- /// isSheetPresented = true
- /// }
- /// .sheet(isPresented: $isSheetPresented) {
- /// Button("Done") {
- /// dismiss() // Fails to dismiss the sheet.
- /// }
- /// }
- /// }
- /// }
- ///
- /// If you do this, the sheet fails to dismiss because the action applies
- /// to the environment where you declared it, which is that of the detail
- /// view, rather than the sheet. In fact, if you've presented the detail
- /// view in a ``NavigationView``, the dismissal pops the detail view
- /// the navigation stack.
- ///
- /// The dismiss action has no effect on a view that isn't currently
- /// presented. If you need to query whether SwiftUI is currently presenting
- /// a view, read the ``EnvironmentValues/backportIsPresented`` environment value.
- var backportDismiss: Backport.DismissAction {
- .init(presentation: presentationMode)
- }
-
- @available(macOS 10.15, *)
- /// A Boolean value that indicates whether the view associated with this
- /// environment is currently presented.
- ///
- /// You can read this value like any of the other ``EnvironmentValues``
- /// by creating a property with the ``Environment`` property wrapper:
- ///
- /// @Environment(\.backportIsPresented) private var isPresented
- ///
- /// Read the value inside a view if you need to know when SwiftUI
- /// presents that view. For example, you can take an action when SwiftUI
- /// presents a view by using the ``View/onChange(of:perform:)``
- /// modifier:
- ///
- /// .onChange(of: isPresented) { isPresented in
- /// if isPresented {
- /// // Do something when first presented.
- /// }
- /// }
- ///
- /// This behaves differently than ``View/onAppear(perform:)``, which
- /// SwiftUI can call more than once for a given presentation, like
- /// when you navigate back to a view that's already in the
- /// navigation hierarchy.
- ///
- /// To dismiss the currently presented view, use
- /// ``EnvironmentValues/backportDismiss``.
- var backportIsPresented: Bool {
- presentationMode.wrappedValue.isPresented
- }
-}
-
-@available(macOS 10.15, *)
-@available(iOS, deprecated: 15)
-@available(macOS, deprecated: 12)
-@available(tvOS, deprecated: 15)
-@available(watchOS, deprecated: 8)
-extension Backport where Wrapped: Any {
- /// An action that dismisses a presentation.
- ///
- /// Use the ``EnvironmentValues/dismiss`` environment value to get the instance
- /// of this structure for a given ``Environment``. Then call the instance
- /// to perform the dismissal. You call the instance directly because
- /// it defines a ``DismissAction/callAsFunction()``
- /// method that Swift calls when you call the instance.
- ///
- /// For example, you can create a button that calls the ``DismissAction``:
- ///
- /// private struct SheetContents: View {
- /// @Environment(\.backportDismiss) private var dismiss
- ///
- /// var body: some View {
- /// Button("Done") {
- /// dismiss()
- /// }
- /// }
- /// }
- ///
- /// If you present the `SheetContents` view in a sheet, the user can dismiss
- /// the sheet by tapping or clicking the sheet's button:
- ///
- /// private struct DetailView: View {
- /// @State private var isSheetPresented = false
- ///
- /// var body: some View {
- /// Button("Show Sheet") {
- /// isSheetPresented = true
- /// }
- /// .sheet(isPresented: $isSheetPresented) {
- /// SheetContents()
- /// }
- /// }
- /// }
- ///
- /// Be sure that you define the action in the appropriate environment.
- /// For example, don't reorganize the `DetailView` in the example above
- /// so that it creates the `dismiss` property and calls it from the
- /// ``View/sheet(item:onDismiss:content:)`` view modifier's `content`
- /// closure:
- ///
- /// private struct DetailView: View {
- /// @State private var isSheetPresented = false
- /// @Environment(\.backportDismiss) private var dismiss // Applies to DetailView.
- ///
- /// var body: some View {
- /// Button("Show Sheet") {
- /// isSheetPresented = true
- /// }
- /// .sheet(isPresented: $isSheetPresented) {
- /// Button("Done") {
- /// dismiss() // Fails to dismiss the sheet.
- /// }
- /// }
- /// }
- /// }
- ///
- /// If you do this, the sheet fails to dismiss because the action applies
- /// to the environment where you declared it, which is that of the detail
- /// view, rather than the sheet. In fact, if you've presented the detail
- /// view in a ``NavigationView``, the dismissal pops the detail view
- /// from the navigation stack.
- ///
- /// The dismiss action has no effect on a view that isn't currently
- /// presented. If you need to query whether SwiftUI is currently presenting
- /// a view, read the ``EnvironmentValues/backportIsPresented`` environment value.
- public struct DismissAction {
- var presentation: Binding
- public func callAsFunction() {
- presentation.wrappedValue.dismiss()
- }
- }
-}
diff --git a/Packages/ShapsBenkau_SwiftUIBackports/Sources/SwiftUIBackports/Shared/DynamicType/DynamicType+Environment.swift b/Packages/ShapsBenkau_SwiftUIBackports/Sources/SwiftUIBackports/Shared/DynamicType/DynamicType+Environment.swift
deleted file mode 100755
index dffbdbbd..00000000
--- a/Packages/ShapsBenkau_SwiftUIBackports/Sources/SwiftUIBackports/Shared/DynamicType/DynamicType+Environment.swift
+++ /dev/null
@@ -1,64 +0,0 @@
-// (c) 2022 and onwards Shaps Benkau (MIT License).
-// ====================
-// This code is released under the MIT license (SPDX-License-Identifier: MIT)
-
-import SwiftUI
-
-@available(macOS 10.15, *)
-private struct BackportDynamicTypeKey: EnvironmentKey {
- static var defaultValue: Backport.DynamicTypeSize = .large
-}
-
-@available(macOS 10.15, *)
-@available(iOS, deprecated: 15)
-@available(tvOS, deprecated: 15)
-@available(macOS, deprecated: 12)
-@available(watchOS, deprecated: 8)
-extension EnvironmentValues {
- /// Sets the Dynamic Type size within the view to the given value.
- ///
- /// As an example, you can set a Dynamic Type size in `ContentView` to be
- /// ``DynamicTypeSize/xLarge`` (this can be useful in previews to see your
- /// content at a different size) like this:
- ///
- /// ContentView()
- /// .backport.dynamicTypeSize(.xLarge)
- ///
- /// If a Dynamic Type size range is applied after setting a value,
- /// the value is limited by that range:
- ///
- /// ContentView() // Dynamic Type size will be .large
- /// .backport.dynamicTypeSize(...DynamicTypeSize.large)
- /// .backport.dynamicTypeSize(.xLarge)
- ///
- /// When limiting the Dynamic Type size, consider if adding a
- /// large content view with ``View/accessibilityShowsLargeContentViewer()``
- /// would be appropriate.
- ///
- /// - Parameter size: The size to set for this view.
- ///
- /// - Returns: A view that sets the Dynamic Type size to the specified
- /// `size`.
- public var backportDynamicTypeSize: Backport.DynamicTypeSize {
- get { .init(self[keyPath: \.sizeCategory]) }
- set { self[keyPath: \.sizeCategory] = newValue.sizeCategory }
- }
-}
-
-@available(macOS 10.15, *)
-private struct DynamicTypeRangeKey: EnvironmentKey {
- static var defaultValue: Range.DynamicTypeSize> {
- .init(uncheckedBounds: (lower: .xSmall, upper: .accessibility5))
- }
-}
-
-@available(macOS 10.15, *)
-extension EnvironmentValues {
- var dynamicTypeRange: Range.DynamicTypeSize> {
- get { self[DynamicTypeRangeKey.self] }
- set {
- let current = self[DynamicTypeRangeKey.self]
- self[DynamicTypeRangeKey.self] = current.clamped(to: newValue)
- }
- }
-}
diff --git a/Packages/ShapsBenkau_SwiftUIBackports/Sources/SwiftUIBackports/Shared/DynamicType/DynamicType+Modifiers.swift b/Packages/ShapsBenkau_SwiftUIBackports/Sources/SwiftUIBackports/Shared/DynamicType/DynamicType+Modifiers.swift
deleted file mode 100755
index a617ee40..00000000
--- a/Packages/ShapsBenkau_SwiftUIBackports/Sources/SwiftUIBackports/Shared/DynamicType/DynamicType+Modifiers.swift
+++ /dev/null
@@ -1,116 +0,0 @@
-// (c) 2022 and onwards Shaps Benkau (MIT License).
-// ====================
-// This code is released under the MIT license (SPDX-License-Identifier: MIT)
-
-import SwiftUI
-
-@available(macOS 10.15, *)
-public extension Backport where Wrapped: View {
- /// Sets the Dynamic Type size within the view to the given value.
- ///
- /// As an example, you can set a Dynamic Type size in `ContentView` to be
- /// ``DynamicTypeSize/xLarge`` (this can be useful in previews to see your
- /// content at a different size) like this:
- ///
- /// ContentView()
- /// .dynamicTypeSize(.xLarge)
- ///
- /// If a Dynamic Type size range is applied after setting a value,
- /// the value is limited by that range:
- ///
- /// ContentView() // Dynamic Type size will be .large
- /// .dynamicTypeSize(...DynamicTypeSize.large)
- /// .dynamicTypeSize(.xLarge)
- ///
- /// When limiting the Dynamic Type size, consider if adding a
- /// large content view with ``View/accessibilityShowsLargeContentViewer()``
- /// would be appropriate.
- ///
- /// - Parameter size: The size to set for this view.
- ///
- /// - Returns: A view that sets the Dynamic Type size to the specified
- /// `size`.
- @ViewBuilder
- func dynamicTypeSize(_ size: Backport.DynamicTypeSize) -> some View {
- content.environment(\.backportDynamicTypeSize, size)
- }
-
- @available(macOS 10.15, *)
- /// Limits the Dynamic Type size within the view to the given range.
- ///
- /// As an example, you can constrain the maximum Dynamic Type size in
- /// `ContentView` to be no larger than ``DynamicTypeSize/large``:
- ///
- /// ContentView()
- /// .dynamicTypeSize(...DynamicTypeSize.large)
- ///
- /// If the Dynamic Type size is limited to multiple ranges, the result is
- /// their intersection:
- ///
- /// ContentView() // Dynamic Type sizes are from .small to .large
- /// .dynamicTypeSize(.small...)
- /// .dynamicTypeSize(...DynamicTypeSize.large)
- ///
- /// A specific Dynamic Type size can still be set after a range is applied:
- ///
- /// ContentView() // Dynamic Type size is .xLarge
- /// .dynamicTypeSize(.xLarge)
- /// .dynamicTypeSize(...DynamicTypeSize.large)
- ///
- /// When limiting the Dynamic Type size, consider if adding a
- /// large content view with ``View/accessibilityShowsLargeContentViewer()``
- /// would be appropriate.
- ///
- /// - Parameter range: The range of sizes that are allowed in this view.
- ///
- /// - Returns: A view that constrains the Dynamic Type size of this view
- /// within the specified `range`.
- @ViewBuilder
- func dynamicTypeSize(_ range: T) -> some View
- where T: RangeExpression, T.Bound == Backport.DynamicTypeSize
- {
- if let range = range as? Range {
- content
- .modifier(DynamicTypeRangeModifier())
- .environment(\.dynamicTypeRange, range)
- } else if let range = range as? ClosedRange {
- content
- .modifier(DynamicTypeRangeModifier())
- .environment(\.dynamicTypeRange, .init(uncheckedBounds: (lower: range.lowerBound, upper: range.upperBound)))
- } else if let range = range as? PartialRangeFrom {
- content
- .modifier(DynamicTypeRangeModifier())
- .environment(\.dynamicTypeRange, .init(uncheckedBounds: (range.lowerBound, .accessibility5)))
- } else if let range = range as? PartialRangeUpTo {
- content
- .modifier(DynamicTypeRangeModifier())
- .environment(\.dynamicTypeRange, .init(uncheckedBounds: (.xSmall, range.upperBound)))
- } else if let range = range as? PartialRangeThrough {
- content
- .modifier(DynamicTypeRangeModifier())
- .environment(\.dynamicTypeRange, .init(uncheckedBounds: (.xSmall, range.upperBound)))
- } else {
- content
- .modifier(DynamicTypeRangeModifier())
- }
- }
-}
-
-@available(macOS 10.15, *)
-private struct DynamicTypeRangeModifier: ViewModifier {
- @Environment(\.dynamicTypeRange) private var range
- @Environment(\.backportDynamicTypeSize) private var size
-
- @available(macOS 10.15, *)
- private var resolvedSize: Backport.DynamicTypeSize {
- print(range)
- return range.contains(size)
- ? size
- : max(range.lowerBound, min(range.upperBound, size))
- }
-
- @available(macOS 10.15, *)
- func body(content: Content) -> some View {
- content.environment(\.backportDynamicTypeSize, resolvedSize)
- }
-}
diff --git a/Packages/ShapsBenkau_SwiftUIBackports/Sources/SwiftUIBackports/Shared/DynamicType/DynamicType.swift b/Packages/ShapsBenkau_SwiftUIBackports/Sources/SwiftUIBackports/Shared/DynamicType/DynamicType.swift
deleted file mode 100755
index e048828a..00000000
--- a/Packages/ShapsBenkau_SwiftUIBackports/Sources/SwiftUIBackports/Shared/DynamicType/DynamicType.swift
+++ /dev/null
@@ -1,225 +0,0 @@
-// (c) 2022 and onwards Shaps Benkau (MIT License).
-// ====================
-// This code is released under the MIT license (SPDX-License-Identifier: MIT)
-
-import SwiftUI
-
-@available(iOS, deprecated: 15)
-@available(tvOS, deprecated: 15)
-@available(macOS, deprecated: 12)
-@available(watchOS, deprecated: 8)
-@available(macOS 10.15, *)
-extension Backport where Wrapped == Any {
- /// A Dynamic Type size, which specifies how large scalable content should be.
- ///
- /// For more information about Dynamic Type sizes in iOS, see iOS Human Interface Guidelines >
- /// [Dynamic Type Sizes](https://developer.apple.com/design/human-interface-guidelines/ios/visual-design/typography/#dynamic-type-sizes).
- /// For more information about Dynamic Type sizes in watchOS, see watchOS Human Interface Guidelines >
- /// [Dynamic Type Sizes](https://developer.apple.com/design/human-interface-guidelines/watchos/visual/typography/#dynamic-type-sizes).
- public enum DynamicTypeSize: Hashable, Comparable, CaseIterable {
- /// An extra small size.
- case xSmall
-
- /// A small size.
- case small
-
- /// A medium size.
- case medium
-
- /// A large size.
- case large
-
- /// An extra large size.
- case xLarge
-
- /// An extra extra large size.
- case xxLarge
-
- /// An extra extra extra large size.
- case xxxLarge
-
- /// The first accessibility size.
- case accessibility1
-
- /// The second accessibility size.
- case accessibility2
-
- /// The third accessibility size.
- case accessibility3
-
- /// The fourth accessibility size.
- case accessibility4
-
- /// The fifth accessibility size.
- case accessibility5
-
- /// A Boolean value indicating whether the size is one that is associated
- /// with accessibility.
- public var isAccessibilitySize: Bool {
- self >= .accessibility1
- }
-
- #if os(iOS) || os(tvOS)
- /// Create a Dynamic Type size from its `UIContentSizeCategory` equivalent.
- public init?(_ uiSizeCategory: UIContentSizeCategory) {
- switch uiSizeCategory {
- case .extraSmall:
- self = .xSmall
- case .small:
- self = .small
- case .medium:
- self = .medium
- case .large:
- self = .medium
- case .extraLarge:
- self = .xLarge
- case .extraExtraLarge:
- self = .xxLarge
- case .extraExtraExtraLarge:
- self = .xxxLarge
- case .accessibilityMedium:
- self = .accessibility1
- case .accessibilityLarge:
- self = .accessibility2
- case .accessibilityExtraLarge:
- self = .accessibility3
- case .accessibilityExtraExtraLarge:
- self = .accessibility4
- case .accessibilityExtraExtraExtraLarge:
- self = .accessibility5
- default:
- return nil
- }
- }
- #endif
-
- internal init(_ sizeCategory: ContentSizeCategory) {
- switch sizeCategory {
- case .extraSmall:
- self = .xSmall
- case .small:
- self = .small
- case .medium:
- self = .medium
- case .large:
- self = .large
- case .extraLarge:
- self = .xLarge
- case .extraExtraLarge:
- self = .xxLarge
- case .extraExtraExtraLarge:
- self = .xxxLarge
- case .accessibilityMedium:
- self = .accessibility1
- case .accessibilityLarge:
- self = .accessibility2
- case .accessibilityExtraLarge:
- self = .accessibility3
- case .accessibilityExtraExtraLarge:
- self = .accessibility4
- case .accessibilityExtraExtraExtraLarge:
- self = .accessibility5
- default:
- self = .large
- }
- }
-
- var sizeCategory: ContentSizeCategory {
- switch self {
- case .xSmall:
- return .extraSmall
- case .small:
- return .small
- case .medium:
- return .medium
- case .large:
- return .large
- case .xLarge:
- return .extraLarge
- case .xxLarge:
- return .extraExtraLarge
- case .xxxLarge:
- return .extraExtraExtraLarge
- case .accessibility1:
- return .accessibilityMedium
- case .accessibility2:
- return .accessibilityLarge
- case .accessibility3:
- return .accessibilityExtraLarge
- case .accessibility4:
- return .accessibilityExtraExtraLarge
- case .accessibility5:
- return .accessibilityExtraExtraExtraLarge
- }
- }
- }
-}
-
-@available(iOS 15, tvOS 15, macOS 12, watchOS 8, *)
-extension Backport.DynamicTypeSize {
- var dynamicTypeSize: DynamicTypeSize {
- switch self {
- case .xSmall:
- return .xSmall
- case .small:
- return .small
- case .medium:
- return .medium
- case .large:
- return .large
- case .xLarge:
- return .xLarge
- case .xxLarge:
- return .xxLarge
- case .xxxLarge:
- return .xxxLarge
- case .accessibility1:
- return .accessibility1
- case .accessibility2:
- return .accessibility2
- case .accessibility3:
- return .accessibility3
- case .accessibility4:
- return .accessibility4
- case .accessibility5:
- return .accessibility5
- }
- }
-}
-
-#if os(iOS) || os(tvOS)
- @available(iOS, deprecated: 15)
- @available(tvOS, deprecated: 15)
- extension UIContentSizeCategory {
- public init(_ dynamicTypeSize: Backport.DynamicTypeSize?) {
- switch dynamicTypeSize {
- case .xSmall:
- self = .extraSmall
- case .small:
- self = .small
- case .medium:
- self = .medium
- case .large:
- self = .large
- case .xLarge:
- self = .extraLarge
- case .xxLarge:
- self = .extraExtraLarge
- case .xxxLarge:
- self = .extraExtraExtraLarge
- case .accessibility1:
- self = .accessibilityMedium
- case .accessibility2:
- self = .accessibilityLarge
- case .accessibility3:
- self = .accessibilityExtraLarge
- case .accessibility4:
- self = .accessibilityExtraExtraLarge
- case .accessibility5:
- self = .accessibilityExtraExtraExtraLarge
- case .none:
- self = .large
- }
- }
- }
-#endif
diff --git a/Packages/ShapsBenkau_SwiftUIBackports/Sources/SwiftUIBackports/Shared/Label/Label.swift b/Packages/ShapsBenkau_SwiftUIBackports/Sources/SwiftUIBackports/Shared/Label/Label.swift
deleted file mode 100755
index 2c293fc0..00000000
--- a/Packages/ShapsBenkau_SwiftUIBackports/Sources/SwiftUIBackports/Shared/Label/Label.swift
+++ /dev/null
@@ -1,184 +0,0 @@
-// (c) 2022 and onwards Shaps Benkau (MIT License).
-// ====================
-// This code is released under the MIT license (SPDX-License-Identifier: MIT)
-
-import SwiftUI
-
-@available(iOS, deprecated: 14)
-@available(macOS, deprecated: 11)
-@available(tvOS, deprecated: 14)
-@available(watchOS, deprecated: 7)
-@available(macOS 10.15, *)
-extension Backport where Wrapped == Any {
- /// A standard label for user interface items, consisting of an icon with a
- /// title.
- ///
- /// One of the most common and recognizable user interface components is the
- /// combination of an icon and a label. This idiom appears across many kinds of
- /// apps and shows up in collections, lists, menus of action items, and
- /// disclosable lists, just to name a few.
- ///
- /// You create a label, in its simplest form, by providing a title and the name
- /// of an image, such as an icon from the
- /// [SF Symbols](https://developer.apple.com/design/human-interface-guidelines/sf-symbols/overview/)
- /// collection:
- ///
- /// Label("Lightning", systemImage: "bolt.fill")
- ///
- /// You can also apply styles to labels in several ways. In the case of dynamic
- /// changes to the view after device rotation or change to a window size you
- /// might want to show only the text portion of the label using the
- /// ``LabelStyle/titleOnly`` label style:
- ///
- /// Label("Lightning", systemImage: "bolt.fill")
- /// .labelStyle(.titleOnly)
- ///
- /// Conversely, there's also an icon-only label style:
- ///
- /// Label("Lightning", systemImage: "bolt.fill")
- /// .labelStyle(.iconOnly)
- ///
- /// Some containers might apply a different default label style, such as only
- /// showing icons within toolbars on macOS and iOS. To opt in to showing both
- /// the title and the icon, you can apply the ``LabelStyle/titleAndIcon`` label
- /// style:
- ///
- /// Label("Lightning", systemImage: "bolt.fill")
- /// .labelStyle(.titleAndIcon)
- ///
- /// You can also create a customized label style by modifying an existing
- /// style; this example adds a red border to the default label style:
- ///
- /// struct RedBorderedLabelStyle: LabelStyle {
- /// func makeBody(configuration: Configuration) -> some View {
- /// Label(configuration)
- /// .border(Color.red)
- /// }
- /// }
- ///
- /// For more extensive customization or to create a completely new label style,
- /// you'll need to adopt the ``LabelStyle`` protocol and implement a
- /// ``LabelStyleConfiguration`` for the new style.
- ///
- /// To apply a common label style to a group of labels, apply the style
- /// to the view hierarchy that contains the labels:
- ///
- /// VStack {
- /// Label("Rain", systemImage: "cloud.rain")
- /// Label("Snow", systemImage: "snow")
- /// Label("Sun", systemImage: "sun.max")
- /// }
- /// .labelStyle(.iconOnly)
- ///
- /// It's also possible to make labels using views to compose the label's icon
- /// programmatically, rather than using a pre-made image. In this example, the
- /// icon portion of the label uses a filled ``Circle`` overlaid
- /// with the user's initials:
- ///
- /// Label {
- /// Text(person.fullName)
- /// .font(.body)
- /// .foregroundColor(.primary)
- /// Text(person.title)
- /// .font(.subheadline)
- /// .foregroundColor(.secondary)
- /// } icon: {
- /// Circle()
- /// .fill(person.profileColor)
- /// .frame(width: 44, height: 44, alignment: .center)
- /// .overlay(Text(person.initials))
- /// }
- ///
- public struct Label: View where Title: View, Icon: View {
- @Environment(\.self) private var environment
- @Environment(\.backportLabelStyle) private var style
- private var config: Backport.LabelStyleConfiguration
-
- /// Creates a label with a custom title and icon.
- public init(@ViewBuilder title: () -> Title, @ViewBuilder icon: () -> Icon) {
- config = .init(title: .init(content: title()), icon: .init(content: icon()))
- }
-
- @MainActor public var body: some View {
- if let style = style {
- style.makeBody(configuration: config.environment(environment))
- } else {
- DefaultLabelStyle()
- .makeBody(configuration: config.environment(environment))
- }
- }
- }
-}
-
-@available(macOS 10.15, *)
-public extension Backport.Label where Wrapped == Any, Title == Text, Icon == Image {
- /// Creates a label with an icon image and a title generated from a
- /// localized string.
- ///
- /// - Parameters:
- /// - titleKey: A title generated from a localized string.
- /// - image: The name of the image resource to lookup.
- init(_ titleKey: LocalizedStringKey, image name: String) {
- self.init(title: { Text(titleKey) }, icon: { Image(name) })
- }
-
- /// Creates a label with an icon image and a title generated from a string.
- ///
- /// - Parameters:
- /// - title: A string used as the label's title.
- /// - image: The name of the image resource to lookup.
- init(_ title: S, image name: String) where S: StringProtocol {
- self.init(title: { Text(title) }, icon: { Image(name) })
- }
-}
-
-@available(macOS, introduced: 11, message: "SFSymbols support was only introduced in macOS 11")
-extension Backport.Label where Wrapped == Any, Title == Text, Icon == Image {
- /// Creates a label with a system icon image and a title generated from a
- /// localized string.
- ///
- /// - Parameters:
- /// - titleKey: A title generated from a localized string.
- /// - systemImage: The name of the image resource to lookup.
- public init(_ titleKey: LocalizedStringKey, systemImage name: String) {
- self.init(title: { Text(titleKey) }, icon: { Image(systemName: name) })
- }
-
- /// Creates a label with a system icon image and a title generated from a
- /// string.
- ///
- /// - Parameters:
- /// - title: A string used as the label's title.
- /// - systemImage: The name of the image resource to lookup.
- public init(_ title: S, systemImage name: String) where S: StringProtocol {
- self.init(title: { Text(title) }, icon: { Image(systemName: name) })
- }
-}
-
-@available(macOS 10.15, *)
-public extension Backport.Label
- where Wrapped == Any, Title == Backport.LabelStyleConfiguration.Title, Icon == Backport.LabelStyleConfiguration.Icon
-{
- /// Creates a label representing the configuration of a style.
- ///
- /// You can use this initializer within the ``LabelStyle/makeBody(configuration:)``
- /// method of a ``LabelStyle`` instance to create an instance of the label
- /// that's being styled. This is useful for custom label styles that only
- /// wish to modify the current style, as opposed to implementing a brand new
- /// style.
- ///
- /// For example, the following style adds a red border around the label,
- /// but otherwise preserves the current style:
- ///
- /// struct RedBorderedLabelStyle: LabelStyle {
- /// func makeBody(configuration: Configuration) -> some View {
- /// Label(configuration)
- /// .border(Color.red)
- /// }
- /// }
- ///
- /// - Parameter configuration: The label style to use.
- init(_ configuration: Backport.LabelStyleConfiguration) {
- config = configuration
- }
-}
diff --git a/Packages/ShapsBenkau_SwiftUIBackports/Sources/SwiftUIBackports/Shared/Label/LabelConfiguration.swift b/Packages/ShapsBenkau_SwiftUIBackports/Sources/SwiftUIBackports/Shared/Label/LabelConfiguration.swift
deleted file mode 100755
index 803f1d0b..00000000
--- a/Packages/ShapsBenkau_SwiftUIBackports/Sources/SwiftUIBackports/Shared/Label/LabelConfiguration.swift
+++ /dev/null
@@ -1,52 +0,0 @@
-// (c) 2022 and onwards Shaps Benkau (MIT License).
-// ====================
-// This code is released under the MIT license (SPDX-License-Identifier: MIT)
-
-import SwiftUI
-
-@available(macOS 10.15, *)
-@available(iOS, deprecated: 14)
-@available(macOS, deprecated: 11)
-@available(tvOS, deprecated: 14)
-@available(watchOS, deprecated: 7)
-extension Backport where Wrapped == Any {
- /// The properties of a label.
- public struct LabelStyleConfiguration {
- /// A type-erased title view of a label.
- public struct Title: View {
- let content: AnyView
- public var body: some View { content }
- init(content: Content) {
- self.content = .init(content)
- }
- }
-
- @available(macOS 10.15, *)
- /// A type-erased icon view of a label.
- public struct Icon: View {
- let content: AnyView
- public var body: some View { content }
- init(content: Content) {
- self.content = .init(content)
- }
- }
-
- @available(macOS 10.15, *)
- /// A description of the labeled item.
- public internal(set) var title: LabelStyleConfiguration.Title
-
- @available(macOS 10.15, *)
- /// A symbolic representation of the labeled item.
- public internal(set) var icon: LabelStyleConfiguration.Icon
-
- @available(macOS 10.15, *)
- internal var environment: EnvironmentValues = .init()
-
- @available(macOS 10.15, *)
- func environment(_ values: EnvironmentValues) -> Self {
- var config = self
- config.environment = values
- return config
- }
- }
-}
diff --git a/Packages/ShapsBenkau_SwiftUIBackports/Sources/SwiftUIBackports/Shared/Label/LabelStyle.swift b/Packages/ShapsBenkau_SwiftUIBackports/Sources/SwiftUIBackports/Shared/Label/LabelStyle.swift
deleted file mode 100755
index b81ba6f7..00000000
--- a/Packages/ShapsBenkau_SwiftUIBackports/Sources/SwiftUIBackports/Shared/Label/LabelStyle.swift
+++ /dev/null
@@ -1,72 +0,0 @@
-// (c) 2022 and onwards Shaps Benkau (MIT License).
-// ====================
-// This code is released under the MIT license (SPDX-License-Identifier: MIT)
-
-import SwiftUI
-
-@available(macOS 10.15, *)
-@available(iOS, deprecated: 14)
-@available(macOS, deprecated: 11)
-@available(tvOS, deprecated: 14)
-@available(watchOS, deprecated: 7)
-/// A type that applies a custom appearance to all labels within a view.
-///
-/// To configure the current label style for a view hierarchy, use the
-/// ``View/labelStyle(_:)`` modifier.
-public protocol BackportLabelStyle {
- /// The properties of a label.
- typealias Configuration = Backport.LabelStyleConfiguration
-
- /// A view that represents the body of a label.
- associatedtype Body: View
-
- @available(macOS 10.15, *)
- /// Creates a view that represents the body of a label.
- ///
- /// The system calls this method for each ``Label`` instance in a view
- /// hierarchy where this style is the current label style.
- ///
- /// - Parameter configuration: The properties of the label.
- @ViewBuilder func makeBody(configuration: Configuration) -> Body
-}
-
-@available(macOS 10.15, *)
-@available(iOS, deprecated: 14)
-@available(macOS, deprecated: 11)
-@available(tvOS, deprecated: 14.0)
-@available(watchOS, deprecated: 7.0)
-extension Backport where Wrapped: View {
- public func labelStyle(_ style: S) -> some View {
- content.environment(\.backportLabelStyle, .init(style))
- }
-}
-
-@available(macOS 10.15, *)
-internal struct AnyLabelStyle: BackportLabelStyle {
- let _makeBody: (Backport.LabelStyleConfiguration) -> AnyView
-
- @available(macOS 10.15, *)
- init(_ style: S) {
- _makeBody = { config in
- AnyView(style.makeBody(configuration: config))
- }
- }
-
- @available(macOS 10.15, *)
- func makeBody(configuration: Configuration) -> some View {
- _makeBody(configuration)
- }
-}
-
-@available(macOS 10.15, *)
-private struct BackportLabelStyleEnvironmentKey: EnvironmentKey {
- static var defaultValue: AnyLabelStyle?
-}
-
-@available(macOS 10.15, *)
-extension EnvironmentValues {
- var backportLabelStyle: AnyLabelStyle? {
- get { self[BackportLabelStyleEnvironmentKey.self] }
- set { self[BackportLabelStyleEnvironmentKey.self] = newValue }
- }
-}
diff --git a/Packages/ShapsBenkau_SwiftUIBackports/Sources/SwiftUIBackports/Shared/Label/Styles/DefaultLabelStyle.swift b/Packages/ShapsBenkau_SwiftUIBackports/Sources/SwiftUIBackports/Shared/Label/Styles/DefaultLabelStyle.swift
deleted file mode 100755
index 0bc39b75..00000000
--- a/Packages/ShapsBenkau_SwiftUIBackports/Sources/SwiftUIBackports/Shared/Label/Styles/DefaultLabelStyle.swift
+++ /dev/null
@@ -1,44 +0,0 @@
-// (c) 2022 and onwards Shaps Benkau (MIT License).
-// ====================
-// This code is released under the MIT license (SPDX-License-Identifier: MIT)
-
-import SwiftUI
-
-@available(macOS 10.15, *)
-@available(iOS, deprecated: 14)
-@available(macOS, deprecated: 11)
-@available(tvOS, deprecated: 14)
-@available(watchOS, deprecated: 7)
-extension Backport where Wrapped == Any {
- /// The default label style in the current context.
- ///
- /// You can also use ``LabelStyle/automatic`` to construct this style.
- public struct DefaultLabelStyle: BackportLabelStyle {
- public init() {}
-
- @available(macOS 10.15, *)
- /// Creates a view that represents the body of a label.
- ///
- /// The system calls this method for each ``Label`` instance in a view
- /// hierarchy where this style is the current label style.
- ///
- /// - Parameter configuration: The properties of the label.
- public func makeBody(configuration: DefaultLabelStyle.Configuration) -> some View {
- HStack {
- configuration.icon
- configuration.title
- }
- }
- }
-}
-
-@available(macOS 10.15, *)
-@available(iOS, deprecated: 14)
-@available(macOS, deprecated: 11)
-@available(tvOS, deprecated: 14)
-@available(watchOS, deprecated: 7)
-extension BackportLabelStyle where Self == Backport.DefaultLabelStyle {
- /// A label style that resolves its appearance automatically based on the
- /// current context.
- public static var automatic: Self { .init() }
-}
diff --git a/Packages/ShapsBenkau_SwiftUIBackports/Sources/SwiftUIBackports/Shared/Label/Styles/IconOnlyLabelStyle.swift b/Packages/ShapsBenkau_SwiftUIBackports/Sources/SwiftUIBackports/Shared/Label/Styles/IconOnlyLabelStyle.swift
deleted file mode 100755
index 005e1e18..00000000
--- a/Packages/ShapsBenkau_SwiftUIBackports/Sources/SwiftUIBackports/Shared/Label/Styles/IconOnlyLabelStyle.swift
+++ /dev/null
@@ -1,44 +0,0 @@
-// (c) 2022 and onwards Shaps Benkau (MIT License).
-// ====================
-// This code is released under the MIT license (SPDX-License-Identifier: MIT)
-
-import SwiftUI
-
-@available(macOS 10.15, *)
-@available(iOS, deprecated: 14)
-@available(macOS, deprecated: 11)
-@available(tvOS, deprecated: 14)
-@available(watchOS, deprecated: 7)
-extension Backport where Wrapped == Any {
- /// A label style that only displays the icon of the label.
- ///
- /// You can also use ``LabelStyle/iconOnly`` to construct this style.
- public struct IconOnlyLabelStyle: BackportLabelStyle {
- /// Creates an icon-only label style.
- public init() {}
-
- @available(macOS 10.15, *)
- /// Creates a view that represents the body of a label.
- ///
- /// The system calls this method for each ``Label`` instance in a view
- /// hierarchy where this style is the current label style.
- ///
- /// - Parameter configuration: The properties of the label.
- public func makeBody(configuration: Configuration) -> some View {
- configuration.icon
- }
- }
-}
-
-@available(macOS 10.15, *)
-@available(iOS, deprecated: 14)
-@available(macOS, deprecated: 11)
-@available(tvOS, deprecated: 14)
-@available(watchOS, deprecated: 7)
-extension BackportLabelStyle where Self == Backport.IconOnlyLabelStyle {
- /// A label style that only displays the icon of the label.
- ///
- /// The title of the label is still used for non-visual descriptions, such as
- /// VoiceOver.
- public static var iconOnly: Self { .init() }
-}
diff --git a/Packages/ShapsBenkau_SwiftUIBackports/Sources/SwiftUIBackports/Shared/Label/Styles/TitleAndIconLabelStyle.swift b/Packages/ShapsBenkau_SwiftUIBackports/Sources/SwiftUIBackports/Shared/Label/Styles/TitleAndIconLabelStyle.swift
deleted file mode 100755
index cd7970ac..00000000
--- a/Packages/ShapsBenkau_SwiftUIBackports/Sources/SwiftUIBackports/Shared/Label/Styles/TitleAndIconLabelStyle.swift
+++ /dev/null
@@ -1,70 +0,0 @@
-// (c) 2022 and onwards Shaps Benkau (MIT License).
-// ====================
-// This code is released under the MIT license (SPDX-License-Identifier: MIT)
-
-import SwiftUI
-
-@available(macOS 10.15, *)
-@available(iOS, deprecated: 14)
-@available(macOS, deprecated: 11)
-@available(tvOS, deprecated: 14)
-@available(watchOS, deprecated: 7)
-extension Backport where Wrapped == Any {
- /// A label style that shows both the title and icon of the label using a
- /// system-standard layout.
- ///
- /// You can also use ``LabelStyle/titleAndIcon`` to construct this style.
- public struct TitleAndIconLabelStyle: BackportLabelStyle {
- /// Creates a label style that shows both the title and icon of the label
- /// using a system-standard layout.
- public init() {}
-
- @available(macOS 10.15, *)
- /// Creates a view that represents the body of a label.
- ///
- /// The system calls this method for each ``Label`` instance in a view
- /// hierarchy where this style is the current label style.
- ///
- /// - Parameter configuration: The properties of the label.
- public func makeBody(configuration: Configuration) -> some View {
- HStack {
- configuration.icon
- configuration.title
- }
- }
- }
-}
-
-@available(macOS 10.15, *)
-@available(iOS, deprecated: 14)
-@available(macOS, deprecated: 11)
-@available(tvOS, deprecated: 14)
-@available(watchOS, deprecated: 7)
-extension BackportLabelStyle where Self == Backport.TitleAndIconLabelStyle {
- /// A label style that shows both the title and icon of the label using a
- /// system-standard layout.
- ///
- /// In most cases, labels show both their title and icon by default. However,
- /// some containers might apply a different default label style to their
- /// content, such as only showing icons within toolbars on macOS and iOS. To
- /// opt in to showing both the title and the icon, you can apply the title
- /// and icon label style:
- ///
- /// Label("Lightning", systemImage: "bolt.fill")
- /// .labelStyle(.titleAndIcon)
- ///
- /// To apply the title and icon style to a group of labels, apply the style
- /// to the view hierarchy that contains the labels:
- ///
- /// VStack {
- /// Label("Rain", systemImage: "cloud.rain")
- /// Label("Snow", systemImage: "snow")
- /// Label("Sun", systemImage: "sun.max")
- /// }
- /// .labelStyle(.titleAndIcon)
- ///
- /// The relative layout of the title and icon is dependent on the context it
- /// is displayed in. In most cases, however, the label is arranged
- /// horizontally with the icon leading.
- public static var titleAndIcon: Self { .init() }
-}
diff --git a/Packages/ShapsBenkau_SwiftUIBackports/Sources/SwiftUIBackports/Shared/Label/Styles/TitleOnlyLabelStyle.swift b/Packages/ShapsBenkau_SwiftUIBackports/Sources/SwiftUIBackports/Shared/Label/Styles/TitleOnlyLabelStyle.swift
deleted file mode 100755
index 6fb012a6..00000000
--- a/Packages/ShapsBenkau_SwiftUIBackports/Sources/SwiftUIBackports/Shared/Label/Styles/TitleOnlyLabelStyle.swift
+++ /dev/null
@@ -1,41 +0,0 @@
-// (c) 2022 and onwards Shaps Benkau (MIT License).
-// ====================
-// This code is released under the MIT license (SPDX-License-Identifier: MIT)
-
-import SwiftUI
-
-@available(macOS 10.15, *)
-@available(iOS, deprecated: 14)
-@available(macOS, deprecated: 11)
-@available(tvOS, deprecated: 14)
-@available(watchOS, deprecated: 7)
-extension Backport where Wrapped == Any {
- // A label style that only displays the title of the label.
- ///
- /// You can also use ``LabelStyle/titleOnly`` to construct this style.
- public struct TitleOnlyLabelStyle: BackportLabelStyle {
- /// Creates a title-only label style.
- public init() {}
-
- @available(macOS 10.15, *)
- /// Creates a view that represents the body of a label.
- ///
- /// The system calls this method for each ``Label`` instance in a view
- /// hierarchy where this style is the current label style.
- ///
- /// - Parameter configuration: The properties of the label.
- public func makeBody(configuration: Configuration) -> some View {
- configuration.title
- }
- }
-}
-
-@available(macOS 10.15, *)
-@available(iOS, deprecated: 14)
-@available(macOS, deprecated: 11)
-@available(tvOS, deprecated: 14)
-@available(watchOS, deprecated: 7)
-extension BackportLabelStyle where Self == Backport.TitleOnlyLabelStyle {
- /// A label style that only displays the title of the label.
- public static var titleOnly: Self { .init() }
-}
diff --git a/Packages/ShapsBenkau_SwiftUIBackports/Sources/SwiftUIBackports/Shared/LabeledContent/LabeledContent.swift b/Packages/ShapsBenkau_SwiftUIBackports/Sources/SwiftUIBackports/Shared/LabeledContent/LabeledContent.swift
deleted file mode 100755
index 3cc9cec2..00000000
--- a/Packages/ShapsBenkau_SwiftUIBackports/Sources/SwiftUIBackports/Shared/LabeledContent/LabeledContent.swift
+++ /dev/null
@@ -1,275 +0,0 @@
-// (c) 2022 and onwards Shaps Benkau (MIT License).
-// ====================
-// This code is released under the MIT license (SPDX-License-Identifier: MIT)
-
-import SwiftUI
-
-@available(macOS 10.15, *)
-@available(iOS, deprecated: 16)
-@available(tvOS, deprecated: 16)
-@available(macOS, deprecated: 13)
-@available(watchOS, deprecated: 9)
-extension Backport where Wrapped == Any {
- /// A container for attaching a label to a value-bearing view.
- ///
- /// The instance's content represents a read-only or read-write value, and its
- /// label identifies or describes the purpose of that value.
- /// The resulting element has a layout that's consistent with other framework
- /// controls and automatically adapts to its container, like a form or toolbar.
- /// Some styles of labeled content also apply styling or behaviors to the value
- /// content, like making ``Text`` views selectable.
- ///
- /// The following example associates a label with a custom view and has
- /// a layout that matches the label of the ``Picker``:
- ///
- /// Form {
- /// Backport.LabeledContent("Custom Value") {
- /// MyCustomView(value: $value)
- /// }
- /// Picker("Selected Value", selection: $selection) {
- /// PickerOption("Option 1", 1)
- /// PickerOption("Option 2", 2)
- /// }
- /// }
- ///
- /// ### Custom view labels
- ///
- /// You can assemble labeled content with an explicit view for its label
- /// using the ``init(content:label:)`` initializer. For example, you can
- /// rewrite the previous labeled content example using a ``Text`` view:
- ///
- /// LabeledContent {
- /// MyCustomView(value: $value)
- /// } label: {
- /// Text("Custom Value")
- /// }
- ///
- /// The `label` view builder accepts any kind of view, like a ``Label``:
- ///
- /// Backport.LabeledContent {
- /// MyCustomView(value: $value)
- /// } label: {
- /// Label("Custom Value", systemImage: "hammer")
- /// }
- ///
- /// ### Textual labeled content
- ///
- /// You can construct labeled content with string values or formatted values
- /// to create read-only displays of textual values:
- ///
- /// Form {
- /// Section("Information") {
- /// Backport.LabeledContent("Name", value: person.name)
- /// }
- /// if !person.pets.isEmpty {
- /// Section("Pets") {
- /// ForEach(pet) { pet in
- /// Backport.LabeledContent(pet.species, value: pet.name)
- /// }
- /// }
- /// }
- /// }
- ///
- /// Wherever possible, SwiftUI makes this text selectable.
- ///
- /// ### Compositional elements
- ///
- /// You can use labeled content as the label for other elements. For example,
- /// a ``NavigationLink`` can present a summary value for the destination it
- /// links to:
- ///
- /// Form {
- /// NavigationLink(value: Settings.wifiDetail) {
- /// Backport.LabeledContent("Wi-Fi", value: ssidName)
- /// }
- /// }
- ///
- /// In some cases, the styling of views used as the value content is
- /// specialized as well. For example, while a ``Toggle`` in an inset group
- /// form on macOS is styled as a switch by default, it's styled as a checkbox
- /// when used as a value element within a surrounding `LabeledContent`
- /// instance:
- ///
- /// Form {
- /// Backport.LabeledContent("Source Control") {
- /// Toggle("Refresh local status automatically",
- /// isOn: $refreshLocalStatus)
- /// Toggle("Fetch and refresh server status automatically",
- /// isOn: $refreshServerStatus)
- /// Toggle("Add and remove files automatically",
- /// isOn: $addAndRemoveFiles)
- /// Toggle("Select files to commit automatically",
- /// isOn: $selectFiles)
- /// }
- /// }
- ///
- /// ### Controlling label visibility
- ///
- /// A label communicates the identity or purpose of the value, which is
- /// important for accessibility. However, you might want to hide the label
- /// in the display, and some controls or contexts may visually hide their label
- /// by default. The ``View/labels(_:)`` modifier allows controlling that
- /// visibility. The following example hides both labels, producing only a
- /// group of the two value views:
- ///
- /// Group {
- /// LabeledContent("Custom Value") {
- /// MyCustomView(value: $value)
- /// }
- /// Picker("Selected Value", selection: $selection) {
- /// PickerOption("Option 1", 1)
- /// PickerOption("Option 2", 2)
- /// }
- /// }
- /// .labelsHidden()
- ///
- /// ### Styling labeled content
- ///
- /// You can set label styles using the ``View/labeledContentStyle(_:)``
- /// modifier. You can also build custom styles using ``LabeledContentStyle``.
- public struct LabeledContent