Skip to content

Instantly share code, notes, and snippets.

@erica
Last active August 27, 2021 06:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save erica/6941e2adfce75807bcd64550b3669c26 to your computer and use it in GitHub Desktop.
Save erica/6941e2adfce75807bcd64550b3669c26 to your computer and use it in GitHub Desktop.
1d0
< import AppKit
9a9
> import StoreKit
10a11
> import UIKit
25,35c26,28
< @available(OSX 10.15, *)
< @available(iOS, unavailable)
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
< public static let delete: AccessibilityActionKind
<
< @available(OSX 10.15, *)
< @available(iOS, unavailable)
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
< public static let showMenu: AccessibilityActionKind
---
> @available(iOS 13.0, tvOS 13.0, watchOS 6.0, *)
> @available(OSX, unavailable)
> public static let magicTap: AccessibilityActionKind
443c436
< /// `OptionSet` types, this method returns any intersection between the
---
> /// `OptionSet` types, this method returns any intersection between the
463a457,468
> /// A storage type for an action sheet presentation.
> @available(iOS 13.0, tvOS 13.0, watchOS 6.0, *)
> @available(OSX, unavailable)
> public struct ActionSheet {
>
> /// Creates an action sheet with the provided buttons.
> public init(title: Text, message: Text? = nil, buttons: [ActionSheet.Button] = [.cancel()])
>
> /// A button representing an operation of an action sheet presentation.
> public typealias Button = Alert.Button
> }
>
589c594
< extension Anchor.Source {
---
> extension Anchor.Source where Value == CGRect {
591,595c596,597
< public init<T>(_ array: [Anchor<T>.Source]) where Value == [T]
< }
<
< @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
< extension Anchor.Source {
---
> /// Returns an anchor source rect defined by `r` in the current view.
> public static func rect(_ r: CGRect) -> Anchor<Value>.Source
597c599,601
< public init<T>(_ anchor: Anchor<T>.Source?) where Value == T?
---
> /// An anchor source rect defined as the entire bounding rect of the current
> /// view.
> public static var bounds: Anchor<CGRect>.Source { get }
627c631
< extension Anchor.Source where Value == CGRect {
---
> extension Anchor.Source {
629,630c633,637
< /// Returns an anchor source rect defined by `r` in the current view.
< public static func rect(_ r: CGRect) -> Anchor<Value>.Source
---
> public init<T>(_ array: [Anchor<T>.Source]) where Value == [T]
> }
>
> @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
> extension Anchor.Source {
632,634c639
< /// An anchor source rect defined as the entire bounding rect of the current
< /// view.
< public static var bounds: Anchor<CGRect>.Source { get }
---
> public init<T>(_ anchor: Anchor<T>.Source?) where Value == T?
670a676,685
> /// Returns a Boolean value indicating whether two values are equal.
> ///
> /// Equality is the inverse of inequality. For any values `a` and `b`,
> /// `a == b` implies that `a != b` is `false`.
> ///
> /// - Parameters:
> /// - lhs: A value to compare.
> /// - rhs: Another value to compare.
> public static func == (a: Angle, b: Angle) -> Bool
>
694,703d708
<
< /// Returns a Boolean value indicating whether two values are equal.
< ///
< /// Equality is the inverse of inequality. For any values `a` and `b`,
< /// `a == b` implies that `a != b` is `false`.
< ///
< /// - Parameters:
< /// - lhs: A value to compare.
< /// - rhs: Another value to compare.
< public static func == (a: Angle, b: Angle) -> Bool
884,889d888
< public static let `default`: Animation
< }
<
< @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
< extension Animation {
<
917,919c916
< public func repeatCount(_ repeatCount: Int, autoreverses: Bool = true) -> Animation
<
< public func repeatForever(autoreverses: Bool = true) -> Animation
---
> public static let `default`: Animation
980a978,985
> extension Animation {
>
> public func repeatCount(_ repeatCount: Int, autoreverses: Bool = true) -> Animation
>
> public func repeatForever(autoreverses: Bool = true) -> Animation
> }
>
> @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
1061,1065c1066,1068
< /// A transition that inserts by moving in from the leading edge, and
< /// removes by moving out towards the trailing edge.
< ///
< /// - SeeAlso: `AnyTransition.move(edge:)`
< public static var slide: AnyTransition { get }
---
> public static func offset(_ offset: CGSize) -> AnyTransition
>
> public static func offset(x: CGFloat = 0, y: CGFloat = 0) -> AnyTransition
1071c1074
< public static func offset(_ offset: CGSize) -> AnyTransition
---
> public static var scale: AnyTransition { get }
1073c1076
< public static func offset(x: CGFloat = 0, y: CGFloat = 0) -> AnyTransition
---
> public static func scale(scale: CGFloat, anchor: UnitPoint = .center) -> AnyTransition
1079,1081c1082,1084
< /// Combines this transition with another, returning a new transition that
< /// is the result of both transitions being applied.
< public func combined(with other: AnyTransition) -> AnyTransition
---
> /// A transition from transparent to opaque on insertion, and from opaque to
> /// transparent on removal.
> public static let opacity: AnyTransition
1087,1089c1090,1094
< public static var scale: AnyTransition { get }
<
< public static func scale(scale: CGFloat, anchor: UnitPoint = .center) -> AnyTransition
---
> /// A transition that inserts by moving in from the leading edge, and
> /// removes by moving out towards the trailing edge.
> ///
> /// - SeeAlso: `AnyTransition.move(edge:)`
> public static var slide: AnyTransition { get }
1095,1097c1100,1102
< /// A transition from transparent to opaque on insertion, and from opaque to
< /// transparent on removal.
< public static let opacity: AnyTransition
---
> /// Combines this transition with another, returning a new transition that
> /// is the result of both transitions being applied.
> public func combined(with other: AnyTransition) -> AnyTransition
1111,1113c1116,1117
< /// Provides a composite transition that uses a different transition for
< /// insertion versus removal.
< public static func asymmetric(insertion: AnyTransition, removal: AnyTransition) -> AnyTransition
---
> /// Attaches an animation to this transition.
> public func animation(_ animation: Animation?) -> AnyTransition
1135,1136c1139,1141
< /// Attaches an animation to this transition.
< public func animation(_ animation: Animation?) -> AnyTransition
---
> /// Provides a composite transition that uses a different transition for
> /// insertion versus removal.
> public static func asymmetric(insertion: AnyTransition, removal: AnyTransition) -> AnyTransition
1803a1809,1830
> /// Creates a binding by projecting the base value to an optional value.
> ///
> /// - Parameter base: A value to project to an optional value.
> public init<V>(_ base: Binding<V>) where Value == V?
>
> /// Creates a binding by projecting the base value to an unwrapped value.
> ///
> /// - Parameter base: A value to project to an unwrapped value.
> ///
> /// - Returns: A new binding or `nil` when `base` is `nil`.
> public init?(_ base: Binding<Value?>)
>
> /// Creates a binding by projecting the base value to a hashable value.
> ///
> /// - Parameters:
> /// - base: A `Hashable` value to project to an `AnyHashable` value.
> public init<V>(_ base: Binding<V>) where Value == AnyHashable, V : Hashable
> }
>
> @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
> extension Binding {
>
1824,1845d1850
< @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
< extension Binding {
<
< /// Creates a binding by projecting the base value to an optional value.
< ///
< /// - Parameter base: A value to project to an optional value.
< public init<V>(_ base: Binding<V>) where Value == V?
<
< /// Creates a binding by projecting the base value to an unwrapped value.
< ///
< /// - Parameter base: A value to project to an unwrapped value.
< ///
< /// - Returns: A new binding or `nil` when `base` is `nil`.
< public init?(_ base: Binding<Value?>)
<
< /// Creates a binding by projecting the base value to a hashable value.
< ///
< /// - Parameters:
< /// - base: A `Hashable` value to project to an `AnyHashable` value.
< public init<V>(_ base: Binding<V>) where Value == AnyHashable, V : Hashable
< }
<
1935,2037d1939
< /// A menu style that displays a bordered button that toggles the display of the
< /// menu's contents when pressed.
< ///
< /// On macOS, the button displays an arrow indicating that it presents a menu.
< ///
< /// Pressing and then dragging into the contents triggers the chosen action on
< /// release.
< @available(OSX 10.16, *)
< @available(iOS, unavailable)
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
< public struct BorderedButtonMenuStyle : MenuStyle {
<
< /// Creates a button menu style.
< public init()
<
< /// Creates a view that represents the body of a menu.
< ///
< /// - Parameter configuration: The properties of the menu.
< ///
< /// The system calls this method for each `Menu` instance in a view
< /// hierarchy where this style is the current menu style.
< public func makeBody(configuration: BorderedButtonMenuStyle.Configuration) -> some View
<
<
< /// A view that represents the body of a menu.
< public typealias Body = some View
< }
<
< /// A button style that applies standard border artwork based on the button's
< /// context.
< ///
< /// To apply this style to a button, or to a view that contains buttons, use the
< /// ``View/buttonStyle(_:)`` modifier.
< @available(OSX 10.15, tvOS 13.0, watchOS 7.0, *)
< @available(iOS, unavailable)
< public struct BorderedButtonStyle : PrimitiveButtonStyle {
<
< /// Creates a bordered button style.
< public init()
<
< /// Creates a view that represents the body of a button.
< ///
< /// The system calls this method for each ``Button`` instance in a view
< /// hierarchy where this style is the current button style.
< ///
< /// - Parameter configuration : The properties of the button.
< public func makeBody(configuration: BorderedButtonStyle.Configuration) -> some View
<
<
< /// A view that represents the body of a button.
< public typealias Body = some View
< }
<
< /// A menu button style which manifests as a borderless button with no
< /// visual embelishments.
< @available(iOS, unavailable)
< @available(OSX, introduced: 10.15, deprecated: 100000.0, message: "Use `BorderlessButtonMenuStyle` instead.")
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
< public struct BorderlessButtonMenuButtonStyle : MenuButtonStyle {
<
< public init()
< }
<
< /// A menu style that displays a borderless button that toggles the display of
< /// the menu's contents when pressed.
< ///
< /// On macOS, the button optionally displays an arrow indicating that it presents
< /// a menu.
< ///
< /// Pressing and then dragging into the contents triggers the chosen action on
< /// release.
< @available(OSX 10.16, *)
< @available(iOS, unavailable)
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
< public struct BorderlessButtonMenuStyle : MenuStyle {
<
< /// Creates a borderless button menu style.
< public init()
<
< /// Creates a borderless button menu style.
< ///
< /// - Parameter showsMenuIndicator: A Boolean indicating whether the button
< /// should include a visual indicator that it represents a menu, such as
< /// an arrow. Defaults to `true`.
< @available(iOS, unavailable)
< public init(showsMenuIndicator: Bool)
<
< /// Creates a view that represents the body of a menu.
< ///
< /// - Parameter configuration: The properties of the menu.
< ///
< /// The system calls this method for each `Menu` instance in a view
< /// hierarchy where this style is the current menu style.
< public func makeBody(configuration: BorderlessButtonMenuStyle.Configuration) -> some View
<
<
< /// A view that represents the body of a menu.
< public typealias Body = some View
< }
<
2063,2072d1964
< /// A menu button style which manifests as a borderless pull-down button.
< @available(iOS, unavailable)
< @available(OSX, introduced: 10.15, deprecated: 100000.0, message: "Use `BorderlessButtonMenuStyle` instead.")
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
< public struct BorderlessPullDownMenuButtonStyle : MenuButtonStyle {
<
< public init()
< }
<
2307,2333d2198
< /// A toggle style that displays a checkbox followed by its label.
< ///
< /// To apply this style to a toggle, or to a view that contains toggles, use the
< /// ``View/toggleStyle(_:)`` modifier.
< @available(OSX 10.15, *)
< @available(iOS, unavailable)
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
< public struct CheckboxToggleStyle : ToggleStyle {
<
< /// Creates a checkbox toggle style.
< public init()
<
< /// Creates a view that represents the body of a toggle.
< ///
< /// The system calls this method for each ``Toggle`` instance in a view
< /// hierarchy where this style is the current toggle style.
< ///
< /// - Parameter configuration: The properties of the toggle, such as its
< /// label and its “on” state.
< public func makeBody(configuration: CheckboxToggleStyle.Configuration) -> some View
<
<
< /// A view that represents the appearance and interaction of a toggle.
< public typealias Body = some View
< }
<
2465,2474d2329
< @available(OSX 10.15, *)
< @available(iOS, unavailable)
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
< extension Color {
<
< /// Creates a color from an instance of `NSColor`.
< public init(_ color: NSColor)
< }
<
2539,2542d2393
< extension Color : ShapeStyle {
< }
<
< @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
2545,2549c2396,2414
< /// A set of colors that are used by system elements and applications.
< public static let clear: Color
<
< public static let black: Color
<
---
> /// A color that represents the system or application accent color.
> ///
> /// The accent color reflects the broad theme color that can be applied to
> /// views and controls. If an explicit value hasn't been set, the default
> /// application or system accent color will be used.
> ///
> /// On macOS, customization of the accent color is only used if the
> /// "Multicolor" accent color is selected in System Preferences.
> public static var accentColor: Color { get }
> }
>
> @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
> extension Color {
>
> /// A set of colors that are used by system elements and applications.
> public static let clear: Color
>
> public static let black: Color
>
2574,2584c2439
< extension Color {
<
< /// A color that represents the system or application accent color.
< ///
< /// The accent color reflects the broad theme color that can be applied to
< /// views and controls. If an explicit value hasn't been set, the default
< /// application or system accent color will be used.
< ///
< /// On macOS, customization of the accent color is only used if the
< /// "Multicolor" accent color is selected in System Preferences.
< public static var accentColor: Color { get }
---
> extension Color : ShapeStyle {
2597a2453,2460
> @available(iOS 13.0, tvOS 13.0, watchOS 6.0, *)
> @available(OSX, unavailable)
> extension Color {
>
> /// Creates a color from an instance of `UIColor`.
> public init(_ color: UIColor)
> }
>
2784a2648,2656
> extension ColorScheme {
>
> /// Create a color scheme from its UIUserInterfaceStyle equivalent.
> @available(iOS 14.0, tvOS 14.0, *)
> @available(OSX, unavailable)
> @available(watchOS, unavailable)
> public init?(_ uiUserInterfaceStyle: UIUserInterfaceStyle)
> }
>
2849a2722,2730
> extension ColorSchemeContrast {
>
> /// Create a contrast from its UIAccessibilityContrast equivalent.
> @available(iOS 14.0, tvOS 14.0, *)
> @available(OSX, unavailable)
> @available(watchOS, unavailable)
> public init?(_ uiAccessibilityContrast: UIAccessibilityContrast)
> }
>
3361a3243,3251
> extension ContentSizeCategory {
>
> /// Create a size category from its UIContentSizeCateogry equivalent.
> @available(iOS 14.0, tvOS 14.0, *)
> @available(OSX, unavailable)
> @available(watchOS, unavailable)
> public init?(_ uiSizeCategory: UIContentSizeCategory)
> }
>
3374,3509d3263
< @available(macCatalyst 13.0, OSX 10.15, *)
< @available(iOS, unavailable)
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
< public enum ControlActiveState : Equatable, CaseIterable {
<
< case key
<
< case active
<
< case inactive
<
< /// Returns a Boolean value indicating whether two values are equal.
< ///
< /// Equality is the inverse of inequality. For any values `a` and `b`,
< /// `a == b` implies that `a != b` is `false`.
< ///
< /// - Parameters:
< /// - lhs: A value to compare.
< /// - rhs: Another value to compare.
< public static func == (a: ControlActiveState, b: ControlActiveState) -> Bool
<
< /// The hash value.
< ///
< /// Hash values are not guaranteed to be equal across different executions of
< /// your program. Do not save hash values to use during a future execution.
< ///
< /// - Important: `hashValue` is deprecated as a `Hashable` requirement. To
< /// conform to `Hashable`, implement the `hash(into:)` requirement instead.
< public var hashValue: Int { get }
<
< /// Hashes the essential components of this value by feeding them into the
< /// given hasher.
< ///
< /// Implement this method to conform to the `Hashable` protocol. The
< /// components used for hashing must be the same as the components compared
< /// in your type's `==` operator implementation. Call `hasher.combine(_:)`
< /// with each of these components.
< ///
< /// - Important: Never call `finalize()` on `hasher`. Doing so may become a
< /// compile-time error in the future.
< ///
< /// - Parameter hasher: The hasher to use when combining the components
< /// of this instance.
< public func hash(into hasher: inout Hasher)
<
< /// A type that can represent a collection of all values of this type.
< public typealias AllCases = [ControlActiveState]
<
< /// A collection of all values of this type.
< public static var allCases: [ControlActiveState] { get }
< }
<
< @available(macCatalyst 13.0, OSX 10.15, *)
< @available(iOS, unavailable)
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
< extension ControlActiveState : Hashable {
< }
<
< /// The size classes, like regular or small, that you can apply to controls
< /// within a view.
< @available(OSX 10.15, *)
< @available(iOS, unavailable)
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
< public enum ControlSize : CaseIterable {
<
< /// A control version that is the default size.
< case regular
<
< /// A control version that is proportionally smaller size for space-constrained views.
< case small
<
< /// A control version that is minimally sized.
< case mini
<
< /// A control version that is prominently sized.
< @available(OSX 10.16, *)
< case large
<
< /// A collection of all values of this type.
< public static var allCases: [ControlSize] { get }
<
< /// Returns a Boolean value indicating whether two values are equal.
< ///
< /// Equality is the inverse of inequality. For any values `a` and `b`,
< /// `a == b` implies that `a != b` is `false`.
< ///
< /// - Parameters:
< /// - lhs: A value to compare.
< /// - rhs: Another value to compare.
< public static func == (a: ControlSize, b: ControlSize) -> Bool
<
< /// The hash value.
< ///
< /// Hash values are not guaranteed to be equal across different executions of
< /// your program. Do not save hash values to use during a future execution.
< ///
< /// - Important: `hashValue` is deprecated as a `Hashable` requirement. To
< /// conform to `Hashable`, implement the `hash(into:)` requirement instead.
< public var hashValue: Int { get }
<
< /// Hashes the essential components of this value by feeding them into the
< /// given hasher.
< ///
< /// Implement this method to conform to the `Hashable` protocol. The
< /// components used for hashing must be the same as the components compared
< /// in your type's `==` operator implementation. Call `hasher.combine(_:)`
< /// with each of these components.
< ///
< /// - Important: Never call `finalize()` on `hasher`. Doing so may become a
< /// compile-time error in the future.
< ///
< /// - Parameter hasher: The hasher to use when combining the components
< /// of this instance.
< public func hash(into hasher: inout Hasher)
<
< /// A type that can represent a collection of all values of this type.
< public typealias AllCases = [ControlSize]
< }
<
< @available(OSX 10.15, *)
< @available(iOS, unavailable)
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
< extension ControlSize : Equatable {
< }
<
< @available(OSX 10.15, *)
< @available(iOS, unavailable)
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
< extension ControlSize : Hashable {
< }
<
3796,3798d3549
< /// The type of the elements of an array literal.
< public typealias ArrayLiteralElement = DatePickerComponents
<
3805a3557,3559
>
> /// The type of the elements of an array literal.
> public typealias ArrayLiteralElement = DatePickerComponents
3907,3957d3660
< /// The default menu button style.
< @available(iOS, unavailable)
< @available(OSX, introduced: 10.15, deprecated: 100000.0, message: "Use `DefaultMenuStyle` instead.")
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
< public struct DefaultMenuButtonStyle : MenuButtonStyle {
<
< public init()
< }
<
< /// The default menu style, based on the menu's context.
< ///
< /// The default menu style can vary by platform. By default, macOS uses the
< /// bordered button style.
< ///
< /// If you create a menu inside a container, the style resolves to the
< /// recommended style for menus inside that container for that specific platform.
< /// For example, a menu nested within another menu will resolve to a submenu:
< ///
< /// Menu("Edit") {
< /// Menu("Arrange") {
< /// Button("Bring to Front", action: moveSelectionToFront)
< /// Button("Send to Back", action: moveSelectionToBack)
< /// }
< /// Button("Delete", action: deleteSelection)
< /// }
< ///
< /// You can override a menu's style. To apply the default style to a menu, or to
< /// a view that contains a menu, use the `menuStyle(_:)` modifier.
< @available(OSX 10.16, *)
< @available(iOS, unavailable)
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
< public struct DefaultMenuStyle : MenuStyle {
<
< /// Creates a default menu style.
< public init()
<
< /// Creates a view that represents the body of a menu.
< ///
< /// - Parameter configuration: The properties of the menu.
< ///
< /// The system calls this method for each `Menu` instance in a view
< /// hierarchy where this style is the current menu style.
< public func makeBody(configuration: DefaultMenuStyle.Configuration) -> some View
<
<
< /// A view that represents the body of a menu.
< public typealias Body = some View
< }
<
4063,4083d3765
< /// The default window style.
< @available(macCatalyst 14.0, OSX 10.16, *)
< @available(iOS, unavailable)
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
< public struct DefaultWindowStyle : WindowStyle {
<
< public init()
< }
<
< /// The default window toolbar style.
< @available(macCatalyst 14.0, OSX 10.16, *)
< @available(iOS, unavailable)
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
< public struct DefaultWindowToolbarStyle : WindowToolbarStyle {
<
< /// Creates a default window toolbar style.
< public init()
< }
<
4235a3918,3940
> extension DocumentGroup where Document : FileDocument {
>
> /// Creates a document group that is able to create and edit file documents.
> ///
> /// - Parameters:
> /// - newDocument: The initial document used when the user creates
> /// a new document.
> /// - editor: The editing UI for the provided document.
> public init(newDocument: @autoclosure @escaping () -> Document, @ViewBuilder editor: @escaping (FileDocumentConfiguration<Document>) -> Content)
>
> /// Creates a document group that is able to view file documents.
> ///
> /// - Parameters:
> /// - documentType: The type of document being viewed.
> /// - viewer: The viewing UI for the provided document.
> ///
> /// - See Also: `CFBundleTypeRole` with a value of "Viewer"
> public init(viewing documentType: Document.Type, @ViewBuilder viewer: @escaping (FileDocumentConfiguration<Document>) -> Content)
> }
>
> @available(iOS 14.0, OSX 10.16, *)
> @available(tvOS, unavailable)
> @available(watchOS, unavailable)
4268,4290d3972
< @available(iOS 14.0, OSX 10.16, *)
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
< extension DocumentGroup where Document : FileDocument {
<
< /// Creates a document group that is able to create and edit file documents.
< ///
< /// - Parameters:
< /// - newDocument: The initial document used when the user creates
< /// a new document.
< /// - editor: The editing UI for the provided document.
< public init(newDocument: @autoclosure @escaping () -> Document, @ViewBuilder editor: @escaping (FileDocumentConfiguration<Document>) -> Content)
<
< /// Creates a document group that is able to view file documents.
< ///
< /// - Parameters:
< /// - documentType: The type of document being viewed.
< /// - viewer: The viewing UI for the provided document.
< ///
< /// - See Also: `CFBundleTypeRole` with a value of "Viewer"
< public init(viewing documentType: Document.Type, @ViewBuilder viewer: @escaping (FileDocumentConfiguration<Document>) -> Content)
< }
<
4651c4333
< /// Sets the insert action for the dynamic view.
---
> /// Sets the move action for the dynamic view.
4654,4657c4336,4337
< /// - supportedContentTypes: An array of UTI types that the dynamic
< /// view supports.
< /// - action: A closure that SwiftUI invokes when elements are added to
< /// the view. The closure takes two arguments: The first argument is the
---
> /// - action: A closure that SwiftUI invokes when elements in the dynamic
> /// view are moved. The closure takes two arguments that represent the
4659,4661c4339
< /// The second argument is an array of
< /// <doc://com.apple.documentation/documentation/Foundation/NSItemProvider> items that
< /// represents the data that you want to insert.
---
> /// Pass `nil` to disable the ability to move items.
4663,4664c4341,4363
< /// - Returns: A view that calls `action` when elements are inserted into
< /// the original view.
---
> /// - Returns: A view that calls `action` when elements are moved within the
> /// original view.
> @inlinable public func onMove(perform action: ((IndexSet, Int) -> Void)?) -> some DynamicViewContent
>
> }
>
> @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
> extension DynamicViewContent {
>
> /// Sets the insert action for the dynamic view.
> ///
> /// - Parameters:
> /// - supportedContentTypes: An array of UTI types that the dynamic
> /// view supports.
> /// - action: A closure that SwiftUI invokes when elements are added to
> /// the view. The closure takes two arguments: The first argument is the
> /// offset relative to the dynamic view's underlying collection of data.
> /// The second argument is an array of
> /// <doc://com.apple.documentation/documentation/Foundation/NSItemProvider> items that
> /// represents the data that you want to insert.
> ///
> /// - Returns: A view that calls `action` when elements are inserted into
> /// the original view.
4690,4706d4388
< @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
< extension DynamicViewContent {
<
< /// Sets the move action for the dynamic view.
< ///
< /// - Parameters:
< /// - action: A closure that SwiftUI invokes when elements in the dynamic
< /// view are moved. The closure takes two arguments that represent the
< /// offset relative to the dynamic view's underlying collection of data.
< /// Pass `nil` to disable the ability to move items.
< ///
< /// - Returns: A view that calls `action` when elements are moved within the
< /// original view.
< @inlinable public func onMove(perform action: ((IndexSet, Int) -> Void)?) -> some DynamicViewContent
<
< }
<
4898a4581,4668
> /// A button that toggles the edit mode for the current edit scope.
> @available(iOS 13.0, *)
> @available(OSX, unavailable)
> @available(tvOS, unavailable)
> @available(watchOS, unavailable)
> public struct EditButton : View {
>
> public init()
>
> /// The content and behavior of the view.
> public var body: some View { get }
>
> /// The type of view representing the body of this view.
> ///
> /// When you create a custom view, Swift infers this type from your
> /// implementation of the required `body` property.
> public typealias Body = some View
> }
>
> /// The mode of a view indicating whether the user can edit its content.
> @available(iOS 13.0, tvOS 13.0, *)
> @available(OSX, unavailable)
> @available(watchOS, unavailable)
> public enum EditMode {
>
> /// The view content cannot be edited.
> case inactive
>
> /// The view is in a temporary edit mode.
> ///
> /// The definition of temporary might vary by platform or specific control.
> /// As an example, temporary edit mode may be engaged over the duration of a
> /// swipe gesture.
> case transient
>
> /// The view content can be edited.
> case active
>
> /// Indicates whether a view is being edited.
> public var isEditing: Bool { get }
>
> /// Returns a Boolean value indicating whether two values are equal.
> ///
> /// Equality is the inverse of inequality. For any values `a` and `b`,
> /// `a == b` implies that `a != b` is `false`.
> ///
> /// - Parameters:
> /// - lhs: A value to compare.
> /// - rhs: Another value to compare.
> public static func == (a: EditMode, b: EditMode) -> Bool
>
> /// The hash value.
> ///
> /// Hash values are not guaranteed to be equal across different executions of
> /// your program. Do not save hash values to use during a future execution.
> ///
> /// - Important: `hashValue` is deprecated as a `Hashable` requirement. To
> /// conform to `Hashable`, implement the `hash(into:)` requirement instead.
> public var hashValue: Int { get }
>
> /// Hashes the essential components of this value by feeding them into the
> /// given hasher.
> ///
> /// Implement this method to conform to the `Hashable` protocol. The
> /// components used for hashing must be the same as the components compared
> /// in your type's `==` operator implementation. Call `hasher.combine(_:)`
> /// with each of these components.
> ///
> /// - Important: Never call `finalize()` on `hasher`. Doing so may become a
> /// compile-time error in the future.
> ///
> /// - Parameter hasher: The hasher to use when combining the components
> /// of this instance.
> public func hash(into hasher: inout Hasher)
> }
>
> @available(iOS 13.0, tvOS 13.0, *)
> @available(OSX, unavailable)
> @available(watchOS, unavailable)
> extension EditMode : Equatable {
> }
>
> @available(iOS 13.0, tvOS 13.0, *)
> @available(OSX, unavailable)
> @available(watchOS, unavailable)
> extension EditMode : Hashable {
> }
>
5182d4951
< @available(iOS 14.0, OSX 10.16, tvOS 14.0, watchOS 7.0, *)
5185,5186c4954,4961
< /// Opens a URL using the appropriate system service.
< public var openURL: OpenURLAction { get }
---
> /// A Boolean value that determines whether the view hierarchy has
> /// auto-correction enabled.
> ///
> /// When the value is `nil`, SwiftUI uses the system default. The default
> /// value is `nil`.
> @available(iOS 13.0, OSX 10.15, tvOS 13.0, *)
> @available(watchOS, unavailable)
> public var disableAutocorrection: Bool?
5200a4976,4992
> public var managedObjectContext: NSManagedObjectContext
> }
>
> @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
> extension EnvironmentValues {
>
> /// The undo manager used to register a view's undo operations.
> ///
> /// This value is `nil` when the environment represents a context that
> /// doesn't support undo and redo operations. You can skip registration of
> /// an undo operation when this value is `nil`.
> public var undoManager: UndoManager? { get }
> }
>
> @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
> extension EnvironmentValues {
>
5207a5000
> @available(iOS 14.0, OSX 10.16, tvOS 14.0, watchOS 7.0, *)
5210c5003
< /// Returns whether the nearest focusable ancestor has focus.
---
> /// The current phase of the scene.
5212,5214c5005,5009
< /// If there is no focusable ancestor, the value is `false`.
< @available(iOS 14.0, OSX 10.16, tvOS 14.0, watchOS 7.0, *)
< public var isFocused: Bool { get }
---
> /// The system sets this value to provide an indication of the
> /// operational state of a scene or collection of scenes. The exact
> /// meaning depends on where you access the value. For more information,
> /// see ``ScenePhase``.
> public var scenePhase: ScenePhase
5220c5015,5018
< /// The undo manager used to register a view's undo operations.
---
> /// The default minimum height of a row in a list.
> public var defaultMinListRowHeight: CGFloat
>
> /// The default minimum height of a header in a list.
5222,5225c5020,5022
< /// This value is `nil` when the environment represents a context that
< /// doesn't support undo and redo operations. You can skip registration of
< /// an undo operation when this value is `nil`.
< public var undoManager: UndoManager? { get }
---
> /// When this value is `nil`, the system chooses the appropriate height. The
> /// default is `nil`.
> public var defaultMinListHeaderHeight: CGFloat?
5240,5241c5037
< /// A Boolean value that determines whether the view hierarchy has
< /// auto-correction enabled.
---
> /// Returns whether the nearest focusable ancestor has focus.
5243,5247c5039,5041
< /// When the value is `nil`, SwiftUI uses the system default. The default
< /// value is `nil`.
< @available(iOS 13.0, OSX 10.15, tvOS 13.0, *)
< @available(watchOS, unavailable)
< public var disableAutocorrection: Bool?
---
> /// If there is no focusable ancestor, the value is `false`.
> @available(iOS 14.0, OSX 10.16, tvOS 14.0, watchOS 7.0, *)
> public var isFocused: Bool { get }
5309,5321c5103,5104
< extension EnvironmentValues {
<
< /// The active state of controls in the view.
< ///
< /// The default is ``ControlActiveState/key``.
< @available(OSX 10.15, *)
< @available(iOS, unavailable)
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
< public var controlActiveState: ControlActiveState
< }
<
< @available(iOS 14.0, OSX 10.16, *)
---
> @available(iOS 13.0, *)
> @available(OSX, unavailable)
5326,5332c5109,5113
< /// Imports files into this application by prompting the user
< /// with an appropriate system dialog.
< public var importFiles: ImportFilesAction { get }
< }
<
< @available(iOS 14.0, OSX 10.16, tvOS 14.0, watchOS 7.0, *)
< extension EnvironmentValues {
---
> /// The horizontal size class of this environment.
> @available(OSX, unavailable)
> @available(tvOS, unavailable)
> @available(watchOS, unavailable)
> public var horizontalSizeClass: UserInterfaceSizeClass?
5334,5340c5115,5119
< /// The current phase of the scene.
< ///
< /// The system sets this value to provide an indication of the
< /// operational state of a scene or collection of scenes. The exact
< /// meaning depends on where you access the value. For more information,
< /// see ``ScenePhase``.
< public var scenePhase: ScenePhase
---
> /// The vertical size class of this environment.
> @available(OSX, unavailable)
> @available(tvOS, unavailable)
> @available(watchOS, unavailable)
> public var verticalSizeClass: UserInterfaceSizeClass?
5356,5374c5135,5137
< /// A binding to the current presentation mode of the view associated with
< /// this environment.
< @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
< public var presentationMode: Binding<PresentationMode> { get }
< }
<
< @available(OSX 10.15, *)
< @available(iOS, unavailable)
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
< extension EnvironmentValues {
<
< /// The size to apply to controls within a view.
< ///
< /// The default is ``ControlSize/regular``.
< @available(iOS, unavailable)
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
< public var controlSize: ControlSize
---
> /// A Boolean value that indicates whether the user has enabled an assistive
> /// technology.
> public var accessibilityEnabled: Bool
5401a5165,5171
> @available(iOS 14.0, OSX 10.16, tvOS 14.0, watchOS 7.0, *)
> extension EnvironmentValues {
>
> /// Opens a URL using the appropriate system service.
> public var openURL: OpenURLAction { get }
> }
>
5475c5245,5247
< @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
---
> @available(iOS 13.0, tvOS 13.0, *)
> @available(OSX, unavailable)
> @available(watchOS, unavailable)
5478,5480c5250,5254
< /// A Boolean value that indicates whether the user has enabled an assistive
< /// technology.
< public var accessibilityEnabled: Bool
---
> /// The mode indicating whether the user can edit the contents of a view
> /// associated with this environment.
> @available(OSX, unavailable)
> @available(watchOS, unavailable)
> public var editMode: Binding<EditMode>?
5483c5257,5259
< @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
---
> @available(iOS 14.0, OSX 10.16, *)
> @available(tvOS, unavailable)
> @available(watchOS, unavailable)
5486c5262,5264
< public var managedObjectContext: NSManagedObjectContext
---
> /// Imports files into this application by prompting the user
> /// with an appropriate system dialog.
> public var importFiles: ImportFilesAction { get }
5492,5499c5270,5273
< /// The default minimum height of a row in a list.
< public var defaultMinListRowHeight: CGFloat
<
< /// The default minimum height of a header in a list.
< ///
< /// When this value is `nil`, the system chooses the appropriate height. The
< /// default is `nil`.
< public var defaultMinListHeaderHeight: CGFloat?
---
> /// A binding to the current presentation mode of the view associated with
> /// this environment.
> @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
> public var presentationMode: Binding<PresentationMode> { get }
5566a5341,5348
> /// The raw type that can be used to represent all values of the conforming
> /// type.
> ///
> /// Every distinct value of the conforming type has a corresponding unique
> /// value of the `RawValue` type, but there may be values of the `RawValue`
> /// type that don't have a corresponding value of the conforming type.
> public typealias RawValue = Int
>
5575,5589c5357,5363
<
< /// The raw type that can be used to represent all values of the conforming
< /// type.
< ///
< /// Every distinct value of the conforming type has a corresponding unique
< /// value of the `RawValue` type, but there may be values of the `RawValue`
< /// type that don't have a corresponding value of the conforming type.
< public typealias RawValue = Int
< }
<
< /// A gesture that consists of two gestures where only one of them can succeed.
< ///
< /// The `ExclusiveGesture` gives precedence to its first gesture.
< @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
< @frozen public struct ExclusiveGesture<First, Second> : Gesture where First : Gesture, Second : Gesture {
---
> }
>
> /// A gesture that consists of two gestures where only one of them can succeed.
> ///
> /// The `ExclusiveGesture` gives precedence to its first gesture.
> @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
> @frozen public struct ExclusiveGesture<First, Second> : Gesture where First : Gesture, Second : Gesture {
5634,5644d5407
< /// A window toolbar style which displays its title bar area above the toolbar.
< @available(macCatalyst 14.0, OSX 10.16, *)
< @available(iOS, unavailable)
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
< public struct ExpandedWindowToolbarStyle : WindowToolbarStyle {
<
< /// Creates an expanded window toolbar style.
< public init()
< }
<
5841,5855d5603
< /// A system style that displays the components in an editable field.
< ///
< /// This style is useful when space is constrained and users expect to
< /// make specific date and time selections. `stepperField` should be
< /// preferred over this style unless the use case requires hiding the
< /// stepper.
< @available(OSX 10.15, *)
< @available(iOS, unavailable)
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
< public struct FieldDatePickerStyle : DatePickerStyle {
<
< public init()
< }
<
6080,6187d5827
< /// Create a custom font with the given `name` and `size` that scales with
< /// the body text style.
< public static func custom(_ name: String, size: CGFloat) -> Font
<
< /// Create a custom font with the given `name` and `size` that scales
< /// relative to the given `textStyle`.
< @available(iOS 14.0, OSX 10.16, tvOS 14.0, watchOS 7.0, *)
< public static func custom(_ name: String, size: CGFloat, relativeTo textStyle: Font.TextStyle) -> Font
<
< /// Create a custom font with the given `name` and a fixed `size` that does
< /// not scale with Dynamic Type.
< @available(iOS 14.0, OSX 10.16, tvOS 14.0, watchOS 7.0, *)
< public static func custom(_ name: String, fixedSize: CGFloat) -> Font
<
< /// Creates a custom font from a platform font instance.
< ///
< /// Initializing ``Font`` with platform font instance
< /// (<doc://com.apple.documentation/documentation/CoreText/CTFont-q6r>) can bridge SwiftUI
< /// ``Font`` with <doc://com.apple.documentation/documentation/AppKit/NSFont> or
< /// <doc://com.apple.documentation/documentation/UIKit/UIFont>, both of which are
< /// toll-free bridged to
< /// <doc://com.apple.documentation/documentation/CoreText/CTFont-q6r>. For example:
< ///
< /// // Use native Core Text API to create desired ctFont.
< /// let ctFont = CTFontCreateUIFontForLanguage(.system, 12, nil)!
< ///
< /// // Create SwiftUI Text with the CTFont instance.
< /// let text = Text("Hello").font(Font(ctFont))
< public init(_ font: CTFont)
< }
<
< @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
< extension Font {
<
< /// Specifies a system font to use, along with the style, weight, and any
< /// design parameters you want applied to the text.
< ///
< /// Use this function to create a system font by specifying the size and
< /// weight, and a type design together. The following styles the system font
< /// as 17 point, ``Font/Weight/semibold`` text:
< ///
< /// Text("Hello").font(.system(size: 17, weight: .semibold))
< ///
< /// While the following styles the text as 17 point ``Font/Weight/bold``,
< /// and applies a `serif` ``Font/Design`` to the system font:
< ///
< /// Text("Hello").font(.system(size: 17, weight: .bold, design: .serif))
< ///
< /// If you want to use the default ``Font/Weight``
< /// (``Font/Weight/regular``), you don't need to specify the `weight` in the
< /// method. The following example styles the text as 17 point
< /// ``Font/Weight/regular``, and uses a ``Font/Design/rounded`` system font:
< ///
< /// Text("Hello").font(.system(size: 17, design: .rounded))
< public static func system(size: CGFloat, weight: Font.Weight = .regular, design: Font.Design = .default) -> Font
<
< /// A design to use for fonts.
< public enum Design : Hashable {
<
< case `default`
<
< @available(watchOS 7.0, *)
< case serif
<
< case rounded
<
< @available(watchOS 7.0, *)
< case monospaced
<
< /// Returns a Boolean value indicating whether two values are equal.
< ///
< /// Equality is the inverse of inequality. For any values `a` and `b`,
< /// `a == b` implies that `a != b` is `false`.
< ///
< /// - Parameters:
< /// - lhs: A value to compare.
< /// - rhs: Another value to compare.
< public static func == (a: Font.Design, b: Font.Design) -> Bool
<
< /// The hash value.
< ///
< /// Hash values are not guaranteed to be equal across different executions of
< /// your program. Do not save hash values to use during a future execution.
< ///
< /// - Important: `hashValue` is deprecated as a `Hashable` requirement. To
< /// conform to `Hashable`, implement the `hash(into:)` requirement instead.
< public var hashValue: Int { get }
<
< /// Hashes the essential components of this value by feeding them into the
< /// given hasher.
< ///
< /// Implement this method to conform to the `Hashable` protocol. The
< /// components used for hashing must be the same as the components compared
< /// in your type's `==` operator implementation. Call `hasher.combine(_:)`
< /// with each of these components.
< ///
< /// - Important: Never call `finalize()` on `hasher`. Doing so may become a
< /// compile-time error in the future.
< ///
< /// - Parameter hasher: The hasher to use when combining the components
< /// of this instance.
< public func hash(into hasher: inout Hasher)
< }
< }
<
< @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
< extension Font {
<
6456a6097,6204
> extension Font {
>
> /// Specifies a system font to use, along with the style, weight, and any
> /// design parameters you want applied to the text.
> ///
> /// Use this function to create a system font by specifying the size and
> /// weight, and a type design together. The following styles the system font
> /// as 17 point, ``Font/Weight/semibold`` text:
> ///
> /// Text("Hello").font(.system(size: 17, weight: .semibold))
> ///
> /// While the following styles the text as 17 point ``Font/Weight/bold``,
> /// and applies a `serif` ``Font/Design`` to the system font:
> ///
> /// Text("Hello").font(.system(size: 17, weight: .bold, design: .serif))
> ///
> /// If you want to use the default ``Font/Weight``
> /// (``Font/Weight/regular``), you don't need to specify the `weight` in the
> /// method. The following example styles the text as 17 point
> /// ``Font/Weight/regular``, and uses a ``Font/Design/rounded`` system font:
> ///
> /// Text("Hello").font(.system(size: 17, design: .rounded))
> public static func system(size: CGFloat, weight: Font.Weight = .regular, design: Font.Design = .default) -> Font
>
> /// A design to use for fonts.
> public enum Design : Hashable {
>
> case `default`
>
> @available(watchOS 7.0, *)
> case serif
>
> case rounded
>
> @available(watchOS 7.0, *)
> case monospaced
>
> /// Returns a Boolean value indicating whether two values are equal.
> ///
> /// Equality is the inverse of inequality. For any values `a` and `b`,
> /// `a == b` implies that `a != b` is `false`.
> ///
> /// - Parameters:
> /// - lhs: A value to compare.
> /// - rhs: Another value to compare.
> public static func == (a: Font.Design, b: Font.Design) -> Bool
>
> /// The hash value.
> ///
> /// Hash values are not guaranteed to be equal across different executions of
> /// your program. Do not save hash values to use during a future execution.
> ///
> /// - Important: `hashValue` is deprecated as a `Hashable` requirement. To
> /// conform to `Hashable`, implement the `hash(into:)` requirement instead.
> public var hashValue: Int { get }
>
> /// Hashes the essential components of this value by feeding them into the
> /// given hasher.
> ///
> /// Implement this method to conform to the `Hashable` protocol. The
> /// components used for hashing must be the same as the components compared
> /// in your type's `==` operator implementation. Call `hasher.combine(_:)`
> /// with each of these components.
> ///
> /// - Important: Never call `finalize()` on `hasher`. Doing so may become a
> /// compile-time error in the future.
> ///
> /// - Parameter hasher: The hasher to use when combining the components
> /// of this instance.
> public func hash(into hasher: inout Hasher)
> }
> }
>
> @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
> extension Font {
>
> /// Create a custom font with the given `name` and `size` that scales with
> /// the body text style.
> public static func custom(_ name: String, size: CGFloat) -> Font
>
> /// Create a custom font with the given `name` and `size` that scales
> /// relative to the given `textStyle`.
> @available(iOS 14.0, OSX 10.16, tvOS 14.0, watchOS 7.0, *)
> public static func custom(_ name: String, size: CGFloat, relativeTo textStyle: Font.TextStyle) -> Font
>
> /// Create a custom font with the given `name` and a fixed `size` that does
> /// not scale with Dynamic Type.
> @available(iOS 14.0, OSX 10.16, tvOS 14.0, watchOS 7.0, *)
> public static func custom(_ name: String, fixedSize: CGFloat) -> Font
>
> /// Creates a custom font from a platform font instance.
> ///
> /// Initializing ``Font`` with platform font instance
> /// (<doc://com.apple.documentation/documentation/CoreText/CTFont-q6r>) can bridge SwiftUI
> /// ``Font`` with <doc://com.apple.documentation/documentation/AppKit/NSFont> or
> /// <doc://com.apple.documentation/documentation/UIKit/UIFont>, both of which are
> /// toll-free bridged to
> /// <doc://com.apple.documentation/documentation/CoreText/CTFont-q6r>. For example:
> ///
> /// // Use native Core Text API to create desired ctFont.
> /// let ctFont = CTFontCreateUIFontForLanguage(.system, 12, nil)!
> ///
> /// // Create SwiftUI Text with the CTFont instance.
> /// let text = Text("Hello").font(Font(ctFont))
> public init(_ font: CTFont)
> }
>
> @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
6486a6235,6238
> extension ForEach : DynamicViewContent where Content : View {
> }
>
> @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
6551,6554d6302
< @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
< extension ForEach : DynamicViewContent where Content : View {
< }
<
6667,6670c6415
< @available(OSX 10.15, *)
< @available(iOS, unavailable)
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
---
> @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
6673c6418,6420
< /// Combines a gesture with keyboard modifiers.
---
> /// Sequences a gesture with another one to create a new gesture, which
> /// results in the second gesture only receiving events after the first
> /// gesture succeeds.
6675,6676c6422,6423
< /// The gesture receives updates while the user presses the modifier keys
< /// that correspond to the given modifiers option set.
---
> /// - Parameter other: A gesture you want to combine with another gesture to
> /// create a new, sequenced gesture.
6678,6679c6425,6433
< /// - Parameter modifiers: A set of flags that correspond to the modifier
< /// keys that the user needs to hold down.
---
> /// - Returns: A gesture that's a sequence of two gestures.
> @inlinable public func sequenced<Other>(before other: Other) -> SequenceGesture<Self, Other> where Other : Gesture
> }
>
> @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
> extension Gesture {
>
> /// Combines a gesture with another gesture to create a new gesture that
> /// recognizes both gestures at the same time.
6681,6686c6435,6439
< /// - Returns: A new gesture that combines a gesture with keyboard
< /// modifiers.
< @available(iOS, unavailable)
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
< public func modifiers(_ modifiers: EventModifiers) -> _ModifiersGesture<Self>
---
> /// - Parameter other: A gesture that you want to combine with your gesture
> /// to create a new, combined gesture.
> ///
> /// - Returns: A gesture with two simultaneous gestures.
> @inlinable public func simultaneously<Other>(with other: Other) -> SimultaneousGesture<Self, Other> where Other : Gesture
6718,6730d6470
< /// Combines a gesture with another gesture to create a new gesture that
< /// recognizes both gestures at the same time.
< ///
< /// - Parameter other: A gesture that you want to combine with your gesture
< /// to create a new, combined gesture.
< ///
< /// - Returns: A gesture with two simultaneous gestures.
< @inlinable public func simultaneously<Other>(with other: Other) -> SimultaneousGesture<Self, Other> where Other : Gesture
< }
<
< @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
< extension Gesture {
<
6754,6767d6493
< /// Sequences a gesture with another one to create a new gesture, which
< /// results in the second gesture only receiving events after the first
< /// gesture succeeds.
< ///
< /// - Parameter other: A gesture you want to combine with another gesture to
< /// create a new, sequenced gesture.
< ///
< /// - Returns: A gesture that's a sequence of two gestures.
< @inlinable public func sequenced<Other>(before other: Other) -> SequenceGesture<Self, Other> where Other : Gesture
< }
<
< @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
< extension Gesture {
<
7264,7268c6990,6992
< /// A layout container that arranges its children in a horizontal line and
< /// allows the user to resize them using dividers placed between them.
< @available(OSX 10.15, *)
< @available(iOS, unavailable)
< @available(tvOS, unavailable)
---
> /// The instance that describes the behavior and appearance of a grouped list.
> @available(iOS 13.0, tvOS 13.0, *)
> @available(OSX, unavailable)
7270,7272c6994
< public struct HSplitView<Content> : View where Content : View {
<
< public init(@ViewBuilder content: () -> Content)
---
> public struct GroupedListStyle : ListStyle {
7274,7278c6996,6997
< /// The type of view representing the body of this view.
< ///
< /// When you create a custom view, Swift infers this type from your
< /// implementation of the required `body` property.
< public typealias Body = Never
---
> /// Creates a grouped list style.
> public init()
7303,7315d7021
< /// A window style which hides both the window's title
< /// and the backing of the titlebar area,
< /// allowing more of the window's content to show.
< @available(macCatalyst 14.0, OSX 10.16, *)
< @available(iOS, unavailable)
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
< public struct HiddenTitleBarWindowStyle : WindowStyle {
<
< /// Creates a hidden title bar window style.
< public init()
< }
<
7351a7058,7077
> /// An effect applied when the pointer hovers over a view.
> @available(iOS 13.4, *)
> @available(OSX, unavailable)
> @available(tvOS, unavailable)
> @available(watchOS, unavailable)
> public struct HoverEffect {
>
> /// An effect that attempts to determine the effect automatically.
> /// This is the default effect.
> public static let automatic: HoverEffect
>
> /// An effect that morphs the pointer into a platter behind the view
> /// and shows a light source indicating position.
> public static let highlight: HoverEffect
>
> /// An effect that slides the pointer under the view and disappears as the
> /// view scales up and gains a shadow.
> public static let lift: HoverEffect
> }
>
7440c7166
< extension Image {
---
> extension Image : View {
7442c7168,7172
< public func renderingMode(_ renderingMode: Image.TemplateRenderingMode?) -> Image
---
> /// The type of view representing the body of this view.
> ///
> /// When you create a custom view, Swift infers this type from your
> /// implementation of the required `body` property.
> public typealias Body = Never
7445,7448c7175
< @available(OSX 10.15, *)
< @available(iOS, unavailable)
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
---
> @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
7451,7454c7178
< @available(iOS, unavailable)
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
< public init(nsImage: NSImage)
---
> public func renderingMode(_ renderingMode: Image.TemplateRenderingMode?) -> Image
7458c7182
< extension Image : View {
---
> extension Image {
7460,7464c7184,7251
< /// The type of view representing the body of this view.
< ///
< /// When you create a custom view, Swift infers this type from your
< /// implementation of the required `body` property.
< public typealias Body = Never
---
> /// The orientation of an image.
> @frozen public enum Orientation : UInt8, CaseIterable, Hashable {
>
> case up
>
> case upMirrored
>
> case down
>
> case downMirrored
>
> case left
>
> case leftMirrored
>
> case right
>
> case rightMirrored
>
> /// The raw type that can be used to represent all values of the conforming
> /// type.
> ///
> /// Every distinct value of the conforming type has a corresponding unique
> /// value of the `RawValue` type, but there may be values of the `RawValue`
> /// type that don't have a corresponding value of the conforming type.
> public typealias RawValue = UInt8
>
> /// Creates a new instance with the specified raw value.
> ///
> /// If there is no value of the type that corresponds with the specified raw
> /// value, this initializer returns `nil`. For example:
> ///
> /// enum PaperSize: String {
> /// case A4, A5, Letter, Legal
> /// }
> ///
> /// print(PaperSize(rawValue: "Legal"))
> /// // Prints "Optional("PaperSize.Legal")"
> ///
> /// print(PaperSize(rawValue: "Tabloid"))
> /// // Prints "nil"
> ///
> /// - Parameter rawValue: The raw value to use for the new instance.
> public init?(rawValue: UInt8)
>
> /// The corresponding value of the raw type.
> ///
> /// A new instance initialized with `rawValue` will be equivalent to this
> /// instance. For example:
> ///
> /// enum PaperSize: String {
> /// case A4, A5, Letter, Legal
> /// }
> ///
> /// let selectedSize = PaperSize.Letter
> /// print(selectedSize.rawValue)
> /// // Prints "Letter"
> ///
> /// print(selectedSize == PaperSize(rawValue: selectedSize.rawValue)!)
> /// // Prints "true"
> public var rawValue: UInt8 { get }
>
> /// A type that can represent a collection of all values of this type.
> public typealias AllCases = [Image.Orientation]
>
> /// A collection of all values of this type.
> public static var allCases: [Image.Orientation] { get }
> }
7616a7404,7437
> /// Creates a labeled image based on a `CGImage`, usable as content for
> /// controls.
> ///
> /// - Parameters:
> /// - cgImage: the base graphical image
> /// - scale: the scale factor the image is intended for
> /// (e.g. 1.0, 2.0, 3.0)
> /// - orientation: the orientation of the image
> /// - label: The label associated with the image. The label is used for
> /// things like accessibility.
> public init(_ cgImage: CGImage, scale: CGFloat, orientation: Image.Orientation = .up, label: Text)
>
> /// Creates an unlabeled, decorative image based on a `CGImage`.
> ///
> /// This image is ignored for accessibility purposes.
> ///
> /// - Parameters:
> /// - cgImage: the base graphical image
> /// - scale: the scale factor the image is intended for
> /// (e.g. 1.0, 2.0, 3.0)
> /// - orientation: the orientation of the image
> public init(decorative cgImage: CGImage, scale: CGFloat, orientation: Image.Orientation = .up)
> }
>
> @available(iOS 13.0, tvOS 13.0, watchOS 6.0, *)
> @available(OSX, unavailable)
> extension Image {
>
> public init(uiImage: UIImage)
> }
>
> @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
> extension Image {
>
7662c7483,7520
< extension Image {
---
> extension Image.Orientation : RawRepresentable {
> }
>
> @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
> extension Image.TemplateRenderingMode : Equatable {
> }
>
> @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
> extension Image.TemplateRenderingMode : Hashable {
> }
>
> @available(iOS 13.0, tvOS 13.0, watchOS 6.0, OSX 10.16, *)
> extension Image.Scale : Equatable {
> }
>
> @available(iOS 13.0, tvOS 13.0, watchOS 6.0, OSX 10.16, *)
> extension Image.Scale : Hashable {
> }
>
> @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
> extension Image.Interpolation : Equatable {
> }
>
> @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
> extension Image.Interpolation : Hashable {
> }
>
> @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
> extension Image.ResizingMode : Equatable {
> }
>
> @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
> extension Image.ResizingMode : Hashable {
> }
>
> /// A shape style that fills a shape by repeating a region of an image.
> @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
> @frozen public struct ImagePaint : ShapeStyle {
7664,7674c7522,7523
< /// Creates a labeled image based on a `CGImage`, usable as content for
< /// controls.
< ///
< /// - Parameters:
< /// - cgImage: the base graphical image
< /// - scale: the scale factor the image is intended for
< /// (e.g. 1.0, 2.0, 3.0)
< /// - orientation: the orientation of the image
< /// - label: The label associated with the image. The label is used for
< /// things like accessibility.
< public init(_ cgImage: CGImage, scale: CGFloat, orientation: Image.Orientation = .up, label: Text)
---
> /// The image to be drawn.
> public var image: Image
7676c7525
< /// Creates an unlabeled, decorative image based on a `CGImage`.
---
> /// A unit-space rectangle defining how much of the source image to draw.
7678,7813c7527,7534
< /// This image is ignored for accessibility purposes.
< ///
< /// - Parameters:
< /// - cgImage: the base graphical image
< /// - scale: the scale factor the image is intended for
< /// (e.g. 1.0, 2.0, 3.0)
< /// - orientation: the orientation of the image
< public init(decorative cgImage: CGImage, scale: CGFloat, orientation: Image.Orientation = .up)
< }
<
< @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
< extension Image {
<
< /// The orientation of an image.
< @frozen public enum Orientation : UInt8, CaseIterable, Hashable {
<
< case up
<
< case upMirrored
<
< case down
<
< case downMirrored
<
< case left
<
< case leftMirrored
<
< case right
<
< case rightMirrored
<
< /// The raw type that can be used to represent all values of the conforming
< /// type.
< ///
< /// Every distinct value of the conforming type has a corresponding unique
< /// value of the `RawValue` type, but there may be values of the `RawValue`
< /// type that don't have a corresponding value of the conforming type.
< public typealias RawValue = UInt8
<
< /// Creates a new instance with the specified raw value.
< ///
< /// If there is no value of the type that corresponds with the specified raw
< /// value, this initializer returns `nil`. For example:
< ///
< /// enum PaperSize: String {
< /// case A4, A5, Letter, Legal
< /// }
< ///
< /// print(PaperSize(rawValue: "Legal"))
< /// // Prints "Optional("PaperSize.Legal")"
< ///
< /// print(PaperSize(rawValue: "Tabloid"))
< /// // Prints "nil"
< ///
< /// - Parameter rawValue: The raw value to use for the new instance.
< public init?(rawValue: UInt8)
<
< /// The corresponding value of the raw type.
< ///
< /// A new instance initialized with `rawValue` will be equivalent to this
< /// instance. For example:
< ///
< /// enum PaperSize: String {
< /// case A4, A5, Letter, Legal
< /// }
< ///
< /// let selectedSize = PaperSize.Letter
< /// print(selectedSize.rawValue)
< /// // Prints "Letter"
< ///
< /// print(selectedSize == PaperSize(rawValue: selectedSize.rawValue)!)
< /// // Prints "true"
< public var rawValue: UInt8 { get }
<
< /// A type that can represent a collection of all values of this type.
< public typealias AllCases = [Image.Orientation]
<
< /// A collection of all values of this type.
< public static var allCases: [Image.Orientation] { get }
< }
< }
<
< @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
< extension Image.TemplateRenderingMode : Equatable {
< }
<
< @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
< extension Image.TemplateRenderingMode : Hashable {
< }
<
< @available(iOS 13.0, tvOS 13.0, watchOS 6.0, OSX 10.16, *)
< extension Image.Scale : Equatable {
< }
<
< @available(iOS 13.0, tvOS 13.0, watchOS 6.0, OSX 10.16, *)
< extension Image.Scale : Hashable {
< }
<
< @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
< extension Image.Interpolation : Equatable {
< }
<
< @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
< extension Image.Interpolation : Hashable {
< }
<
< @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
< extension Image.ResizingMode : Equatable {
< }
<
< @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
< extension Image.ResizingMode : Hashable {
< }
<
< @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
< extension Image.Orientation : RawRepresentable {
< }
<
< /// A shape style that fills a shape by repeating a region of an image.
< @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
< @frozen public struct ImagePaint : ShapeStyle {
<
< /// The image to be drawn.
< public var image: Image
<
< /// A unit-space rectangle defining how much of the source image to draw.
< ///
< /// The results are undefined if this rectangle selects areas outside the
< /// `[0, 1]` range in either axis.
< public var sourceRect: CGRect
<
< /// A scale factor applied to the image while being drawn.
< public var scale: CGFloat
<
< /// Creates a shape-filling shape style.
---
> /// The results are undefined if this rectangle selects areas outside the
> /// `[0, 1]` range in either axis.
> public var sourceRect: CGRect
>
> /// A scale factor applied to the image while being drawn.
> public var scale: CGFloat
>
> /// Creates a shape-filling shape style.
7860a7582,7603
> /// Defines the implementation of all `IndexView` instances within a view
> /// hierarchy.
> ///
> /// To configure the current `IndexViewStyle` for a view hierarchy, use the
> /// `.indexViewStyle()` modifier.
> @available(iOS 14.0, tvOS 14.0, *)
> @available(OSX, unavailable)
> @available(watchOS, unavailable)
> public protocol IndexViewStyle {
> }
>
> /// The instance that describes the behavior and appearance of an inset grouped list.
> @available(iOS 14.0, *)
> @available(OSX, unavailable)
> @available(tvOS, unavailable)
> @available(watchOS, unavailable)
> public struct InsetGroupedListStyle : ListStyle {
>
> /// Creates an inset grouped list style.
> public init()
> }
>
8208a7952,7960
> extension LayoutDirection {
>
> /// Create a direction from its UITraitEnvironmentLayoutDirection equivalent.
> @available(iOS 14.0, tvOS 14.0, *)
> @available(OSX, unavailable)
> @available(watchOS, unavailable)
> public init?(_ uiLayoutDirection: UITraitEnvironmentLayoutDirection)
> }
>
8430a8183,8191
> extension LegibilityWeight {
>
> /// Creates a legibility weight from its UILegibilityWeight equivalent.
> @available(iOS 14.0, tvOS 14.0, *)
> @available(OSX, unavailable)
> @available(watchOS, unavailable)
> public init?(_ uiLegibilityWeight: UILegibilityWeight)
> }
>
8523,8548d8283
< /// A button style for buttons that emulate links.
< ///
< /// To apply this style to a button, or to a view that contains buttons, use the
< /// ``View/buttonStyle(_:)`` modifier.
< @available(OSX 10.15, *)
< @available(iOS, unavailable)
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
< public struct LinkButtonStyle : PrimitiveButtonStyle {
<
< /// Creates a link button style.
< public init()
<
< /// Creates a view that represents the body of a button.
< ///
< /// The system calls this method for each ``Button`` instance in a view
< /// hierarchy where this style is the current button style.
< ///
< /// - Parameter configuration: The properties of the button.
< public func makeBody(configuration: LinkButtonStyle.Configuration) -> some View
<
<
< /// A view that represents the body of a button.
< public typealias Body = some View
< }
<
8865c8600
< ///
---
> ///
8870c8605
< ///
---
> ///
8884c8619
< ///
---
> ///
8887c8622
< ///
---
> ///
8891c8626
< ///
---
> ///
8902c8637
< ///
---
> ///
8905c8640
< ///
---
> ///
8909c8644
< ///
---
> ///
9160,9168c8895,8897
< /// A control for presenting a menu of actions.
< @available(OSX 10.16, *)
< @available(iOS, unavailable)
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
< public struct Menu<Label, Content> : View where Label : View, Content : View {
<
< /// The content and behavior of the view.
< public var body: some View { get }
---
> /// A value with a modifier applied to it.
> @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
> @frozen public struct ModifiedContent<Content, Modifier> {
9174,9181c8903
< public typealias Body = some View
< }
<
< @available(OSX 10.16, *)
< @available(iOS, unavailable)
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
< extension Menu {
---
> public typealias Body = Never
9183,9188c8905
< /// Creates a menu with a custom label.
< ///
< /// - Parameters:
< /// - content: A group of menu items.
< /// - label: A view describing the content of the menu.
< public init(@ViewBuilder content: () -> Content, @ViewBuilder label: () -> Label)
---
> public var content: Content
9190,9196c8907
< /// Creates a menu that generates its label from a localized string key.
< ///
< /// - Parameters:
< /// - titleKey: The key for the link's localized title, which describes
< /// the contents of the menu.
< /// - content: A group of menu items.
< public init(_ titleKey: LocalizedStringKey, @ViewBuilder content: () -> Content) where Label == Text
---
> public var modifier: Modifier
9198,9203c8909
< /// Creates a menu that generates its label from a string.
< ///
< /// - Parameters:
< /// - title: A string that describes the contents of the menu.
< /// - content: A group of menu items.
< public init<S>(_ title: S, @ViewBuilder content: () -> Content) where Label == Text, S : StringProtocol
---
> @inlinable public init(content: Content, modifier: Modifier)
9206,9207c8912
< @available(OSX 10.16, *)
< @available(iOS, unavailable)
---
> @available(iOS 14.0, OSX 10.16, *)
9210c8915
< extension Menu where Label == MenuStyleConfiguration.Label, Content == MenuStyleConfiguration.Content {
---
> extension ModifiedContent where Content : _Widget, Modifier : _WidgetModifier {
9212,9226c8917
< /// Creates a menu based on a style configuration.
< ///
< /// Use this initializer within the `makeBody(configuration:)` method of a
< /// `MenuStyle` to create an instance of the menu being styled. This is
< /// useful for custom menu styles that modify the current menu style.
< ///
< /// For example, the following code creates a new, custom style that adds a
< /// red border around the current menu style:
< ///
< /// struct RedBorderMenuStyle : MenuStyle {
< /// func makeBody(configuration: Configuration) -> some View {
< /// Menu(configuration)
< /// .border(Color.red)
< /// }
< /// }
---
> /// The type of widget representing the body of this widget.
9228c8919,8924
< public init(_ configuration: MenuStyleConfiguration)
---
> /// When you create a custom view, Swift infers this type from your
> /// implementation of the required `body` property.
> public typealias WidgetBody = Never
>
> /// Declares the content and behavior of this widget.
> public var body: ModifiedContent<Content, Modifier>.WidgetBody { get }
9231,9245c8927,8928
< /// A button that displays a menu containing a list of choices when pressed.
< @available(iOS, unavailable)
< @available(OSX, introduced: 10.15, deprecated: 100000.0, message: "Use `Menu` instead.")
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
< public struct MenuButton<Label, Content> : View where Label : View, Content : View {
<
< /// Creates an instance of `MenuButton` with a given label and content
< /// to present to the user.
< ///
< /// - Parameters:
< /// - label: Describes the purpose of this `MenuButton`.
< /// - content: The content to present to the user when the `MenuButton` is
< /// interacted with.
< public init(label: Label, @ViewBuilder content: () -> Content)
---
> @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
> extension ModifiedContent where Modifier == AccessibilityAttachmentModifier {
9247,9248c8930,8931
< /// The content and behavior of the view.
< public var body: some View { get }
---
> /// Adds an accessibility action to this view.
> public func accessibilityAction(_ actionKind: AccessibilityActionKind = .default, _ handler: @escaping () -> Void) -> ModifiedContent<Content, Modifier>
9250,9254c8933,8934
< /// The type of view representing the body of this view.
< ///
< /// When you create a custom view, Swift infers this type from your
< /// implementation of the required `body` property.
< public typealias Body = some View
---
> /// Adds a custom accessibility action to the view and all subviews.
> public func accessibilityAction(named name: Text, _ handler: @escaping () -> Void) -> ModifiedContent<Content, Modifier>
9257,9261c8937,8938
< @available(iOS, unavailable)
< @available(OSX, introduced: 10.15, deprecated: 100000.0, message: "Use `Menu` instead.")
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
< extension MenuButton where Label == Text {
---
> @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
> extension ModifiedContent : Equatable where Content : Equatable, Modifier : Equatable {
9263,9264c8940
< /// Creates an instance of `MenuButton` with a given localized title and
< /// content to be presented to the user.
---
> /// Returns a Boolean value indicating whether two values are equal.
9266,9274c8942,8943
< /// - Parameters:
< /// - titleKey: The key for the localized title of `self`, describing
< /// its purpose.
< /// - content: The content to present to the user when the `MenuButton` is
< /// interacted with.
< public init(_ titleKey: LocalizedStringKey, @ViewBuilder content: () -> Content)
<
< /// Creates an instance of `MenuButton` with a given title and content to
< /// be presented to the user.
---
> /// Equality is the inverse of inequality. For any values `a` and `b`,
> /// `a == b` implies that `a != b` is `false`.
9277,9388c8946,8948
< /// - title: The title of `self`, describing its purpose.
< /// - content: The content to present to the user when the `MenuButton` is
< /// interacted with.
< public init<S>(_ title: S, @ViewBuilder content: () -> Content) where S : StringProtocol
< }
<
< /// A custom specification for the appearance and interaction of a `MenuButton`.
< @available(iOS, unavailable)
< @available(OSX, introduced: 10.15, deprecated: 100000.0, message: "Use `MenuStyle` instead.")
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
< public protocol MenuButtonStyle {
< }
<
< /// A type that applies standard interaction behavior and a custom appearance
< /// to all menus within a view hierarchy.
< ///
< /// To configure the current menu style for a view hiearchy, use the
< /// `menuStyle(_:)` modifier.
< @available(OSX 10.16, *)
< @available(iOS, unavailable)
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
< public protocol MenuStyle {
<
< /// A view that represents the body of a menu.
< associatedtype Body : View
<
< /// Creates a view that represents the body of a menu.
< ///
< /// - Parameter configuration: The properties of the menu.
< ///
< /// The system calls this method for each `Menu` instance in a view
< /// hierarchy where this style is the current menu style.
< func makeBody(configuration: Self.Configuration) -> Self.Body
<
< /// The properties of a menu.
< typealias Configuration = MenuStyleConfiguration
< }
<
< /// A configuration of a menu.
< ///
< /// Use the `Menu(_ configuration:)` initializer of `Menu` to create an instance
< /// using the current menu style, which can then be modified to create a custom
< /// style.
< ///
< /// For example, the following code creates a new, custom style that adds a red
< /// border around the current menu style:
< ///
< /// struct RedBorderMenuStyle : MenuStyle {
< /// func makeBody(configuration: Configuration) -> some View {
< /// Menu(configuration)
< /// .border(Color.red)
< /// }
< /// }
< ///
< @available(OSX 10.16, *)
< @available(iOS, unavailable)
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
< public struct MenuStyleConfiguration {
<
< /// A type-erased label of a menu.
< public struct Label : View {
<
< /// The type of view representing the body of this view.
< ///
< /// When you create a custom view, Swift infers this type from your
< /// implementation of the required `body` property.
< public typealias Body = Never
< }
<
< /// A type-erased content of a menu.
< public struct Content : View {
<
< /// The type of view representing the body of this view.
< ///
< /// When you create a custom view, Swift infers this type from your
< /// implementation of the required `body` property.
< public typealias Body = Never
< }
< }
<
< /// A value with a modifier applied to it.
< @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
< @frozen public struct ModifiedContent<Content, Modifier> {
<
< /// The type of view representing the body of this view.
< ///
< /// When you create a custom view, Swift infers this type from your
< /// implementation of the required `body` property.
< public typealias Body = Never
<
< public var content: Content
<
< public var modifier: Modifier
<
< @inlinable public init(content: Content, modifier: Modifier)
< }
<
< @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
< extension ModifiedContent : Equatable where Content : Equatable, Modifier : Equatable {
<
< /// Returns a Boolean value indicating whether two values are equal.
< ///
< /// Equality is the inverse of inequality. For any values `a` and `b`,
< /// `a == b` implies that `a != b` is `false`.
< ///
< /// - Parameters:
< /// - lhs: A value to compare.
< /// - rhs: Another value to compare.
< public static func == (a: ModifiedContent<Content, Modifier>, b: ModifiedContent<Content, Modifier>) -> Bool
---
> /// - lhs: A value to compare.
> /// - rhs: Another value to compare.
> public static func == (a: ModifiedContent<Content, Modifier>, b: ModifiedContent<Content, Modifier>) -> Bool
9402,9405c8962,8963
< @available(iOS 14.0, OSX 10.16, *)
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
< extension ModifiedContent where Content : _Widget, Modifier : _WidgetModifier {
---
> @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
> extension ModifiedContent : DynamicViewContent where Content : DynamicViewContent, Modifier : ViewModifier {
9407,9411c8965,8966
< /// The type of widget representing the body of this widget.
< ///
< /// When you create a custom view, Swift infers this type from your
< /// implementation of the required `body` property.
< public typealias WidgetBody = Never
---
> /// The collection of underlying data.
> public var data: Content.Data { get }
9413,9414c8968,8969
< /// Declares the content and behavior of this widget.
< public var body: ModifiedContent<Content, Modifier>.WidgetBody { get }
---
> /// The type of the underlying collection of data.
> public typealias Data = Content.Data
9435,9468d8989
< /// Adds an accessibility action to this view.
< public func accessibilityAction(_ actionKind: AccessibilityActionKind = .default, _ handler: @escaping () -> Void) -> ModifiedContent<Content, Modifier>
<
< /// Adds a custom accessibility action to the view and all subviews.
< public func accessibilityAction(named name: Text, _ handler: @escaping () -> Void) -> ModifiedContent<Content, Modifier>
< }
<
< @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
< extension ModifiedContent : DynamicViewContent where Content : DynamicViewContent, Modifier : ViewModifier {
<
< /// The collection of underlying data.
< public var data: Content.Data { get }
<
< /// The type of the underlying collection of data.
< public typealias Data = Content.Data
< }
<
< @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
< extension ModifiedContent where Modifier == AccessibilityAttachmentModifier {
<
< /// Adds an accessibility scroll action to the view.
< public func accessibilityScrollAction(_ handler: @escaping (Edge) -> Void) -> ModifiedContent<Content, Modifier>
< }
<
< @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
< extension ModifiedContent where Modifier == AccessibilityAttachmentModifier {
<
< /// Adds an accessibility adjustable action to the view.
< public func accessibilityAdjustableAction(_ handler: @escaping (AccessibilityAdjustmentDirection) -> Void) -> ModifiedContent<Content, Modifier>
< }
<
< @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
< extension ModifiedContent where Modifier == AccessibilityAttachmentModifier {
<
9528,9536c9049,9050
< /// Specifies the direction of an arrow key movement.
< @available(OSX 10.15, tvOS 13.0, *)
< @available(iOS, unavailable)
< @available(watchOS, unavailable)
< public enum MoveCommandDirection {
<
< case up
<
< case down
---
> @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
> extension ModifiedContent where Modifier == AccessibilityAttachmentModifier {
9538c9052,9057
< case left
---
> /// Adds an accessibility scroll action to the view.
> public func accessibilityScrollAction(_ handler: @escaping (Edge) -> Void) -> ModifiedContent<Content, Modifier>
> }
>
> @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
> extension ModifiedContent where Modifier == AccessibilityAttachmentModifier {
9540c9059,9067
< case right
---
> /// Adds an accessibility adjustable action to the view.
> public func accessibilityAdjustableAction(_ handler: @escaping (AccessibilityAdjustmentDirection) -> Void) -> ModifiedContent<Content, Modifier>
> }
>
> /// A dynamic property type that allows access to a namespace defined
> /// by the persistent identity of the object containing the property
> /// (e.g. a view).
> @available(iOS 14.0, OSX 10.16, tvOS 14.0, watchOS 7.0, *)
> @frozen @propertyWrapper public struct Namespace : DynamicProperty {
9542,9550c9069
< /// Returns a Boolean value indicating whether two values are equal.
< ///
< /// Equality is the inverse of inequality. For any values `a` and `b`,
< /// `a == b` implies that `a != b` is `false`.
< ///
< /// - Parameters:
< /// - lhs: A value to compare.
< /// - rhs: Another value to compare.
< public static func == (a: MoveCommandDirection, b: MoveCommandDirection) -> Bool
---
> @inlinable public init()
9552,9559c9071
< /// The hash value.
< ///
< /// Hash values are not guaranteed to be equal across different executions of
< /// your program. Do not save hash values to use during a future execution.
< ///
< /// - Important: `hashValue` is deprecated as a `Hashable` requirement. To
< /// conform to `Hashable`, implement the `hash(into:)` requirement instead.
< public var hashValue: Int { get }
---
> public var wrappedValue: Namespace.ID { get }
9561,9574c9073,9110
< /// Hashes the essential components of this value by feeding them into the
< /// given hasher.
< ///
< /// Implement this method to conform to the `Hashable` protocol. The
< /// components used for hashing must be the same as the components compared
< /// in your type's `==` operator implementation. Call `hasher.combine(_:)`
< /// with each of these components.
< ///
< /// - Important: Never call `finalize()` on `hasher`. Doing so may become a
< /// compile-time error in the future.
< ///
< /// - Parameter hasher: The hasher to use when combining the components
< /// of this instance.
< public func hash(into hasher: inout Hasher)
---
> /// A namespace defined by the persistent identity of an
> /// `@Namespace` dynamic property.
> @frozen public struct ID : Hashable {
>
> /// The hash value.
> ///
> /// Hash values are not guaranteed to be equal across different executions of
> /// your program. Do not save hash values to use during a future execution.
> ///
> /// - Important: `hashValue` is deprecated as a `Hashable` requirement. To
> /// conform to `Hashable`, implement the `hash(into:)` requirement instead.
> public var hashValue: Int { get }
>
> /// Hashes the essential components of this value by feeding them into the
> /// given hasher.
> ///
> /// Implement this method to conform to the `Hashable` protocol. The
> /// components used for hashing must be the same as the components compared
> /// in your type's `==` operator implementation. Call `hasher.combine(_:)`
> /// with each of these components.
> ///
> /// - Important: Never call `finalize()` on `hasher`. Doing so may become a
> /// compile-time error in the future.
> ///
> /// - Parameter hasher: The hasher to use when combining the components
> /// of this instance.
> public func hash(into hasher: inout Hasher)
>
> /// Returns a Boolean value indicating whether two values are equal.
> ///
> /// Equality is the inverse of inequality. For any values `a` and `b`,
> /// `a == b` implies that `a != b` is `false`.
> ///
> /// - Parameters:
> /// - lhs: A value to compare.
> /// - rhs: Another value to compare.
> public static func == (a: Namespace.ID, b: Namespace.ID) -> Bool
> }
9577,9580c9113,9166
< @available(OSX 10.15, tvOS 13.0, *)
< @available(iOS, unavailable)
< @available(watchOS, unavailable)
< extension MoveCommandDirection : Equatable {
---
> /// A configuration for a navigation bar that represents a view at the top of a
> /// navigation stack.
> @available(iOS 13.0, tvOS 13.0, watchOS 6.0, *)
> @available(OSX, unavailable)
> public struct NavigationBarItem {
>
> /// A style for displaying the title of a navigation bar.
> public enum TitleDisplayMode {
>
> /// Inherit the display mode from the previous navigation item.
> case automatic
>
> /// Display the title within the standard bounds of the navigation bar.
> case inline
>
> /// Display a large title within an expanded navigation bar.
> @available(tvOS, unavailable)
> @available(watchOS, unavailable)
> case large
>
> /// Returns a Boolean value indicating whether two values are equal.
> ///
> /// Equality is the inverse of inequality. For any values `a` and `b`,
> /// `a == b` implies that `a != b` is `false`.
> ///
> /// - Parameters:
> /// - lhs: A value to compare.
> /// - rhs: Another value to compare.
> public static func == (a: NavigationBarItem.TitleDisplayMode, b: NavigationBarItem.TitleDisplayMode) -> Bool
>
> /// The hash value.
> ///
> /// Hash values are not guaranteed to be equal across different executions of
> /// your program. Do not save hash values to use during a future execution.
> ///
> /// - Important: `hashValue` is deprecated as a `Hashable` requirement. To
> /// conform to `Hashable`, implement the `hash(into:)` requirement instead.
> public var hashValue: Int { get }
>
> /// Hashes the essential components of this value by feeding them into the
> /// given hasher.
> ///
> /// Implement this method to conform to the `Hashable` protocol. The
> /// components used for hashing must be the same as the components compared
> /// in your type's `==` operator implementation. Call `hasher.combine(_:)`
> /// with each of these components.
> ///
> /// - Important: Never call `finalize()` on `hasher`. Doing so may become a
> /// compile-time error in the future.
> ///
> /// - Parameter hasher: The hasher to use when combining the components
> /// of this instance.
> public func hash(into hasher: inout Hasher)
> }
9583,9586c9169,9171
< @available(OSX 10.15, tvOS 13.0, *)
< @available(iOS, unavailable)
< @available(watchOS, unavailable)
< extension MoveCommandDirection : Hashable {
---
> @available(iOS 13.0, tvOS 13.0, watchOS 6.0, *)
> @available(OSX, unavailable)
> extension NavigationBarItem.TitleDisplayMode : Equatable {
9589,9607c9174,9176
< /// A property wrapper that is used in `App` to provide a delegate from AppKit.
< @available(OSX 10.16, *)
< @available(iOS, unavailable)
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
< @propertyWrapper public struct NSApplicationDelegateAdaptor<DelegateType> : DynamicProperty where DelegateType : NSObject, DelegateType : NSApplicationDelegate {
<
< /// The underlying delegate.
< public var wrappedValue: DelegateType { get }
<
< /// Creates an `NSApplicationDelegateAdaptor` using an AppKit Application
< /// Delegate.
< ///
< /// The framework will initialize the provided delegate and manage its
< /// lifetime, calling out to it when appropriate after performing its
< /// own work.
< ///
< /// - Parameter delegate: the type of `NSApplicationDelegate` to use.
< public init(_ delegateType: DelegateType.Type = DelegateType.self)
---
> @available(iOS 13.0, tvOS 13.0, watchOS 6.0, *)
> @available(OSX, unavailable)
> extension NavigationBarItem.TitleDisplayMode : Hashable {
9610,9614c9179,9181
< @available(OSX 10.16, *)
< @available(iOS, unavailable)
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
< extension NSApplicationDelegateAdaptor where DelegateType : ObservableObject {
---
> /// A view that controls a navigation presentation.
> @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
> public struct NavigationLink<Label, Destination> : View where Label : View, Destination : View {
9616,9627c9183,9184
< /// Creates an `NSApplicationDelegateAdaptor` using an AppKit Application
< /// Delegate.
< ///
< /// The framework will initialize the provided delegate and manage its
< /// lifetime, calling out to it when appropriate after performing its
< /// own work.
< ///
< /// - Parameter delegate: the type of `NSApplicationDelegate` to use.
< /// - Note: the instantiated delegate will be placed in the Environment
< /// and may be accessed by using the `@EnvironmentObject` property wrapper
< /// in the view hierarchy.
< public init(_ delegateType: DelegateType.Type = DelegateType.self)
---
> /// Creates an instance that presents `destination`.
> public init(destination: Destination, @ViewBuilder label: () -> Label)
9629,9630c9186,9196
< /// A projection of the observed object that creates bindings to its
< /// properties using dynamic member lookup.
---
> /// Creates an instance that presents `destination` when active.
> public init(destination: Destination, isActive: Binding<Bool>, @ViewBuilder label: () -> Label)
>
> /// Creates an instance that presents `destination` when `selection` is set
> /// to `tag`.
> public init<V>(destination: Destination, tag: V, selection: Binding<V?>, @ViewBuilder label: () -> Label) where V : Hashable
>
> /// The content and behavior of the view.
> public var body: some View { get }
>
> /// The type of view representing the body of this view.
9632,9635c9198,9200
< /// Use the projected value to pass a binding value down a view
< /// hierarchy. To get the `projectedValue`, prefix the property
< /// variable with `$`.
< public var projectedValue: ObservedObject<DelegateType>.Wrapper { get }
---
> /// When you create a custom view, Swift infers this type from your
> /// implementation of the required `body` property.
> public typealias Body = some View
9638,9657c9203,9204
< /// An AppKit view controller that hosts SwiftUI view hierarchy.
< ///
< /// Create an `NSHostingController` object when you want to integrate SwiftUI
< /// views into an AppKit view hierarchy. At creation time, specify the SwiftUI
< /// view you want to use as the root view for this view controller; you can
< /// change that view later using the ``NSHostingController/rootView`` property.
< /// Use the hosting controller like you would any other view controller, by
< /// presenting it or embedding it as a child view controller in your interface.
< @available(OSX 10.15, *)
< @available(iOS, unavailable)
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
< open class NSHostingController<Content> : NSViewController where Content : View {
<
< /// Creates a hosting controller object that wraps the specified SwiftUI
< /// view.
< ///
< /// - Parameter rootView: The root view of the SwiftUI view hierarchy that
< /// you want to manage using the hosting view controller.
< public init(rootView: Content)
---
> @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
> extension NavigationLink where Label == Text {
9659,9666c9206,9208
< /// Creates a hosting controller object from an archive and the specified
< /// SwiftUI view.
< ///
< /// - Parameters:
< /// - coder: The decoder to use during initialization.
< /// - rootView: The root view of the SwiftUI view hierarchy that you want
< /// to manage using this view controller.
< public init?(coder: NSCoder, rootView: Content)
---
> /// Creates an instance that presents `destination`, with a `Text` label
> /// generated from a title string.
> public init(_ titleKey: LocalizedStringKey, destination: Destination)
9668,9677c9210,9212
< /// Creates a hosting controller object from the contents of the specified
< /// archive.
< ///
< /// The default implementation of this method throws an exception. To create
< /// your view controller from an archive, override this method and
< /// initialize the superclass using the
< /// ``NSHostingController/init(coder:rootView:)`` method instead.
< ///
< /// - Parameter coder: The decoder to use during initialization.
< @objc required dynamic public init?(coder: NSCoder)
---
> /// Creates an instance that presents `destination`, with a `Text` label
> /// generated from a title string.
> public init<S>(_ title: S, destination: Destination) where S : StringProtocol
9679,9681c9214,9216
< /// The root view of the SwiftUI view hierarchy managed by this view
< /// controller.
< public var rootView: Content
---
> /// Creates an instance that presents `destination` when active, with a
> /// `Text` label generated from a title string.
> public init(_ titleKey: LocalizedStringKey, destination: Destination, isActive: Binding<Bool>)
9683c9218,9220
< @objc override dynamic open var identifier: NSUserInterfaceItemIdentifier?
---
> /// Creates an instance that presents `destination` when active, with a
> /// `Text` label generated from a title string.
> public init<S>(_ title: S, destination: Destination, isActive: Binding<Bool>) where S : StringProtocol
9685,9691c9222,9224
< /// Calculates and returns the most appropriate size for the current view.
< ///
< /// - Parameter size: The proposed new size for the view.
< ///
< /// - Returns: The size that offers the best fit for the root view and its
< /// contents.
< public func sizeThatFits(in size: CGSize) -> CGSize
---
> /// Creates an instance that presents `destination` when `selection` is set
> /// to `tag`, with a `Text` label generated from a title string.
> public init<V>(_ titleKey: LocalizedStringKey, destination: Destination, tag: V, selection: Binding<V?>) where V : Hashable
9693c9226,9228
< @objc override dynamic public init(nibName nibNameOrNil: NSNib.Name?, bundle nibBundleOrNil: Bundle?)
---
> /// Creates an instance that presents `destination` when `selection` is set
> /// to `tag`, with a `Text` label generated from a title string.
> public init<S, V>(_ title: S, destination: Destination, tag: V, selection: Binding<V?>) where S : StringProtocol, V : Hashable
9696,9712c9231,9232
< /// An AppKit view that hosts a SwiftUI view hierarchy.
< ///
< /// You use `NSHostingView` objects to integrate SwiftUI views into your
< /// AppKit view hierarchies. A hosting view is an
< /// <doc://com.apple.documentation/documentation/AppKit/NSView> object that manages a single
< /// SwiftUI view, which may itself contain other SwiftUI views. Because it is an
< /// <doc://com.apple.documentation/documentation/AppKit/NSView> object, you can integrate it
< /// into your existing AppKit view hierarchies to implement portions of your UI.
< /// For example, you can use a hosting view to implement a custom control.
< ///
< /// A hosting view acts as a bridge between your SwiftUI views and your AppKit
< /// interface. During layout, the hosting view reports the content size
< /// preferences of your SwiftUI views back to the AppKit layout system so that
< /// it can size the view appropriately. The hosting view also coordinates event
< /// delivery.
< @available(OSX 10.15, *)
< @available(iOS, unavailable)
---
> @available(iOS 13.0, *)
> @available(OSX, unavailable)
9715,9721c9235
< open class NSHostingView<Content> : NSView, NSUserInterfaceValidations, NSDraggingSource where Content : View {
<
< /// Creates a hosting view object that wraps the specified SwiftUI view.
< ///
< /// - Parameter rootView: The root view of the SwiftUI view hierarchy that
< /// you want to manage using this hosting controller.
< required public init(rootView: Content)
---
> extension NavigationLink {
9723,9724c9237,9238
< /// Creates a hosting view object from the contents of the specified
< /// archive.
---
> /// Sets whether or not the `NavigationLink` should present its destination
> /// as the "detail" component of the containing `NavigationView`.
9726,9797c9240,9244
< /// The default implementation of this method throws an exception. Use the
< /// ``NSHostingView/init(rootView:)`` method to create your hosting view
< /// instead.
< ///
< /// - Parameter coder: The decoder to use during initialization.
< @objc required dynamic public init?(coder aDecoder: NSCoder)
<
< @objc override final public var isFlipped: Bool
<
< @objc override dynamic open func renewGState()
<
< @objc override dynamic open var firstBaselineOffsetFromTop: CGFloat { get }
<
< @objc override dynamic open var lastBaselineOffsetFromBottom: CGFloat { get }
<
< @objc override dynamic open var intrinsicContentSize: NSSize { get }
<
< @objc override dynamic open class var requiresConstraintBasedLayout: Bool { get }
<
< @objc override dynamic open func updateConstraints()
<
< @objc override dynamic open var layerContentsRedrawPolicy: NSView.LayerContentsRedrawPolicy
<
< @objc override dynamic open func layout()
<
< @objc override dynamic open func setFrameSize(_ newSize: NSSize)
<
< /// The root view of the SwiftUI view hierarchy managed by this view
< /// controller.
< public var rootView: Content
<
< @objc override dynamic open func viewDidChangeBackingProperties()
<
< @objc override dynamic open func viewDidChangeEffectiveAppearance()
<
< @objc override dynamic open var userInterfaceLayoutDirection: NSUserInterfaceLayoutDirection
<
< @objc override dynamic open func viewWillMove(toWindow newWindow: NSWindow?)
<
< @objc override dynamic open func viewDidMoveToWindow()
<
< @objc override dynamic open func viewDidMoveToSuperview()
<
< @objc override dynamic open func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?)
<
< @objc override dynamic open func hitTest(_ point: NSPoint) -> NSView?
<
< @objc override dynamic open var acceptsFirstResponder: Bool { get }
<
< @objc override dynamic open var needsPanelToBecomeKey: Bool { get }
<
< @objc override dynamic open var canBecomeKeyView: Bool { get }
<
< @objc override dynamic open func magnify(with event: NSEvent)
<
< @objc override dynamic open func rotate(with event: NSEvent)
<
< @objc override dynamic open func mouseDown(with event: NSEvent)
<
< @objc override dynamic open func mouseDragged(with event: NSEvent)
<
< @objc override dynamic open func mouseUp(with event: NSEvent)
<
< @objc override dynamic open func rightMouseDown(with event: NSEvent)
<
< @objc override dynamic open func rightMouseDragged(with event: NSEvent)
<
< @objc override dynamic open func rightMouseUp(with event: NSEvent)
<
< @objc override dynamic open func otherMouseDown(with event: NSEvent)
<
< @objc override dynamic open func otherMouseDragged(with event: NSEvent)
---
> /// If not set, defaults to `true`.
> @available(OSX, unavailable)
> @available(tvOS, unavailable)
> @available(watchOS, unavailable)
> public func isDetailLink(_ isDetailLink: Bool) -> some View
9799c9246,9251
< @objc override dynamic open func otherMouseUp(with event: NSEvent)
---
> }
>
> /// A view for presenting a stack of views representing a visible path in a
> /// navigation hierarchy.
> @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 7.0, *)
> public struct NavigationView<Content> : View where Content : View {
9801c9253
< @objc override dynamic open func mouseEntered(with event: NSEvent)
---
> public init(@ViewBuilder content: () -> Content)
9803c9255,9270
< @objc override dynamic open func mouseExited(with event: NSEvent)
---
> /// The type of view representing the body of this view.
> ///
> /// When you create a custom view, Swift infers this type from your
> /// implementation of the required `body` property.
> public typealias Body = Never
> }
>
> /// A specification for the appearance and interaction of a `NavigationView`.
> @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 7.0, *)
> public protocol NavigationViewStyle {
> }
>
> /// A property wrapper type that subscribes to an observable object and
> /// invalidates a view whenever the observable object changes.
> @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
> @propertyWrapper @frozen public struct ObservedObject<ObjectType> : DynamicProperty where ObjectType : ObservableObject {
9805c9272,9282
< @objc override dynamic open func scrollWheel(with event: NSEvent)
---
> /// A wrapper of the underlying observable object that can create bindings to
> /// its properties using dynamic member lookup.
> @dynamicMemberLookup @frozen public struct Wrapper {
>
> /// Returns a binding to the resulting value of a given key path.
> ///
> /// - Parameter keyPath : A key path to a specific resulting value.
> ///
> /// - Returns: A new binding.
> public subscript<Subject>(dynamicMember keyPath: ReferenceWritableKeyPath<ObjectType, Subject>) -> Binding<Subject> { get }
> }
9807c9284,9287
< @objc override dynamic open func touchesBegan(with event: NSEvent)
---
> /// Creates an observed object with an initial value.
> ///
> /// - Parameter initialValue: An initial value.
> public init(initialValue: ObjectType)
9809c9289,9295
< @objc override dynamic open func touchesMoved(with event: NSEvent)
---
> /// Creates an observed object with an initial wrapped value.
> ///
> /// You don't call this initializer directly. Instead, declare a property
> /// with the `@ObservedObject` attribute, and provide an initial value.
> ///
> /// - Parameter wrappedValue: An initial value.
> public init(wrappedValue: ObjectType)
9811c9297,9306
< @objc override dynamic open func touchesEnded(with event: NSEvent)
---
> /// The underlying value referenced by the observed object.
> ///
> /// This property provides primary access to the value's data. However, you
> /// don't access `wrappedValue` directly. Instead, you use the property
> /// variable created with the `@ObservedObject` attribute.
> ///
> /// When a mutable value changes, the new value is immediately available.
> /// However, a view displaying the value is updated asynchronously and may
> /// not show the new value immediately.
> public var wrappedValue: ObjectType
9813c9308,9318
< @objc override dynamic open func touchesCancelled(with event: NSEvent)
---
> /// A projection of the observed object that creates bindings to its
> /// properties using dynamic member lookup.
> ///
> /// Use the projected value to pass a binding value down a view hierarchy.
> /// To get the `projectedValue`, prefix the property variable with `$`.
> public var projectedValue: ObservedObject<ObjectType>.Wrapper { get }
> }
>
> /// A shape with a translation offset transform applied to it.
> @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
> @frozen public struct OffsetShape<Content> : Shape where Content : Shape {
9815c9320
< @objc override dynamic open func menu(for event: NSEvent) -> NSMenu?
---
> public var shape: Content
9817c9322
< @objc override dynamic open var accessibilityFocusedUIElement: Any? { get }
---
> public var offset: CGSize
9819c9324
< @objc override dynamic open func accessibilityChildren() -> [Any]?
---
> @inlinable public init(shape: Content, offset: CGSize)
9821c9326,9331
< @objc override dynamic open func accessibilityHitTest(_ point: NSPoint) -> Any?
---
> /// Describes this shape as a path within a rectangular frame of reference.
> ///
> /// - Parameter rect: The frame of reference for describing this shape.
> ///
> /// - Returns: A path that describes this shape.
> public func path(in rect: CGRect) -> Path
9823c9333,9334
< @objc public func validateUserInterfaceItem(_ item: NSValidatedUserInterfaceItem) -> Bool
---
> /// The type defining the data to animate.
> public typealias AnimatableData = AnimatablePair<Content.AnimatableData, CGSize.AnimatableData>
9825c9336,9337
< @objc override dynamic open func responds(to selector: Selector!) -> Bool
---
> /// The data to animate.
> public var animatableData: OffsetShape<Content>.AnimatableData
9827c9339,9347
< @objc override dynamic open func forwardingTarget(for selector: Selector!) -> Any?
---
> /// The type of view representing the body of this view.
> ///
> /// When you create a custom view, Swift infers this type from your
> /// implementation of the required `body` property.
> public typealias Body
> }
>
> @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
> extension OffsetShape : InsettableShape where Content : InsettableShape {
9829c9349,9350
< @objc public func draggingSession(_ session: NSDraggingSession, sourceOperationMaskFor context: NSDraggingContext) -> NSDragOperation
---
> /// Returns `self` inset by `amount`.
> @inlinable public func inset(by amount: CGFloat) -> OffsetShape<Content.InsetShape>
9831c9352,9353
< @objc override dynamic public init(frame frameRect: NSRect)
---
> /// The type of the inset shape.
> public typealias InsetShape = OffsetShape<Content.InsetShape>
9834,9835c9356
< /// A wrapper that you use to integrate an AppKit view controller into your
< /// SwiftUI interface.
---
> /// Provides functionality for opening a URL.
9837,9846c9358,9359
< /// Use an ``NSViewControllerRepresentable`` instance to create and manage an
< /// <doc://com.apple.documentation/documentation/AppKit/NSViewController> object in your
< /// SwiftUI interface. Adopt this protocol in one of your app's custom
< /// instances, and use its methods to create, update, and tear down your view
< /// controller. The creation and update processes parallel the behavior of
< /// SwiftUI views, and you use them to configure your view controller with your
< /// app's current state information. Use the teardown process to remove your
< /// view controller cleanly from your SwiftUI. For example, you might use the
< /// teardown process to notify other objects that the view controller is
< /// disappearing.
---
> /// An `OpenURLAction` should be obtained from the environment, and can be used
> /// to open a URL as the result of some user action.
9848,9851c9361,9362
< /// To add your view controller into your SwiftUI interface, create your
< /// `NSViewControllerRepresentable` instance and add it to your SwiftUI
< /// interface. The system calls the methods of your custom instance at
< /// appropriate times.
---
> /// struct SupportView : View {
> /// @Environment(\.openURL) var openURL
9853,9866c9364,9376
< /// The system doesn't automatically communicate changes occurring within your
< /// view controller to other parts of your SwiftUI interface. When you want your
< /// view controller to coordinate with other SwiftUI views, you must provide a
< /// ``NSViewControllerRepresentable/Coordinator`` instance to facilitate those
< /// interactions. For example, you use a coordinator to forward target-action
< /// and delegate messages from your view controller to any SwiftUI views.
< @available(OSX 10.15, *)
< @available(iOS, unavailable)
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
< public protocol NSViewControllerRepresentable : View where Self.Body == Never {
<
< /// The type of view controller to present.
< associatedtype NSViewControllerType : NSViewController
---
> /// var body: some View {
> /// Button(action: contactSupport) {
> /// Text("Email Support")
> /// Image(systemName: "envelope.open")
> /// }
> /// }
> ///
> /// func contactSupport() {
> /// openURL(mailToSupport)
> /// }
> /// }
> @available(iOS 14.0, OSX 10.16, tvOS 14.0, watchOS 7.0, *)
> public struct OpenURLAction {
9868c9378
< /// Creates the view controller object and configures its initial state.
---
> /// Requests that a URL be opened, following system conventions.
9870,9883c9380,9382
< /// You must implement this method and use it to create your view controller
< /// object. Create the view controller using your app's current data and
< /// contents of the `context` parameter. The system calls this method only
< /// once, when it creates your view controller for the first time. For all
< /// subsequent updates, the system calls the
< /// ``NSViewControllerRepresentable/updateNSViewController(_:context:)``
< /// method.
< ///
< /// - Parameter context: A context structure containing information about
< /// the current state of the system.
< ///
< /// - Returns: Your AppKit view controller configured with the provided
< /// information.
< func makeNSViewController(context: Self.Context) -> Self.NSViewControllerType
---
> /// - Parameters:
> /// - url: A URL to be opened by the system.
> public func callAsFunction(_ url: URL)
9885,9886c9384
< /// Updates the state of the specified view controller with new information
< /// from SwiftUI.
---
> /// Requests that a URL be opened, following system conventions.
9888,9892c9386,9390
< /// When the state of your app changes, SwiftUI updates the portions of your
< /// interface affected by those changes. SwiftUI calls this method for any
< /// changes affecting the corresponding AppKit view controller. Use this
< /// method to update the configuration of your view controller to match the
< /// new state information provided in the `context` parameter.
---
> /// When this method is called the URL will be asynchronously opened, and a
> /// result returned indicating whether the system could handle the URL. The
> /// completion runs after the system has decided whether it can handle the
> /// URL. Actual handling may not yet be complete when the completion
> /// is called.
9895,9898c9393,9472
< /// - nsViewController: Your custom view controller object.
< /// - context: A context structure containing information about the current
< /// state of the system.
< func updateNSViewController(_ nsViewController: Self.NSViewControllerType, context: Self.Context)
---
> /// - url: A URL to be opened by the system.
> /// - completion: Invoked with whether the URL could be opened.
> /// - accepted: Indicating whether or not the system will process the
> /// request. If the value is `false`, then the system has refused the
> /// request and the app should respond appropriately. For example, the app
> /// could alert the user or attempt to open a fallback URL.
> @available(watchOS, unavailable)
> public func callAsFunction(_ url: URL, completion: @escaping (Bool) -> Void)
> }
>
> /// A structure that computes views and disclosure groups on demand from an
> /// underlying collection of tree-structured, identified data.
> ///
> /// Use an outline group when you need a view that can represent a hierarchy
> /// of data by using disclosure views. This allows the user to navigate the
> /// tree structure by using the disclosure views to expand and collapse
> /// branches.
> ///
> /// In the following example, a tree structure of `FileItem` data offers a
> /// simplified view of a file system. Passing the root of this tree and the
> /// key path of its children allows you to quickly create a visual
> /// representation of the file system.
> ///
> /// struct FileItem: Hashable, Identifiable, CustomStringConvertible {
> /// var id: Self { self }
> /// var name: String
> /// var children: [FileItem]? = nil
> /// var description: String {
> /// switch (children) {
> /// case nil:
> /// return "📄 \(name)"
> /// case .some(let children):
> /// return children.count > 0 ? "📂 \(name)" : "📁 \(name)"
> /// }
> /// }
> /// }
> ///
> /// let data =
> /// FileItem(name: "users", children:
> /// [FileItem(name: "user1234", children:
> /// [FileItem(name:"Photos", children:
> /// [FileItem(name: "photo001.jpg"),
> /// FileItem(name: "photo002.jpg")]),
> /// FileItem(name:"Movies", children:
> /// [FileItem(name: "movie001.mp4")]),
> /// FileItem(name:"Documents", children: [])
> /// ]),
> /// FileItem(name: "newuser", children:
> /// [FileItem (name: "Documents", children: [])
> /// ])
> /// ])
> ///
> /// OutlineGroup(data, children: \.children) { item in
> /// Text ("\(item.description)")
> /// }
> ///
> /// ### Type Parameters
> ///
> /// Five generic type constraints define a specific `OutlineGroup` instance:
> ///
> /// - `Data`: The type of a collection containing the children of an element in
> /// the tree-shaped data.
> /// - `ID`: The type of the identifier for an element.
> /// - `Parent`: The type of the visual representation of an element whose
> /// children property is non-`nil`
> /// - `Leaf`: The type of the visual representation of an element whose
> /// children property is `nil`.
> /// - `Subgroup`: A type of a view that groups a parent view and a view
> /// representing its children, typically with some mechanism for showing and
> /// hiding the children
> @available(iOS 14.0, OSX 10.16, *)
> @available(tvOS, unavailable)
> @available(watchOS, unavailable)
> public struct OutlineGroup<Data, ID, Parent, Leaf, Subgroup> where Data : RandomAccessCollection, ID : Hashable {
> }
>
> @available(iOS 14.0, OSX 10.16, *)
> @available(tvOS, unavailable)
> @available(watchOS, unavailable)
> extension OutlineGroup where ID == Data.Element.ID, Parent : View, Parent == Leaf, Subgroup == DisclosureGroup<Parent, OutlineSubgroupChildren>, Data.Element : Identifiable {
9900,9901c9474,9475
< /// Cleans up the presented view controller (and coordinator) in
< /// anticipation of its removal.
---
> /// Creates an outline group from a root data element and a key path to
> /// its children.
9903,9905c9477,9485
< /// Use this method to perform additional clean-up work related to your
< /// custom view controller. For example, you might use this method to remove
< /// observers or update other parts of your SwiftUI interface.
---
> /// This initializer creates an instance that uniquely identifies views
> /// across updates based on the identity of the underlying data element.
> ///
> /// All generated disclosure groups begin in the collapsed state.
> ///
> /// Make sure that the identifier of a data element only changes if you
> /// mean to replace that element with a new element, one with a new
> /// identity. If the ID of an element changes, then the content view
> /// generated from that element will lose any current state and animations.
9908,9915c9488,9498
< /// - nsViewController: Your custom view controller object.
< /// - coordinator: The custom coordinator instance you use to communicate
< /// changes back to SwiftUI. If you do not use a custom coordinator, the
< /// system provides a default instance.
< static func dismantleNSViewController(_ nsViewController: Self.NSViewControllerType, coordinator: Self.Coordinator)
<
< /// A type to coordinate with the view controller.
< associatedtype Coordinator = Void
---
> /// - root: The root of a collection of tree-structured, identified
> /// data.
> /// - children: A key path to a property whose non-`nil` value gives the
> /// children of `data`. A non-`nil` but empty value denotes an element
> /// capable of having children that's currently childless, such as an
> /// empty directory in a file system. On the other hand, if the property
> /// at the key path is `nil`, then the outline group treats `data` as a
> /// leaf in the tree, like a regular file in a file system.
> /// - content: A view builder that produces a content view based on an
> /// element in `data`.
> public init<DataElement>(_ root: DataElement, children: KeyPath<DataElement, Data?>, @ViewBuilder content: @escaping (DataElement) -> Leaf) where ID == DataElement.ID, DataElement : Identifiable, DataElement == Data.Element
9917,9918c9500,9501
< /// Creates the custom object that you use to communicate changes from your
< /// view controller to other parts of your SwiftUI interface.
---
> /// Creates an outline group from a collection of root data elements and
> /// a key path to its children.
9920,9926c9503,9504
< /// Implement this method if changes to your view controller might affect
< /// other parts of your app. In your implementation, create a custom Swift
< /// instance that can communicate with other parts of your interface. For
< /// example, you might provide an instance that binds its variables to
< /// SwiftUI properties, causing the two to remain synchronized. If your view
< /// controller doesn't interact with other parts of your app, providing a
< /// coordinator is unnecessary.
---
> /// This initializer creates an instance that uniquely identifies views
> /// across updates based on the identity of the underlying data element.
9928,9935c9506,9523
< /// SwiftUI calls this method before calling the
< /// ``NSViewControllerRepresentable/makeNSViewController(context:)`` method.
< /// The system provides your coordinator instance either directly or as part
< /// of a context structure when calling the other methods of your
< /// representable instance.
< func makeCoordinator() -> Self.Coordinator
<
< typealias Context = NSViewControllerRepresentableContext<Self>
---
> /// All generated disclosure groups begin in the collapsed state.
> ///
> /// Make sure that the identifier of a data element only changes if you
> /// mean to replace that element with a new element, one with a new
> /// identity. If the ID of an element changes, then the content view
> /// generated from that element will lose any current state and animations.
> ///
> /// - Parameters:
> /// - data: A collection of tree-structured, identified data.
> /// - children: A key path to a property whose non-`nil` value gives the
> /// children of `data`. A non-`nil` but empty value denotes an element
> /// capable of having children that's currently childless, such as an
> /// empty directory in a file system. On the other hand, if the property
> /// at the key path is `nil`, then the outline group treats `data` as a
> /// leaf in the tree, like a regular file in a file system.
> /// - content: A view builder that produces a content view based on an
> /// element in `data`.
> public init<DataElement>(_ data: Data, children: KeyPath<DataElement, Data?>, @ViewBuilder content: @escaping (DataElement) -> Leaf) where ID == DataElement.ID, DataElement : Identifiable, DataElement == Data.Element
9938,9939c9526
< @available(OSX 10.15, *)
< @available(iOS, unavailable)
---
> @available(iOS 14.0, OSX 10.16, *)
9942c9529
< extension NSViewControllerRepresentable where Self.Coordinator == Void {
---
> extension OutlineGroup where Parent : View, Parent == Leaf, Subgroup == DisclosureGroup<Parent, OutlineSubgroupChildren> {
9944c9531,9532
< /// Creates an object to coordinate with the AppKit view controller.
---
> /// Creates an outline group from a root data element, the key path to its
> /// identifier, and a key path to its children.
9946,9947c9534,9582
< /// `Coordinator` can be accessed via `Context`.
< public func makeCoordinator() -> Self.Coordinator
---
> /// This initializer creates an instance that uniquely identifies views
> /// across updates based on the identity of the underlying data element.
> ///
> /// All generated disclosure groups begin in the collapsed state.
> ///
> /// Make sure that the identifier of a data element only changes if you
> /// mean to replace that element with a new element, one with a new
> /// identity. If the ID of an element changes, then the content view
> /// generated from that element will lose any current state and animations.
> ///
> /// - Parameters:
> /// - root: The root of a collection of tree-structured, identified
> /// data.
> /// - id: The key path to a data element's identifier.
> /// - children: A key path to a property whose non-`nil` value gives the
> /// children of `data`. A non-`nil` but empty value denotes an element
> /// capable of having children that's currently childless, such as an
> /// empty directory in a file system. On the other hand, if the property
> /// at the key path is `nil`, then the outline group treats `data` as a
> /// leaf in the tree, like a regular file in a file system.
> /// - content: A view builder that produces a content view based on an
> /// element in `data`.
> public init<DataElement>(_ root: DataElement, id: KeyPath<DataElement, ID>, children: KeyPath<DataElement, Data?>, @ViewBuilder content: @escaping (DataElement) -> Leaf) where DataElement == Data.Element
>
> /// Creates an outline group from a collection of root data elements, the
> /// key path to a data element's identifier, and a key path to its children.
> ///
> /// This initializer creates an instance that uniquely identifies views
> /// across updates based on the identity of the underlying data element.
> ///
> /// All generated disclosure groups begin in the collapsed state.
> ///
> /// Make sure that the identifier of a data element only changes if you
> /// mean to replace that element with a new element, one with a new
> /// identity. If the ID of an element changes, then the content view
> /// generated from that element will lose any current state and animations.
> ///
> /// - Parameters:
> /// - data: A collection of tree-structured, identified data.
> /// - id: The key path to a data element's identifier.
> /// - children: A key path to a property whose non-`nil` value gives the
> /// children of `data`. A non-`nil` but empty value denotes an element
> /// capable of having children that's currently childless, such as an
> /// empty directory in a file system. On the other hand, if the property
> /// at the key path is `nil`, then the outline group treats `data` as a
> /// leaf in the tree, like a regular file in a file system.
> /// - content: A view builder that produces a content view based on an
> /// element in `data`.
> public init<DataElement>(_ data: Data, id: KeyPath<DataElement, ID>, children: KeyPath<DataElement, Data?>, @ViewBuilder content: @escaping (DataElement) -> Leaf) where DataElement == Data.Element
9950,9951c9585
< @available(OSX 10.15, *)
< @available(iOS, unavailable)
---
> @available(iOS 14.0, OSX 10.16, *)
9954c9588
< extension NSViewControllerRepresentable {
---
> extension OutlineGroup : View where Parent : View, Leaf : View, Subgroup : View {
9956,9958c9590,9591
< /// Cleans up the presented `NSViewController` (and coordinator) in
< /// anticipation of their removal.
< public static func dismantleNSViewController(_ nsViewController: Self.NSViewControllerType, coordinator: Self.Coordinator)
---
> /// The content and behavior of the view.
> public var body: some View { get }
9960,9961c9593,9597
< /// Declares the content and behavior of this view.
< public var body: Never { get }
---
> /// The type of view representing the body of this view.
> ///
> /// When you create a custom view, Swift infers this type from your
> /// implementation of the required `body` property.
> public typealias Body = some View
9964,9965c9600
< /// Contextual information about the state of the system that you use to create
< /// and update your AppKit view controller.
---
> /// A type-erased view representing the children in an outline subgroup.
9967,9976c9602,9604
< /// An ``NSViewControllerRepresentableContext`` structure contains details about
< /// the current state of the system. When creating and updating your view
< /// controller, the system creates one of these structures and passes it to the
< /// appropriate method of your custom ``NSViewControllerRepresentable``
< /// instance. Use the information in this structure to configure your view
< /// controller. For example, use the provided environment values to configure
< /// the appearance of your view controller and views. Don't create this
< /// structure yourself.
< @available(OSX 10.15, *)
< @available(iOS, unavailable)
---
> /// ``OutlineGroup`` uses this type as a generic constraint for the `Content`
> /// of the ``DisclosureGroup`` instances it creates.
> @available(iOS 14.0, OSX 10.16, *)
9979c9607
< public struct NSViewControllerRepresentableContext<ViewController> where ViewController : NSViewControllerRepresentable {
---
> public struct OutlineSubgroupChildren : View {
9981,9998c9609
< /// An object you use to communicate your AppKit view controller's behavior
< /// and state out to SwiftUI objects.
< ///
< /// The coordinator is a custom object you define. When updating your view
< /// controller, communicate changes to SwiftUI by updating the properties of
< /// your coordinator, or by calling relevant methods to make those changes.
< /// The implementation of those properties and methods are responsible for
< /// updating the appropriate SwiftUI values. For example, you might define a
< /// property in your coordinator that binds to a SwiftUI value, as shown in
< /// the following code example. Changing the property updates the value of
< /// the corresponding SwiftUI variable.
< ///
< /// class Coordinator: NSObject {
< /// @Binding var rating: Int
< /// init(rating: Binding<Int>) {
< /// $rating = rating
< /// }
< /// }
---
> /// The type of view representing the body of this view.
10000,10012c9611,9613
< /// To create and configure your custom coordinator, implement the
< /// ``NSViewControllerRepresentable/makeCoordinator()-1enxe`` method of your
< /// ``NSViewControllerRepresentable`` object.
< public let coordinator: ViewController.Coordinator
<
< /// The current transaction.
< public var transaction: Transaction { get }
<
< /// Environment data that describes the current state of the system.
< ///
< /// Use the environment values to configure the state of your view
< /// controller when creating or updating it.
< public var environment: EnvironmentValues { get }
---
> /// When you create a custom view, Swift infers this type from your
> /// implementation of the required `body` property.
> public typealias Body = Never
10015,10051c9616,9618
< /// A wrapper that you use to integrate an AppKit view into your SwiftUI view
< /// hierarchy.
< ///
< /// Use an `NSViewRepresentable` instance to create and manage an
< /// <doc://com.apple.documentation/documentation/AppKit/NSView> object in your SwiftUI
< /// interface. Adopt this protocol in one of your app's custom instances, and
< /// use its methods to create, update, and tear down your view. The creation and
< /// update processes parallel the behavior of SwiftUI views, and you use them to
< /// configure your view with your app's current state information. Use the
< /// teardown process to remove your view cleanly from your SwiftUI. For example,
< /// you might use the teardown process to notify other objects that the view is
< /// disappearing.
< ///
< /// To add your view into your SwiftUI interface, create your
< /// ``NSViewRepresentable`` instance and add it to your SwiftUI interface. The
< /// system calls the methods of your representable instance at appropriate times
< /// to create and update the view. The following example shows the inclusion of
< /// a custom `MyRepresentedCustomView` struct in the view hierarchy.
< ///
< /// struct ContentView: View {
< /// var body: some View {
< /// VStack {
< /// Text("Global Sales")
< /// MyRepresentedCustomView()
< /// }
< /// }
< /// }
< ///
< /// The system doesn't automatically communicate changes occurring within your
< /// view controller to other parts of your SwiftUI interface. When you want your
< /// view controller to coordinate with other SwiftUI views, you must provide a
< /// ``NSViewControllerRepresentable/Coordinator`` object to facilitate those
< /// interactions. For example, you use a coordinator to forward target-action
< /// and delegate messages from your view controller to any SwiftUI views.
< @available(OSX 10.15, *)
< @available(iOS, unavailable)
< @available(tvOS, unavailable)
---
> /// An index view style that places a page index view over its content.
> @available(iOS 14.0, tvOS 14.0, *)
> @available(OSX, unavailable)
10053c9620
< public protocol NSViewRepresentable : View where Self.Body == Never {
---
> public struct PageIndexViewStyle : IndexViewStyle {
10055,10056c9622,9636
< /// The type of view to present.
< associatedtype NSViewType : NSView
---
> /// The background style for the page index view.
> public struct BackgroundDisplayMode {
>
> /// Background will use the default for the platform.
> public static let automatic: PageIndexViewStyle.BackgroundDisplayMode
>
> /// Background is only shown while the index view is interacted with.
> public static let interactive: PageIndexViewStyle.BackgroundDisplayMode
>
> /// Background is always displayed behind the page index view.
> public static let always: PageIndexViewStyle.BackgroundDisplayMode
>
> /// Background is never displayed behind the page index view.
> public static let never: PageIndexViewStyle.BackgroundDisplayMode
> }
10058,10068c9638
< /// Creates the view object and configures its initial state.
< ///
< /// You must implement this method and use it to create your view object.
< /// Configure the view using your app's current data and contents of the
< /// `context` parameter. The system calls this method only once, when it
< /// creates your view for the first time. For all subsequent updates, the
< /// system calls the ``NSViewRepresentable/updateNSView(_:context:)``
< /// method.
< ///
< /// - Parameter context: A context structure containing information about
< /// the current state of the system.
---
> /// Creates a page index view style.
10070,10071c9640,9648
< /// - Returns: Your AppKit view configured with the provided information.
< func makeNSView(context: Self.Context) -> Self.NSViewType
---
> /// - Parameter backgroundDisplayMode: The display mode of the background of any
> /// page index views receiving this style
> public init(backgroundDisplayMode: PageIndexViewStyle.BackgroundDisplayMode = .automatic)
> }
>
> /// A `TabViewStyle` that implements a paged scrolling `TabView`.
> @available(iOS 14.0, tvOS 14.0, watchOS 7.0, *)
> @available(OSX, unavailable)
> public struct PageTabViewStyle : TabViewStyle {
10073,10086c9650,9663
< /// Updates the state of the specified view with new information from
< /// SwiftUI.
< ///
< /// When the state of your app changes, SwiftUI updates the portions of your
< /// interface affected by those changes. SwiftUI calls this method for any
< /// changes affecting the corresponding AppKit view. Use this method to
< /// update the configuration of your view to match the new state information
< /// provided in the `context` parameter.
< ///
< /// - Parameters:
< /// - nsView: Your custom view object.
< /// - context: A context structure containing information about the current
< /// state of the system.
< func updateNSView(_ nsView: Self.NSViewType, context: Self.Context)
---
> /// A style for displaying the page index view
> public struct IndexDisplayMode {
>
> /// Displays an index view when there are more than one page
> public static let automatic: PageTabViewStyle.IndexDisplayMode
>
> /// Always display an index view regardless of page count
> @available(watchOS, unavailable)
> public static let always: PageTabViewStyle.IndexDisplayMode
>
> /// Never display an index view
> @available(watchOS, unavailable)
> public static let never: PageTabViewStyle.IndexDisplayMode
> }
10088,10100c9665,9671
< /// Cleans up the presented AppKit view (and coordinator) in anticipation of
< /// their removal.
< ///
< /// Use this method to perform additional clean-up work related to your
< /// custom view. For example, you might use this method to remove observers
< /// or update other parts of your SwiftUI interface.
< ///
< /// - Parameters:
< /// - nsView: Your custom view object.
< /// - coordinator: The custom coordinator you use to communicate changes
< /// back to SwiftUI. If you do not use a custom coordinator instance, the
< /// system provides a default instance.
< static func dismantleNSView(_ nsView: Self.NSViewType, coordinator: Self.Coordinator)
---
> /// Creates a new `PageTabViewStyle` with an index display mode
> public init(indexDisplayMode: PageTabViewStyle.IndexDisplayMode = .automatic)
> }
>
> /// The outline of a 2D shape.
> @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
> @frozen public struct Path : Equatable, LosslessStringConvertible {
10102,10103c9673,9674
< /// A type to coordinate with the view.
< associatedtype Coordinator = Void
---
> /// Creates an empty path.
> public init()
10105,10120c9676,9677
< /// Creates the custom instance that you use to communicate changes from
< /// your view to other parts of your SwiftUI interface.
< ///
< /// Implement this method if changes to your view might affect other parts
< /// of your app. In your implementation, create a custom Swift instance that
< /// can communicate with other parts of your interface. For example, you
< /// might provide an instance that binds its variables to SwiftUI
< /// properties, causing the two to remain synchronized. If your view doesn't
< /// interact with other parts of your app, you don't have to provide a
< /// coordinator.
< ///
< /// SwiftUI calls this method before calling the
< /// ``NSViewRepresentable/makeNSView(context:)`` method. The system provides
< /// your coordinator instance either directly or as part of a context
< /// structure when calling the other methods of your representable instance.
< func makeCoordinator() -> Self.Coordinator
---
> /// Creates a path from an immutable shape path.
> public init(_ path: CGPath)
10122,10129c9679,9680
< typealias Context = NSViewRepresentableContext<Self>
< }
<
< @available(OSX 10.15, *)
< @available(iOS, unavailable)
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
< extension NSViewRepresentable where Self.Coordinator == Void {
---
> /// Creates a path from a copy of a mutable shape path.
> public init(_ path: CGMutablePath)
10131,10141c9682,9683
< /// Creates a `Coordinator` instance to coordinate with the `NSView`.
< ///
< /// `Coordinator` can be accessed via `Context`.
< public func makeCoordinator() -> Self.Coordinator
< }
<
< @available(OSX 10.15, *)
< @available(iOS, unavailable)
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
< extension NSViewRepresentable {
---
> /// Creates a path as the given rectangle.
> public init(_ rect: CGRect)
10143,10145c9685,9686
< /// Cleans up the presented AppKit view (and coordinator) in anticipation of
< /// their removal.
< public static func dismantleNSView(_ nsView: Self.NSViewType, coordinator: Self.Coordinator)
---
> /// Creates a path as the given rounded rectangle.
> public init(roundedRect rect: CGRect, cornerSize: CGSize, style: RoundedCornerStyle = .circular)
10147,10165c9688,9689
< /// Declares the content and behavior of this view.
< public var body: Never { get }
< }
<
< /// Contextual information about the state of the system that you use to create
< /// and update your AppKit view.
< ///
< /// An ``NSViewRepresentableContext`` structure contains details about the
< /// current state of the system. When creating and updating your view, the
< /// system creates one of these structures and passes it to the appropriate
< /// method of your custom ``NSViewRepresentable`` instance. Use the information
< /// in this structure to configure your view. For example, use the provided
< /// environment values to configure the appearance of your view. Don't create
< /// this structure yourself.
< @available(OSX 10.15, *)
< @available(iOS, unavailable)
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
< public struct NSViewRepresentableContext<View> where View : NSViewRepresentable {
---
> /// Creates a path as the given rounded rectangle.
> public init(roundedRect rect: CGRect, cornerRadius: CGFloat, style: RoundedCornerStyle = .circular)
10167,10189c9691,9692
< /// An instance you use to communicate your AppKit view's behavior and state
< /// out to SwiftUI objects.
< ///
< /// The coordinator is a custom instance you define. When updating your
< /// view, communicate changes to SwiftUI by updating the properties of your
< /// coordinator, or by calling relevant methods to make those changes. The
< /// implementation of those properties and methods are responsible for
< /// updating the appropriate SwiftUI values. For example, you might define a
< /// property in your coordinator that binds to a SwiftUI value, as shown in
< /// the following code example. Changing the property updates the value of
< /// the corresponding SwiftUI variable.
< ///
< /// class Coordinator: NSObject {
< /// @Binding var rating: Int
< /// init(rating: Binding<Int>) {
< /// $rating = rating
< /// }
< /// }
< ///
< /// To create and configure your custom coordinator, implement the
< /// ``NSViewControllerRepresentable/makeCoordinator()-1enxe`` method of your
< /// ``NSViewControllerRepresentable`` object.
< public let coordinator: View.Coordinator
---
> /// Creates a path as an ellipse inscribed within the given rectangle.
> public init(ellipseIn rect: CGRect)
10191,10192c9694,9696
< /// The current transaction.
< public var transaction: Transaction { get }
---
> /// Creates an empty path, and then executes the closure to add the initial
> /// elements.
> public init(_ callback: (inout Path) -> ())
10194,10205c9698,9701
< /// Environment data that describes the current state of the system.
< ///
< /// Use the environment values to configure the state of your view when
< /// creating or updating it.
< public var environment: EnvironmentValues { get }
< }
<
< /// A dynamic property type that allows access to a namespace defined
< /// by the persistent identity of the object containing the property
< /// (e.g. a view).
< @available(iOS 14.0, OSX 10.16, tvOS 14.0, watchOS 7.0, *)
< @frozen @propertyWrapper public struct Namespace : DynamicProperty {
---
> /// Initializes from the result of a previous call to
> /// `Path.stringRepresentation`. Fails if the `string` does not
> /// describe a valid path.
> public init?(_ string: String)
10207c9703,9705
< @inlinable public init()
---
> /// A description of the path that may be used to recreate the path
> /// via `init?(_:)`.
> public var description: String { get }
10209c9707,9708
< public var wrappedValue: Namespace.ID { get }
---
> /// An immutable path representing the elements in the path.
> public var cgPath: CGPath { get }
10211,10213c9710,9749
< /// A namespace defined by the persistent identity of an
< /// `@Namespace` dynamic property.
< @frozen public struct ID : Hashable {
---
> /// A Boolean value indicating whether the path contains zero elements.
> public var isEmpty: Bool { get }
>
> /// A rectangle containing all path segments.
> public var boundingRect: CGRect { get }
>
> /// Returns true if the path contains a specified point.
> ///
> /// If `eoFill` is true, this method uses the even-odd rule to define which
> /// points are inside the path. Otherwise, it uses the non-zero rule.
> public func contains(_ p: CGPoint, eoFill: Bool = false) -> Bool
>
> /// An element of a path.
> @frozen public enum Element : Equatable {
>
> /// A path element that terminates the current subpath (without closing
> /// it) and defines a new current point.
> case move(to: CGPoint)
>
> /// A line from the previous current point to the given point, which
> /// becomes the new current point.
> case line(to: CGPoint)
>
> /// A quadratic Bézier curve from the previous current point to the
> /// given end-point, using the single control point to define the curve.
> ///
> /// The end-point of the curve becomes the new current point.
> case quadCurve(to: CGPoint, control: CGPoint)
>
> /// A cubic Bézier curve from the previous current point to the given
> /// end-point, using the two control points to define the curve.
> ///
> /// The end-point of the curve becomes the new current point.
> case curve(to: CGPoint, control1: CGPoint, control2: CGPoint)
>
> /// A line from the start point of the current subpath (if any) to the
> /// current point, which terminates the subpath.
> ///
> /// After closing the subpath, the current point becomes undefined.
> case closeSubpath
10223,10247c9759
< public static func == (a: Namespace.ID, b: Namespace.ID) -> Bool
<
< /// The hash value.
< ///
< /// Hash values are not guaranteed to be equal across different executions of
< /// your program. Do not save hash values to use during a future execution.
< ///
< /// - Important: `hashValue` is deprecated as a `Hashable` requirement. To
< /// conform to `Hashable`, implement the `hash(into:)` requirement instead.
< public var hashValue: Int { get }
<
< /// Hashes the essential components of this value by feeding them into the
< /// given hasher.
< ///
< /// Implement this method to conform to the `Hashable` protocol. The
< /// components used for hashing must be the same as the components compared
< /// in your type's `==` operator implementation. Call `hasher.combine(_:)`
< /// with each of these components.
< ///
< /// - Important: Never call `finalize()` on `hasher`. Doing so may become a
< /// compile-time error in the future.
< ///
< /// - Parameter hasher: The hasher to use when combining the components
< /// of this instance.
< public func hash(into hasher: inout Hasher)
---
> public static func == (a: Path.Element, b: Path.Element) -> Bool
10249,10259d9760
< }
<
< /// A view that controls a navigation presentation.
< @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
< public struct NavigationLink<Label, Destination> : View where Label : View, Destination : View {
<
< /// Creates an instance that presents `destination`.
< public init(destination: Destination, @ViewBuilder label: () -> Label)
<
< /// Creates an instance that presents `destination` when active.
< public init(destination: Destination, isActive: Binding<Bool>, @ViewBuilder label: () -> Label)
10261,10263c9762,9763
< /// Creates an instance that presents `destination` when `selection` is set
< /// to `tag`.
< public init<V>(destination: Destination, tag: V, selection: Binding<V?>, @ViewBuilder label: () -> Label) where V : Hashable
---
> /// Calls `body` with each element in the path.
> public func forEach(_ body: (Path.Element) -> Void)
10265,10266c9765,9767
< /// The content and behavior of the view.
< public var body: some View { get }
---
> /// Returns a stroked copy of the path using `style` to define how the
> /// stroked outline is created.
> public func strokedPath(_ style: StrokeStyle) -> Path
10268c9769,9800
< /// The type of view representing the body of this view.
---
> /// Returns a partial copy of the path.
> ///
> /// The returned path contains the region between `from` and `to`, both of
> /// which must be fractions between zero and one defining points
> /// linearly-interpolated along the path.
> public func trimmedPath(from: CGFloat, to: CGFloat) -> Path
>
> /// Returns a Boolean value indicating whether two values are equal.
> ///
> /// Equality is the inverse of inequality. For any values `a` and `b`,
> /// `a == b` implies that `a != b` is `false`.
> ///
> /// - Parameters:
> /// - lhs: A value to compare.
> /// - rhs: Another value to compare.
> public static func == (a: Path, b: Path) -> Bool
> }
>
> @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
> extension Path : Shape {
>
> /// Describes this shape as a path within a rectangular frame of reference.
> ///
> /// - Parameter rect: The frame of reference for describing this shape.
> ///
> /// - Returns: A path that describes this shape.
> public func path(in _: CGRect) -> Path
>
> /// The type defining the data to animate.
> public typealias AnimatableData = EmptyAnimatableData
>
> /// The type of view representing the body of this view.
10272c9804
< public typealias Body = some View
---
> public typealias Body
10276c9808
< extension NavigationLink where Label == Text {
---
> extension Path {
10278,10280c9810,9811
< /// Creates an instance that presents `destination`, with a `Text` label
< /// generated from a title string.
< public init(_ titleKey: LocalizedStringKey, destination: Destination)
---
> /// Begins a new subpath at the specified point.
> public mutating func move(to p: CGPoint)
10282,10284c9813,9815
< /// Creates an instance that presents `destination`, with a `Text` label
< /// generated from a title string.
< public init<S>(_ title: S, destination: Destination) where S : StringProtocol
---
> /// Appends a straight line segment from the current point to the specified
> /// point.
> public mutating func addLine(to p: CGPoint)
10286,10288c9817,9819
< /// Creates an instance that presents `destination` when active, with a
< /// `Text` label generated from a title string.
< public init(_ titleKey: LocalizedStringKey, destination: Destination, isActive: Binding<Bool>)
---
> /// Adds a quadratic Bézier curve to the path, with the specified end point
> /// and control point.
> public mutating func addQuadCurve(to p: CGPoint, control cp: CGPoint)
10290,10292c9821,9823
< /// Creates an instance that presents `destination` when active, with a
< /// `Text` label generated from a title string.
< public init<S>(_ title: S, destination: Destination, isActive: Binding<Bool>) where S : StringProtocol
---
> /// Adds a cubic Bézier curve to the path, with the specified end point and
> /// control points.
> public mutating func addCurve(to p: CGPoint, control1 cp1: CGPoint, control2 cp2: CGPoint)
10294,10296c9825,9826
< /// Creates an instance that presents `destination` when `selection` is set
< /// to `tag`, with a `Text` label generated from a title string.
< public init<V>(_ titleKey: LocalizedStringKey, destination: Destination, tag: V, selection: Binding<V?>) where V : Hashable
---
> /// Closes and completes the current subpath.
> public mutating func closeSubpath()
10298,10300c9828,9866
< /// Creates an instance that presents `destination` when `selection` is set
< /// to `tag`, with a `Text` label generated from a title string.
< public init<S, V>(_ title: S, destination: Destination, tag: V, selection: Binding<V?>) where S : StringProtocol, V : Hashable
---
> /// Adds a rectangular subpath to the path.
> public mutating func addRect(_ rect: CGRect, transform: CGAffineTransform = .identity)
>
> /// Adds a rounded rectangle to the path.
> public mutating func addRoundedRect(in rect: CGRect, cornerSize: CGSize, style: RoundedCornerStyle = .circular, transform: CGAffineTransform = .identity)
>
> /// Adds an ellipse to the path.
> public mutating func addEllipse(in rect: CGRect, transform: CGAffineTransform = .identity)
>
> /// Adds a sequence of rectangular subpaths to the path.
> public mutating func addRects(_ rects: [CGRect], transform: CGAffineTransform = .identity)
>
> /// Adds a sequence of connected straight-line segments to the path.
> public mutating func addLines(_ lines: [CGPoint])
>
> /// Adds an arc of a circle to the path, specified with a radius and a
> /// difference in angle.
> public mutating func addRelativeArc(center: CGPoint, radius: CGFloat, startAngle: Angle, delta: Angle, transform: CGAffineTransform = .identity)
>
> /// Adds an arc of a circle to the path, specified with a radius and angles.
> public mutating func addArc(center: CGPoint, radius: CGFloat, startAngle: Angle, endAngle: Angle, clockwise: Bool, transform: CGAffineTransform = .identity)
>
> /// Adds an arc of a circle to the path, specified with a radius and two
> /// tangent lines.
> public mutating func addArc(tangent1End p1: CGPoint, tangent2End p2: CGPoint, radius: CGFloat, transform: CGAffineTransform = .identity)
>
> /// Appends a copy of the given path to this path.
> public mutating func addPath(_ path: Path, transform: CGAffineTransform = .identity)
>
> /// Returns the last point in the path, or nil if the path contains
> /// no points.
> public var currentPoint: CGPoint? { get }
>
> /// Returns a path constructed by applying the transform to all points of
> /// the path.
> public func applying(_ transform: CGAffineTransform) -> Path
>
> /// Returns a path constructed by translating `self` by `(dx, dy)`.
> public func offsetBy(dx: CGFloat, dy: CGFloat) -> Path
10303,10306c9869,9871
< /// A view for presenting a stack of views representing a visible path in a
< /// navigation hierarchy.
< @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 7.0, *)
< public struct NavigationView<Content> : View where Content : View {
---
> /// A control for selecting from a set of mutually exclusive values.
> @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
> public struct Picker<Label, SelectionValue, Content> : View where Label : View, SelectionValue : Hashable, Content : View {
10308c9873,9878
< public init(@ViewBuilder content: () -> Content)
---
> /// Creates an instance that selects from content associated with
> /// `Selection` values.
> public init(selection: Binding<SelectionValue>, label: Label, @ViewBuilder content: () -> Content)
>
> /// The content and behavior of the view.
> public var body: some View { get }
10314c9884
< public typealias Body = Never
---
> public typealias Body = some View
10317,10319c9887,9896
< /// A specification for the appearance and interaction of a `NavigationView`.
< @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 7.0, *)
< public protocol NavigationViewStyle {
---
> @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
> extension Picker where Label == Text {
>
> /// Creates an instance that selects from content associated with
> /// `Selection` values.
> public init(_ titleKey: LocalizedStringKey, selection: Binding<SelectionValue>, @ViewBuilder content: () -> Content)
>
> /// Creates an instance that selects from content associated with
> /// `Selection` values.
> public init<S>(_ title: S, selection: Binding<SelectionValue>, @ViewBuilder content: () -> Content) where S : StringProtocol
10322,10323c9899
< /// A property wrapper type that subscribes to an observable object and
< /// invalidates a view whenever the observable object changes.
---
> /// A custom specification for the appearance and interaction of a `Picker`.
10325,10337c9901,9906
< @propertyWrapper @frozen public struct ObservedObject<ObjectType> : DynamicProperty where ObjectType : ObservableObject {
<
< /// A wrapper of the underlying observable object that can create bindings to
< /// its properties using dynamic member lookup.
< @dynamicMemberLookup @frozen public struct Wrapper {
<
< /// Returns a binding to the resulting value of a given key path.
< ///
< /// - Parameter keyPath : A key path to a specific resulting value.
< ///
< /// - Returns: A new binding.
< public subscript<Subject>(dynamicMember keyPath: ReferenceWritableKeyPath<ObjectType, Subject>) -> Binding<Subject> { get }
< }
---
> public protocol PickerStyle {
> }
>
> /// A set of view types that may be pinned to the bounds of a scroll view.
> @available(iOS 14.0, OSX 10.16, tvOS 14.0, watchOS 7.0, *)
> public struct PinnedScrollableViews : OptionSet {
10339c9908
< /// Creates an observed object with an initial value.
---
> /// The corresponding value of the raw type.
10341,10344c9910,9911
< /// - Parameter initialValue: An initial value.
< public init(initialValue: ObjectType)
<
< /// Creates an observed object with an initial wrapped value.
---
> /// A new instance initialized with `rawValue` will be equivalent to this
> /// instance. For example:
10346,10347c9913,9915
< /// You don't call this initializer directly. Instead, declare a property
< /// with the `@ObservedObject` attribute, and provide an initial value.
---
> /// enum PaperSize: String {
> /// case A4, A5, Letter, Legal
> /// }
10349,10350c9917,9923
< /// - Parameter wrappedValue: An initial value.
< public init(wrappedValue: ObjectType)
---
> /// let selectedSize = PaperSize.Letter
> /// print(selectedSize.rawValue)
> /// // Prints "Letter"
> ///
> /// print(selectedSize == PaperSize(rawValue: selectedSize.rawValue)!)
> /// // Prints "true"
> public let rawValue: UInt32
10352c9925
< /// The underlying value referenced by the observed object.
---
> /// Creates a new option set from the given raw value.
10354,10356c9927,9931
< /// This property provides primary access to the value's data. However, you
< /// don't access `wrappedValue` directly. Instead, you use the property
< /// variable created with the `@ObservedObject` attribute.
---
> /// This initializer always succeeds, even if the value passed as `rawValue`
> /// exceeds the static properties declared as part of the option set. This
> /// example creates an instance of `ShippingOptions` with a raw value beyond
> /// the highest element, with a bit mask that effectively contains all the
> /// declared static members.
10358,10364c9933,9935
< /// When a mutable value changes, the new value is immediately available.
< /// However, a view displaying the value is updated asynchronously and may
< /// not show the new value immediately.
< public var wrappedValue: ObjectType
<
< /// A projection of the observed object that creates bindings to its
< /// properties using dynamic member lookup.
---
> /// let extraOptions = ShippingOptions(rawValue: 255)
> /// print(extraOptions.isStrictSuperset(of: .all))
> /// // Prints "true"
10366,10375c9937,9941
< /// Use the projected value to pass a binding value down a view hierarchy.
< /// To get the `projectedValue`, prefix the property variable with `$`.
< public var projectedValue: ObservedObject<ObjectType>.Wrapper { get }
< }
<
< /// A shape with a translation offset transform applied to it.
< @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
< @frozen public struct OffsetShape<Content> : Shape where Content : Shape {
<
< public var shape: Content
---
> /// - Parameter rawValue: The raw value of the option set to create. Each bit
> /// of `rawValue` potentially represents an element of the option set,
> /// though raw values may include bits that are not defined as distinct
> /// values of the `OptionSet` type.
> public init(rawValue: UInt32)
10377c9943,9944
< public var offset: CGSize
---
> /// The header view of each `Section` will be pinned.
> public static let sectionHeaders: PinnedScrollableViews
10379c9946,9947
< @inlinable public init(shape: Content, offset: CGSize)
---
> /// The footer view of each `Section` will be pinned.
> public static let sectionFooters: PinnedScrollableViews
10381,10383c9949
< /// Describes this shape as a path within a rectangular frame of reference.
< ///
< /// - Parameter rect: The frame of reference for describing this shape.
---
> /// The element type of the option set.
10385,10389c9951,9953
< /// - Returns: A path that describes this shape.
< public func path(in rect: CGRect) -> Path
<
< /// The type defining the data to animate.
< public typealias AnimatableData = AnimatablePair<Content.AnimatableData, CGSize.AnimatableData>
---
> /// To inherit all the default implementations from the `OptionSet` protocol,
> /// the `Element` type must be `Self`, the default.
> public typealias Element = PinnedScrollableViews
10391,10392c9955,9956
< /// The data to animate.
< public var animatableData: OffsetShape<Content>.AnimatableData
---
> /// The type of the elements of an array literal.
> public typealias ArrayLiteralElement = PinnedScrollableViews
10394c9958,9959
< /// The type of view representing the body of this view.
---
> /// The raw type that can be used to represent all values of the conforming
> /// type.
10396,10398c9961,9964
< /// When you create a custom view, Swift infers this type from your
< /// implementation of the required `body` property.
< public typealias Body
---
> /// Every distinct value of the conforming type has a corresponding unique
> /// value of the `RawValue` type, but there may be values of the `RawValue`
> /// type that don't have a corresponding value of the conforming type.
> public typealias RawValue = UInt32
10400a9967,9972
> /// A button style that doesn't style or decorate its content while idle, but
> /// may apply a visual effect to indicate the pressed, focused, or enabled state
> /// of the button.
> ///
> /// To apply this style to a button, or to a view that contains buttons, use the
> /// ``View/buttonStyle(_:)`` modifier.
10402,11078c9974
< extension OffsetShape : InsettableShape where Content : InsettableShape {
<
< /// Returns `self` inset by `amount`.
< @inlinable public func inset(by amount: CGFloat) -> OffsetShape<Content.InsetShape>
<
< /// The type of the inset shape.
< public typealias InsetShape = OffsetShape<Content.InsetShape>
< }
<
< /// Provides functionality for opening a URL.
< ///
< /// An `OpenURLAction` should be obtained from the environment, and can be used
< /// to open a URL as the result of some user action.
< ///
< /// struct SupportView : View {
< /// @Environment(\.openURL) var openURL
< ///
< /// var body: some View {
< /// Button(action: contactSupport) {
< /// Text("Email Support")
< /// Image(systemName: "envelope.open")
< /// }
< /// }
< ///
< /// func contactSupport() {
< /// openURL(mailToSupport)
< /// }
< /// }
< @available(iOS 14.0, OSX 10.16, tvOS 14.0, watchOS 7.0, *)
< public struct OpenURLAction {
<
< /// Requests that a URL be opened, following system conventions.
< ///
< /// - Parameters:
< /// - url: A URL to be opened by the system.
< public func callAsFunction(_ url: URL)
<
< /// Requests that a URL be opened, following system conventions.
< ///
< /// When this method is called the URL will be asynchronously opened, and a
< /// result returned indicating whether the system could handle the URL. The
< /// completion runs after the system has decided whether it can handle the
< /// URL. Actual handling may not yet be complete when the completion
< /// is called.
< ///
< /// - Parameters:
< /// - url: A URL to be opened by the system.
< /// - completion: Invoked with whether the URL could be opened.
< /// - accepted: Indicating whether or not the system will process the
< /// request. If the value is `false`, then the system has refused the
< /// request and the app should respond appropriately. For example, the app
< /// could alert the user or attempt to open a fallback URL.
< @available(watchOS, unavailable)
< public func callAsFunction(_ url: URL, completion: @escaping (Bool) -> Void)
< }
<
< /// A structure that computes views and disclosure groups on demand from an
< /// underlying collection of tree-structured, identified data.
< ///
< /// Use an outline group when you need a view that can represent a hierarchy
< /// of data by using disclosure views. This allows the user to navigate the
< /// tree structure by using the disclosure views to expand and collapse
< /// branches.
< ///
< /// In the following example, a tree structure of `FileItem` data offers a
< /// simplified view of a file system. Passing the root of this tree and the
< /// key path of its children allows you to quickly create a visual
< /// representation of the file system.
< ///
< /// struct FileItem: Hashable, Identifiable, CustomStringConvertible {
< /// var id: Self { self }
< /// var name: String
< /// var children: [FileItem]? = nil
< /// var description: String {
< /// switch (children) {
< /// case nil:
< /// return "📄 \(name)"
< /// case .some(let children):
< /// return children.count > 0 ? "📂 \(name)" : "📁 \(name)"
< /// }
< /// }
< /// }
< ///
< /// let data =
< /// FileItem(name: "users", children:
< /// [FileItem(name: "user1234", children:
< /// [FileItem(name:"Photos", children:
< /// [FileItem(name: "photo001.jpg"),
< /// FileItem(name: "photo002.jpg")]),
< /// FileItem(name:"Movies", children:
< /// [FileItem(name: "movie001.mp4")]),
< /// FileItem(name:"Documents", children: [])
< /// ]),
< /// FileItem(name: "newuser", children:
< /// [FileItem (name: "Documents", children: [])
< /// ])
< /// ])
< ///
< /// OutlineGroup(data, children: \.children) { item in
< /// Text ("\(item.description)")
< /// }
< ///
< /// ### Type Parameters
< ///
< /// Five generic type constraints define a specific `OutlineGroup` instance:
< ///
< /// - `Data`: The type of a collection containing the children of an element in
< /// the tree-shaped data.
< /// - `ID`: The type of the identifier for an element.
< /// - `Parent`: The type of the visual representation of an element whose
< /// children property is non-`nil`
< /// - `Leaf`: The type of the visual representation of an element whose
< /// children property is `nil`.
< /// - `Subgroup`: A type of a view that groups a parent view and a view
< /// representing its children, typically with some mechanism for showing and
< /// hiding the children
< @available(iOS 14.0, OSX 10.16, *)
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
< public struct OutlineGroup<Data, ID, Parent, Leaf, Subgroup> where Data : RandomAccessCollection, ID : Hashable {
< }
<
< @available(iOS 14.0, OSX 10.16, *)
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
< extension OutlineGroup where ID == Data.Element.ID, Parent : View, Parent == Leaf, Subgroup == DisclosureGroup<Parent, OutlineSubgroupChildren>, Data.Element : Identifiable {
<
< /// Creates an outline group from a root data element and a key path to
< /// its children.
< ///
< /// This initializer creates an instance that uniquely identifies views
< /// across updates based on the identity of the underlying data element.
< ///
< /// All generated disclosure groups begin in the collapsed state.
< ///
< /// Make sure that the identifier of a data element only changes if you
< /// mean to replace that element with a new element, one with a new
< /// identity. If the ID of an element changes, then the content view
< /// generated from that element will lose any current state and animations.
< ///
< /// - Parameters:
< /// - root: The root of a collection of tree-structured, identified
< /// data.
< /// - children: A key path to a property whose non-`nil` value gives the
< /// children of `data`. A non-`nil` but empty value denotes an element
< /// capable of having children that's currently childless, such as an
< /// empty directory in a file system. On the other hand, if the property
< /// at the key path is `nil`, then the outline group treats `data` as a
< /// leaf in the tree, like a regular file in a file system.
< /// - content: A view builder that produces a content view based on an
< /// element in `data`.
< public init<DataElement>(_ root: DataElement, children: KeyPath<DataElement, Data?>, @ViewBuilder content: @escaping (DataElement) -> Leaf) where ID == DataElement.ID, DataElement : Identifiable, DataElement == Data.Element
<
< /// Creates an outline group from a collection of root data elements and
< /// a key path to its children.
< ///
< /// This initializer creates an instance that uniquely identifies views
< /// across updates based on the identity of the underlying data element.
< ///
< /// All generated disclosure groups begin in the collapsed state.
< ///
< /// Make sure that the identifier of a data element only changes if you
< /// mean to replace that element with a new element, one with a new
< /// identity. If the ID of an element changes, then the content view
< /// generated from that element will lose any current state and animations.
< ///
< /// - Parameters:
< /// - data: A collection of tree-structured, identified data.
< /// - children: A key path to a property whose non-`nil` value gives the
< /// children of `data`. A non-`nil` but empty value denotes an element
< /// capable of having children that's currently childless, such as an
< /// empty directory in a file system. On the other hand, if the property
< /// at the key path is `nil`, then the outline group treats `data` as a
< /// leaf in the tree, like a regular file in a file system.
< /// - content: A view builder that produces a content view based on an
< /// element in `data`.
< public init<DataElement>(_ data: Data, children: KeyPath<DataElement, Data?>, @ViewBuilder content: @escaping (DataElement) -> Leaf) where ID == DataElement.ID, DataElement : Identifiable, DataElement == Data.Element
< }
<
< @available(iOS 14.0, OSX 10.16, *)
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
< extension OutlineGroup where Parent : View, Parent == Leaf, Subgroup == DisclosureGroup<Parent, OutlineSubgroupChildren> {
<
< /// Creates an outline group from a root data element, the key path to its
< /// identifier, and a key path to its children.
< ///
< /// This initializer creates an instance that uniquely identifies views
< /// across updates based on the identity of the underlying data element.
< ///
< /// All generated disclosure groups begin in the collapsed state.
< ///
< /// Make sure that the identifier of a data element only changes if you
< /// mean to replace that element with a new element, one with a new
< /// identity. If the ID of an element changes, then the content view
< /// generated from that element will lose any current state and animations.
< ///
< /// - Parameters:
< /// - root: The root of a collection of tree-structured, identified
< /// data.
< /// - id: The key path to a data element's identifier.
< /// - children: A key path to a property whose non-`nil` value gives the
< /// children of `data`. A non-`nil` but empty value denotes an element
< /// capable of having children that's currently childless, such as an
< /// empty directory in a file system. On the other hand, if the property
< /// at the key path is `nil`, then the outline group treats `data` as a
< /// leaf in the tree, like a regular file in a file system.
< /// - content: A view builder that produces a content view based on an
< /// element in `data`.
< public init<DataElement>(_ root: DataElement, id: KeyPath<DataElement, ID>, children: KeyPath<DataElement, Data?>, @ViewBuilder content: @escaping (DataElement) -> Leaf) where DataElement == Data.Element
<
< /// Creates an outline group from a collection of root data elements, the
< /// key path to a data element's identifier, and a key path to its children.
< ///
< /// This initializer creates an instance that uniquely identifies views
< /// across updates based on the identity of the underlying data element.
< ///
< /// All generated disclosure groups begin in the collapsed state.
< ///
< /// Make sure that the identifier of a data element only changes if you
< /// mean to replace that element with a new element, one with a new
< /// identity. If the ID of an element changes, then the content view
< /// generated from that element will lose any current state and animations.
< ///
< /// - Parameters:
< /// - data: A collection of tree-structured, identified data.
< /// - id: The key path to a data element's identifier.
< /// - children: A key path to a property whose non-`nil` value gives the
< /// children of `data`. A non-`nil` but empty value denotes an element
< /// capable of having children that's currently childless, such as an
< /// empty directory in a file system. On the other hand, if the property
< /// at the key path is `nil`, then the outline group treats `data` as a
< /// leaf in the tree, like a regular file in a file system.
< /// - content: A view builder that produces a content view based on an
< /// element in `data`.
< public init<DataElement>(_ data: Data, id: KeyPath<DataElement, ID>, children: KeyPath<DataElement, Data?>, @ViewBuilder content: @escaping (DataElement) -> Leaf) where DataElement == Data.Element
< }
<
< @available(iOS 14.0, OSX 10.16, *)
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
< extension OutlineGroup : View where Parent : View, Leaf : View, Subgroup : View {
<
< /// The content and behavior of the view.
< public var body: some View { get }
<
< /// The type of view representing the body of this view.
< ///
< /// When you create a custom view, Swift infers this type from your
< /// implementation of the required `body` property.
< public typealias Body = some View
< }
<
< /// A type-erased view representing the children in an outline subgroup.
< ///
< /// ``OutlineGroup`` uses this type as a generic constraint for the `Content`
< /// of the ``DisclosureGroup`` instances it creates.
< @available(iOS 14.0, OSX 10.16, *)
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
< public struct OutlineSubgroupChildren : View {
<
< /// The type of view representing the body of this view.
< ///
< /// When you create a custom view, Swift infers this type from your
< /// implementation of the required `body` property.
< public typealias Body = Never
< }
<
< /// A system button that triggers reading data from the pasteboard.
< ///
< /// Currently, `PasteButton` will not automatically invalidate on pasteboard
< /// changes, and so should be mainly used in transient contexts like in
< /// `ContextMenu`.
< @available(OSX 10.15, *)
< @available(iOS, unavailable)
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
< public struct PasteButton : View {
<
< /// Creates an instance that is filtered to accepting specific type
< /// identifiers from the pasteboard.
< ///
< /// - Parameters:
< /// - supportedContentTypes: The exact uniform type identifiers supported
< /// by the button. If the pasteboard does not contain any of the
< /// supported types, the button will be disabled.
< /// - payloadAction: The handler to call on trigger of the button with the
< /// items from the pasteboard that conform to `supportedContentTypes`.
< ///
< /// `supportedContentTypes` is ordered based on preference of types. The
< /// pasteboard items provided to `dataHandler` will have a type that is the
< /// most preferred type out of all the types the source supports.
< @available(OSX 10.16, *)
< public init(supportedContentTypes: [UTType], payloadAction: @escaping ([NSItemProvider]) -> Void)
<
< /// Creates an instance that is filtered to accepting specific type
< /// identifiers from the pasteboard, as well as allows custom validation
< /// of the data conforming to those types.
< ///
< /// - Parameters:
< /// - supportedContentTypes: The exact uniform type identifiers supported
< /// by the button. If the pasteboard does not contain any of the
< /// supported types, the button will be disabled.
< /// - validator: The handler that is called on validation of the button
< /// with items from the pasteboard that conform to
< /// `supportedContentTypes`. The return result of `validator` will be
< /// provided to `dataHandler` on trigger of the button. If `nil` is
< /// returned, the button will be disabled.
< /// - payloadAction: The handler to call on trigger of the button with the
< /// pre-processed result of `validator`.
< ///
< /// `supportedContentTypes` is ordered based on preference of types. The
< /// pasteboard items provided to `validator` will have a type that is the
< /// most preferred type out of all the types the source supports.
< @available(OSX 10.16, *)
< public init<Payload>(supportedContentTypes: [UTType], validator: @escaping ([NSItemProvider]) -> Payload?, payloadAction: @escaping (Payload) -> Void)
<
< /// The content and behavior of the view.
< public var body: some View { get }
<
< /// The type of view representing the body of this view.
< ///
< /// When you create a custom view, Swift infers this type from your
< /// implementation of the required `body` property.
< public typealias Body = some View
< }
<
< @available(iOS, unavailable)
< @available(OSX, introduced: 10.15, deprecated: 100000.0, message: "Provide `UTType`s as the `supportedContentTypes` instead.")
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
< extension PasteButton {
<
< /// Creates an instance that is filtered to accepting specific type
< /// identifiers from the pasteboard.
< ///
< /// - Parameters:
< /// - supportedTypes: The exact uniform type identifiers supported by the
< /// button. If the pasteboard does not contain any of the supported
< /// types, the button will be disabled.
< /// - payloadAction: The handler to call on trigger of the button with the
< /// items from the pasteboard that conform to `supportedTypes`.
< ///
< /// `supportedTypes` is ordered based on preference of types. The pasteboard
< /// items provided to `dataHandler` will have a type that is the most
< /// preferred type out of all the types the source supports.
< public init(supportedTypes: [String], payloadAction: @escaping ([NSItemProvider]) -> Void)
<
< /// Creates an instance that is filtered to accepting specific type
< /// identifiers from the pasteboard, as well as allows custom validation
< /// of the data conforming to those types.
< ///
< /// - Parameters:
< /// - supportedTypes: The exact uniform type identifiers supported by the
< /// button. If the pasteboard does not contain any of the supported
< /// types, the button will be disabled.
< /// - validator: The handler that is called on validation of the button
< /// with items from the pasteboard that conform to `supportedTypes`. The
< /// return result of `validator` will be provided to `dataHandler` on
< /// trigger of the button. If `nil` is returned, the button will be
< /// disabled.
< /// - payloadAction: The handler to call on trigger of the button with the
< /// pre-processed result of `validator`.
< ///
< /// `supportedTypes` is ordered based on preference of types. The pasteboard
< /// items provided to `validator` will have a type that is the most
< /// preferred type out of all the types the source supports.
< public init<Payload>(supportedTypes: [String], validator: @escaping ([NSItemProvider]) -> Payload?, payloadAction: @escaping (Payload) -> Void)
< }
<
< /// The outline of a 2D shape.
< @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
< @frozen public struct Path : Equatable, LosslessStringConvertible {
<
< /// Creates an empty path.
< public init()
<
< /// Creates a path from an immutable shape path.
< public init(_ path: CGPath)
<
< /// Creates a path from a copy of a mutable shape path.
< public init(_ path: CGMutablePath)
<
< /// Creates a path as the given rectangle.
< public init(_ rect: CGRect)
<
< /// Creates a path as the given rounded rectangle.
< public init(roundedRect rect: CGRect, cornerSize: CGSize, style: RoundedCornerStyle = .circular)
<
< /// Creates a path as the given rounded rectangle.
< public init(roundedRect rect: CGRect, cornerRadius: CGFloat, style: RoundedCornerStyle = .circular)
<
< /// Creates a path as an ellipse inscribed within the given rectangle.
< public init(ellipseIn rect: CGRect)
<
< /// Creates an empty path, and then executes the closure to add the initial
< /// elements.
< public init(_ callback: (inout Path) -> ())
<
< /// Initializes from the result of a previous call to
< /// `Path.stringRepresentation`. Fails if the `string` does not
< /// describe a valid path.
< public init?(_ string: String)
<
< /// A description of the path that may be used to recreate the path
< /// via `init?(_:)`.
< public var description: String { get }
<
< /// An immutable path representing the elements in the path.
< public var cgPath: CGPath { get }
<
< /// A Boolean value indicating whether the path contains zero elements.
< public var isEmpty: Bool { get }
<
< /// A rectangle containing all path segments.
< public var boundingRect: CGRect { get }
<
< /// Returns true if the path contains a specified point.
< ///
< /// If `eoFill` is true, this method uses the even-odd rule to define which
< /// points are inside the path. Otherwise, it uses the non-zero rule.
< public func contains(_ p: CGPoint, eoFill: Bool = false) -> Bool
<
< /// An element of a path.
< @frozen public enum Element : Equatable {
<
< /// A path element that terminates the current subpath (without closing
< /// it) and defines a new current point.
< case move(to: CGPoint)
<
< /// A line from the previous current point to the given point, which
< /// becomes the new current point.
< case line(to: CGPoint)
<
< /// A quadratic Bézier curve from the previous current point to the
< /// given end-point, using the single control point to define the curve.
< ///
< /// The end-point of the curve becomes the new current point.
< case quadCurve(to: CGPoint, control: CGPoint)
<
< /// A cubic Bézier curve from the previous current point to the given
< /// end-point, using the two control points to define the curve.
< ///
< /// The end-point of the curve becomes the new current point.
< case curve(to: CGPoint, control1: CGPoint, control2: CGPoint)
<
< /// A line from the start point of the current subpath (if any) to the
< /// current point, which terminates the subpath.
< ///
< /// After closing the subpath, the current point becomes undefined.
< case closeSubpath
<
< /// Returns a Boolean value indicating whether two values are equal.
< ///
< /// Equality is the inverse of inequality. For any values `a` and `b`,
< /// `a == b` implies that `a != b` is `false`.
< ///
< /// - Parameters:
< /// - lhs: A value to compare.
< /// - rhs: Another value to compare.
< public static func == (a: Path.Element, b: Path.Element) -> Bool
< }
<
< /// Calls `body` with each element in the path.
< public func forEach(_ body: (Path.Element) -> Void)
<
< /// Returns a stroked copy of the path using `style` to define how the
< /// stroked outline is created.
< public func strokedPath(_ style: StrokeStyle) -> Path
<
< /// Returns a partial copy of the path.
< ///
< /// The returned path contains the region between `from` and `to`, both of
< /// which must be fractions between zero and one defining points
< /// linearly-interpolated along the path.
< public func trimmedPath(from: CGFloat, to: CGFloat) -> Path
<
< /// Returns a Boolean value indicating whether two values are equal.
< ///
< /// Equality is the inverse of inequality. For any values `a` and `b`,
< /// `a == b` implies that `a != b` is `false`.
< ///
< /// - Parameters:
< /// - lhs: A value to compare.
< /// - rhs: Another value to compare.
< public static func == (a: Path, b: Path) -> Bool
< }
<
< @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
< extension Path : Shape {
<
< /// Describes this shape as a path within a rectangular frame of reference.
< ///
< /// - Parameter rect: The frame of reference for describing this shape.
< ///
< /// - Returns: A path that describes this shape.
< public func path(in _: CGRect) -> Path
<
< /// The type defining the data to animate.
< public typealias AnimatableData = EmptyAnimatableData
<
< /// The type of view representing the body of this view.
< ///
< /// When you create a custom view, Swift infers this type from your
< /// implementation of the required `body` property.
< public typealias Body
< }
<
< @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
< extension Path {
<
< /// Begins a new subpath at the specified point.
< public mutating func move(to p: CGPoint)
<
< /// Appends a straight line segment from the current point to the specified
< /// point.
< public mutating func addLine(to p: CGPoint)
<
< /// Adds a quadratic Bézier curve to the path, with the specified end point
< /// and control point.
< public mutating func addQuadCurve(to p: CGPoint, control cp: CGPoint)
<
< /// Adds a cubic Bézier curve to the path, with the specified end point and
< /// control points.
< public mutating func addCurve(to p: CGPoint, control1 cp1: CGPoint, control2 cp2: CGPoint)
<
< /// Closes and completes the current subpath.
< public mutating func closeSubpath()
<
< /// Adds a rectangular subpath to the path.
< public mutating func addRect(_ rect: CGRect, transform: CGAffineTransform = .identity)
<
< /// Adds a rounded rectangle to the path.
< public mutating func addRoundedRect(in rect: CGRect, cornerSize: CGSize, style: RoundedCornerStyle = .circular, transform: CGAffineTransform = .identity)
<
< /// Adds an ellipse to the path.
< public mutating func addEllipse(in rect: CGRect, transform: CGAffineTransform = .identity)
<
< /// Adds a sequence of rectangular subpaths to the path.
< public mutating func addRects(_ rects: [CGRect], transform: CGAffineTransform = .identity)
<
< /// Adds a sequence of connected straight-line segments to the path.
< public mutating func addLines(_ lines: [CGPoint])
<
< /// Adds an arc of a circle to the path, specified with a radius and a
< /// difference in angle.
< public mutating func addRelativeArc(center: CGPoint, radius: CGFloat, startAngle: Angle, delta: Angle, transform: CGAffineTransform = .identity)
<
< /// Adds an arc of a circle to the path, specified with a radius and angles.
< public mutating func addArc(center: CGPoint, radius: CGFloat, startAngle: Angle, endAngle: Angle, clockwise: Bool, transform: CGAffineTransform = .identity)
<
< /// Adds an arc of a circle to the path, specified with a radius and two
< /// tangent lines.
< public mutating func addArc(tangent1End p1: CGPoint, tangent2End p2: CGPoint, radius: CGFloat, transform: CGAffineTransform = .identity)
<
< /// Appends a copy of the given path to this path.
< public mutating func addPath(_ path: Path, transform: CGAffineTransform = .identity)
<
< /// Returns the last point in the path, or nil if the path contains
< /// no points.
< public var currentPoint: CGPoint? { get }
<
< /// Returns a path constructed by applying the transform to all points of
< /// the path.
< public func applying(_ transform: CGAffineTransform) -> Path
<
< /// Returns a path constructed by translating `self` by `(dx, dy)`.
< public func offsetBy(dx: CGFloat, dy: CGFloat) -> Path
< }
<
< /// A control for selecting from a set of mutually exclusive values.
< @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
< public struct Picker<Label, SelectionValue, Content> : View where Label : View, SelectionValue : Hashable, Content : View {
<
< /// Creates an instance that selects from content associated with
< /// `Selection` values.
< public init(selection: Binding<SelectionValue>, label: Label, @ViewBuilder content: () -> Content)
<
< /// The content and behavior of the view.
< public var body: some View { get }
<
< /// The type of view representing the body of this view.
< ///
< /// When you create a custom view, Swift infers this type from your
< /// implementation of the required `body` property.
< public typealias Body = some View
< }
<
< @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
< extension Picker where Label == Text {
<
< /// Creates an instance that selects from content associated with
< /// `Selection` values.
< public init(_ titleKey: LocalizedStringKey, selection: Binding<SelectionValue>, @ViewBuilder content: () -> Content)
<
< /// Creates an instance that selects from content associated with
< /// `Selection` values.
< public init<S>(_ title: S, selection: Binding<SelectionValue>, @ViewBuilder content: () -> Content) where S : StringProtocol
< }
<
< /// A custom specification for the appearance and interaction of a `Picker`.
< @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
< public protocol PickerStyle {
< }
<
< /// A set of view types that may be pinned to the bounds of a scroll view.
< @available(iOS 14.0, OSX 10.16, tvOS 14.0, watchOS 7.0, *)
< public struct PinnedScrollableViews : OptionSet {
<
< /// The corresponding value of the raw type.
< ///
< /// A new instance initialized with `rawValue` will be equivalent to this
< /// instance. For example:
< ///
< /// enum PaperSize: String {
< /// case A4, A5, Letter, Legal
< /// }
< ///
< /// let selectedSize = PaperSize.Letter
< /// print(selectedSize.rawValue)
< /// // Prints "Letter"
< ///
< /// print(selectedSize == PaperSize(rawValue: selectedSize.rawValue)!)
< /// // Prints "true"
< public let rawValue: UInt32
<
< /// Creates a new option set from the given raw value.
< ///
< /// This initializer always succeeds, even if the value passed as `rawValue`
< /// exceeds the static properties declared as part of the option set. This
< /// example creates an instance of `ShippingOptions` with a raw value beyond
< /// the highest element, with a bit mask that effectively contains all the
< /// declared static members.
< ///
< /// let extraOptions = ShippingOptions(rawValue: 255)
< /// print(extraOptions.isStrictSuperset(of: .all))
< /// // Prints "true"
< ///
< /// - Parameter rawValue: The raw value of the option set to create. Each bit
< /// of `rawValue` potentially represents an element of the option set,
< /// though raw values may include bits that are not defined as distinct
< /// values of the `OptionSet` type.
< public init(rawValue: UInt32)
<
< /// The header view of each `Section` will be pinned.
< public static let sectionHeaders: PinnedScrollableViews
<
< /// The footer view of each `Section` will be pinned.
< public static let sectionFooters: PinnedScrollableViews
<
< /// The element type of the option set.
< ///
< /// To inherit all the default implementations from the `OptionSet` protocol,
< /// the `Element` type must be `Self`, the default.
< public typealias Element = PinnedScrollableViews
<
< /// The type of the elements of an array literal.
< public typealias ArrayLiteralElement = PinnedScrollableViews
<
< /// The raw type that can be used to represent all values of the conforming
< /// type.
< ///
< /// Every distinct value of the conforming type has a corresponding unique
< /// value of the `RawValue` type, but there may be values of the `RawValue`
< /// type that don't have a corresponding value of the conforming type.
< public typealias RawValue = UInt32
< }
<
< /// A button style that doesn't style or decorate its content while idle, but
< /// may apply a visual effect to indicate the pressed, focused, or enabled state
< /// of the button.
< ///
< /// To apply this style to a button, or to a view that contains buttons, use the
< /// ``View/buttonStyle(_:)`` modifier.
< @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
< public struct PlainButtonStyle : PrimitiveButtonStyle {
---
> public struct PlainButtonStyle : PrimitiveButtonStyle {
11111,11126d10006
< /// A `PickerStyle` where the options are disclosed from a button that
< /// presents them in a menu, and the button itself indicates the selected
< /// option.
< ///
< /// This style is also appropriate for including auxiliary controls in the
< /// set of options, such as a customization button to customize the list
< /// of options.
< @available(OSX 10.15, *)
< @available(iOS, unavailable)
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
< public struct PopUpButtonPickerStyle : PickerStyle {
<
< public init()
< }
<
11875,11890d10754
< @available(iOS, unavailable)
< @available(OSX, deprecated, message: "Use MenuButton instead.")
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
< public typealias PullDownButton
<
< /// A menu button style which manifests as a pull-down button.
< @available(iOS, unavailable)
< @available(OSX, introduced: 10.15, deprecated: 100000.0, message: "Use `BorderedButtonMenuStyle` instead.")
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
< public struct PullDownMenuButtonStyle : MenuButtonStyle {
<
< public init()
< }
<
11909,11925d10772
< /// A `PickerStyle` where each option is represented as a radio button
< /// in a group of all options.
< ///
< /// This style is appropriate when there are two to five options. Consider
< /// the `popUpButton` style when there are more.
< ///
< /// Generally, use sentence-style capitalization without ending punctuation
< /// as the label for each option.
< @available(OSX 10.15, *)
< @available(iOS, unavailable)
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
< public struct RadioGroupPickerStyle : PickerStyle {
<
< public init()
< }
<
12369,12389c11216,11219
< ///
< /// Swift infers the scene's ``SwiftUI/Scene/Body-swift.associatedtype``
< /// associated type based on the contents of the `body` property.
< var body: Self.Body { get }
< }
<
< @available(iOS 14.0, OSX 10.16, tvOS 14.0, watchOS 7.0, *)
< extension Scene {
<
< /// The default store used by `AppStorage` contained within the scene and
< /// its view content.
< ///
< /// If unspecified, the default store for a view hierarchy is
< /// `UserDefaults.standard`, but can be set a to a custom one. For example,
< /// sharing defaults between an app and an extension can override the
< /// default store to one created with `UserDefaults.init(suiteName:_)`.
< ///
< /// - Parameter store: The user defaults to use as the default
< /// store for `AppStorage`.
< public func defaultAppStorage(_ store: UserDefaults) -> some Scene
<
---
> ///
> /// Swift infers the scene's ``SwiftUI/Scene/Body-swift.associatedtype``
> /// associated type based on the contents of the `body` property.
> var body: Self.Body { get }
12447,12468d11276
< @available(macCatalyst 14.0, OSX 10.16, *)
< @available(iOS, unavailable)
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
< extension Scene {
<
< /// Sets the style for windows created by this scene.
< public func windowStyle<S>(_ style: S) -> some Scene where S : WindowStyle
<
< }
<
< @available(macCatalyst 14.0, OSX 10.16, *)
< @available(iOS, unavailable)
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
< extension Scene {
<
< /// Sets the style for the toolbar defined within this scene.
< public func windowToolbarStyle<S>(_ style: S) -> some Scene where S : WindowToolbarStyle
<
< }
<
12487a11296,11312
> @available(iOS 14.0, OSX 10.16, tvOS 14.0, watchOS 7.0, *)
> extension Scene {
>
> /// The default store used by `AppStorage` contained within the scene and
> /// its view content.
> ///
> /// If unspecified, the default store for a view hierarchy is
> /// `UserDefaults.standard`, but can be set a to a custom one. For example,
> /// sharing defaults between an app and an extension can override the
> /// default store to one created with `UserDefaults.init(suiteName:_)`.
> ///
> /// - Parameter store: The user defaults to use as the default
> /// store for `AppStorage`.
> public func defaultAppStorage(_ store: UserDefaults) -> some Scene
>
> }
>
13022,13034d11846
< @available(OSX 10.15, *)
< @available(iOS, unavailable)
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
< extension Section where Parent : View, Content : View, Footer : View {
<
< /// Sets whether a `Section` can be collapsed by the user.
< ///
< /// Currently this modifier only applies to sections in `.sidebar`-styled `List` views.
< public func collapsible(_ collapsible: Bool) -> some View
<
< }
<
13083,13116d11894
< /// A style usable as the backgrounds for selected elements.
< ///
< /// - Parameter isSelected: Whether or not the associated view is selected.
< /// Passing `false` results in the style being equivalent to clear.
< /// Defaults to `true`.
< ///
< /// For example:
< ///
< /// ForEach(items, id: \.id) {
< /// ItemView(item)
< /// .padding()
< /// .background(SelectionShapeStyle(isSelected: item.id == selectedID))
< /// }
< ///
< /// On macOS this automatically reflects window key state and focus state,
< /// where the emphasized appearance will be used only when the window is
< /// key and the nearest focusable element is actually focused.
< @available(OSX 10.15, *)
< @available(iOS, unavailable)
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
< public struct SelectionShapeStyle : ShapeStyle {
< }
<
< /// A style appropriate for foreground separator or border lines.
< @available(OSX 10.15, *)
< @available(iOS, unavailable)
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
< public struct SeparatorShapeStyle : ShapeStyle {
<
< public init()
< }
<
13166,13201d11943
< /// A scene that presents an interface for viewing and modifying
< /// an app's settings.
< ///
< /// This scene will automatically provide a command
< /// for navigating to its window.
< @available(macCatalyst 14.0, OSX 10.16, *)
< @available(iOS, unavailable)
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
< public struct Settings<Content> : Scene where Content : View {
<
< /// Creates a scene which presents an interface
< /// for viewing and modifying an app's preferences.
< ///
< /// - Parameter content: A view which represents the content of the scene.
< public init(@ViewBuilder content: () -> Content)
<
< /// The content and behavior of the scene.
< ///
< /// For any scene that you create, provide a computed `body` property that
< /// defines the scene as a composition of other scenes. You can assemble a
< /// scene from primitive scenes that SwiftUI provides, as well as other
< /// scenes that you've defined.
< ///
< /// Swift infers the scene's ``SwiftUI/Scene/Body-swift.associatedtype``
< /// associated type based on the contents of the `body` property.
< public var body: some Scene { get }
<
< /// The type of scene that represents the body of this scene.
< ///
< /// When you create a custom scene, Swift infers this type from your
< /// implementation of the required ``SwiftUI/Scene/body-swift.property``
< /// property.
< public typealias Body = some Scene
< }
<
13224,13241c11966,11967
< /// Fills this shape with a color or gradient.
< ///
< /// - Parameters:
< /// - content: The color or gradient to use when filling this shape.
< /// - style: The style options that determine how the fill renders.
< /// - Returns: A shape filled with the color or gradient you supply.
< @inlinable public func fill<S>(_ content: S, style: FillStyle = FillStyle()) -> some View where S : ShapeStyle
<
<
< /// Fills this shape with the foreground color.
< ///
< /// - Parameter style: The style options that determine how the fill
< /// renders.
< /// - Returns: A shape filled with the foreground color.
< @inlinable public func fill(style: FillStyle = FillStyle()) -> some View
<
<
< /// Traces the outline of this shape with a color or gradient.
---
> /// Trims this shape by a fractional amount based on its representation as a
> /// path.
13243c11969,11971
< /// The following example adds a dashed purple stroke to a `Capsule`:
---
> /// To create a `Shape` instance, you define the shape's path using lines and
> /// curves. Use the `trim(from:to:)` method to draw a portion of a shape by
> /// ignoring portions of the beginning and ending of the shape's path.
13245,13256c11973,11975
< /// Capsule()
< /// .stroke(
< /// Color.purple,
< /// style: StrokeStyle(
< /// lineWidth: 5,
< /// lineCap: .round,
< /// lineJoin: .miter,
< /// miterLimit: 0,
< /// dash: [5, 10],
< /// dashPhase: 0
< /// )
< /// )
---
> /// For example, if you're drawing a figure eight or infinity symbol (∞)
> /// starting from its center, setting the `startFraction` and `endFraction`
> /// to different values determines the parts of the overall shape.
13258,13267c11977,11979
< /// - Parameters:
< /// - content: The color or gradient with which to stroke this shape.
< /// - style: The stroke characteristics --- such as the line's width and
< /// whether the stroke is dashed --- that determine how to render this
< /// shape.
< /// - Returns: A stroked shape.
< @inlinable public func stroke<S>(_ content: S, style: StrokeStyle) -> some View where S : ShapeStyle
<
<
< /// Traces the outline of this shape with a color or gradient.
---
> /// The following example shows a simplified infinity symbol that draws
> /// only three quarters of the full shape. That is, of the two lobes of the
> /// symbol, one lobe is complete and the other is half complete.
13269c11981,11995
< /// The following example draws a circle with a purple stroke:
---
> /// Path { path in
> /// path.addLines([
> /// .init(x: 2, y: 1),
> /// .init(x: 1, y: 0),
> /// .init(x: 0, y: 1),
> /// .init(x: 1, y: 2),
> /// .init(x: 3, y: 0),
> /// .init(x: 4, y: 1),
> /// .init(x: 3, y: 2),
> /// .init(x: 2, y: 1)
> /// ])
> /// }
> /// .trim(from: 0.25, to: 1.0)
> /// .scale(50, anchor: .topLeading)
> /// .stroke(Color.black, lineWidth: 3)
13271c11997,11999
< /// Circle().stroke(Color.purple, lineWidth: 5)
---
> /// Changing the parameters of `trim(from:to:)` to
> /// `.trim(from: 0, to: 1)` draws the full infinity symbol, while
> /// `.trim(from: 0, to: 0.5)` draws only the left lobe of the symbol.
13274,13284c12002,12007
< /// - content: The color or gradient with which to stroke this shape.
< /// - lineWidth: The width of the stroke that outlines this shape.
< /// - Returns: A stroked shape.
< @inlinable public func stroke<S>(_ content: S, lineWidth: CGFloat = 1) -> some View where S : ShapeStyle
<
< }
<
< /// A shape acts as view by filling itself with the foreground color and
< /// default fill style.
< @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
< extension Shape {
---
> /// - startFraction: The fraction of the way through drawing this shape
> /// where drawing starts.
> /// - endFraction: The fraction of the way through drawing this shape
> /// where drawing ends.
> /// - Returns: A shape built by capturing a portion of this shape's path.
> @inlinable public func trim(from startFraction: CGFloat = 0, to endFraction: CGFloat = 1) -> some Shape
13286,13287d12008
< /// The content and behavior of the view.
< public var body: _ShapeView<Self, ForegroundStyle> { get }
13416,13417c12137,12155
< /// Trims this shape by a fractional amount based on its representation as a
< /// path.
---
> /// Returns a new version of self representing the same shape, but
> /// that will ask it to create its path from a rect of `size`. This
> /// does not affect the layout properties of any views created from
> /// the shape (e.g. by filling it).
> @inlinable public func size(_ size: CGSize) -> some Shape
>
>
> /// Returns a new version of self representing the same shape, but
> /// that will ask it to create its path from a rect of size
> /// `(width, height)`. This does not affect the layout properties
> /// of any views created from the shape (e.g. by filling it).
> @inlinable public func size(width: CGFloat, height: CGFloat) -> some Shape
>
> }
>
> @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
> extension Shape {
>
> /// Fills this shape with a color or gradient.
13419,13421c12157,12164
< /// To create a `Shape` instance, you define the shape's path using lines and
< /// curves. Use the `trim(from:to:)` method to draw a portion of a shape by
< /// ignoring portions of the beginning and ending of the shape's path.
---
> /// - Parameters:
> /// - content: The color or gradient to use when filling this shape.
> /// - style: The style options that determine how the fill renders.
> /// - Returns: A shape filled with the color or gradient you supply.
> @inlinable public func fill<S>(_ content: S, style: FillStyle = FillStyle()) -> some View where S : ShapeStyle
>
>
> /// Fills this shape with the foreground color.
13423,13425c12166,12172
< /// For example, if you're drawing a figure eight or infinity symbol (∞)
< /// starting from its center, setting the `startFraction` and `endFraction`
< /// to different values determines the parts of the overall shape.
---
> /// - Parameter style: The style options that determine how the fill
> /// renders.
> /// - Returns: A shape filled with the foreground color.
> @inlinable public func fill(style: FillStyle = FillStyle()) -> some View
>
>
> /// Traces the outline of this shape with a color or gradient.
13427,13429c12174
< /// The following example shows a simplified infinity symbol that draws
< /// only three quarters of the full shape. That is, of the two lobes of the
< /// symbol, one lobe is complete and the other is half complete.
---
> /// The following example adds a dashed purple stroke to a `Capsule`:
13431,13445c12176,12198
< /// Path { path in
< /// path.addLines([
< /// .init(x: 2, y: 1),
< /// .init(x: 1, y: 0),
< /// .init(x: 0, y: 1),
< /// .init(x: 1, y: 2),
< /// .init(x: 3, y: 0),
< /// .init(x: 4, y: 1),
< /// .init(x: 3, y: 2),
< /// .init(x: 2, y: 1)
< /// ])
< /// }
< /// .trim(from: 0.25, to: 1.0)
< /// .scale(50, anchor: .topLeading)
< /// .stroke(Color.black, lineWidth: 3)
---
> /// Capsule()
> /// .stroke(
> /// Color.purple,
> /// style: StrokeStyle(
> /// lineWidth: 5,
> /// lineCap: .round,
> /// lineJoin: .miter,
> /// miterLimit: 0,
> /// dash: [5, 10],
> /// dashPhase: 0
> /// )
> /// )
> ///
> /// - Parameters:
> /// - content: The color or gradient with which to stroke this shape.
> /// - style: The stroke characteristics --- such as the line's width and
> /// whether the stroke is dashed --- that determine how to render this
> /// shape.
> /// - Returns: A stroked shape.
> @inlinable public func stroke<S>(_ content: S, style: StrokeStyle) -> some View where S : ShapeStyle
>
>
> /// Traces the outline of this shape with a color or gradient.
13447,13449c12200,12202
< /// Changing the parameters of `trim(from:to:)` to
< /// `.trim(from: 0, to: 1)` draws the full infinity symbol, while
< /// `.trim(from: 0, to: 0.5)` draws only the left lobe of the symbol.
---
> /// The following example draws a circle with a purple stroke:
> ///
> /// Circle().stroke(Color.purple, lineWidth: 5)
13452,13457c12205,12208
< /// - startFraction: The fraction of the way through drawing this shape
< /// where drawing starts.
< /// - endFraction: The fraction of the way through drawing this shape
< /// where drawing ends.
< /// - Returns: A shape built by capturing a portion of this shape's path.
< @inlinable public func trim(from startFraction: CGFloat = 0, to endFraction: CGFloat = 1) -> some Shape
---
> /// - content: The color or gradient with which to stroke this shape.
> /// - lineWidth: The width of the stroke that outlines this shape.
> /// - Returns: A stroked shape.
> @inlinable public func stroke<S>(_ content: S, lineWidth: CGFloat = 1) -> some View where S : ShapeStyle
13460a12212,12213
> /// A shape acts as view by filling itself with the foreground color and
> /// default fill style.
13464,13476c12217,12218
< /// Returns a new version of self representing the same shape, but
< /// that will ask it to create its path from a rect of `size`. This
< /// does not affect the layout properties of any views created from
< /// the shape (e.g. by filling it).
< @inlinable public func size(_ size: CGSize) -> some Shape
<
<
< /// Returns a new version of self representing the same shape, but
< /// that will ask it to create its path from a rect of size
< /// `(width, height)`. This does not affect the layout properties
< /// of any views created from the shape (e.g. by filling it).
< @inlinable public func size(width: CGFloat, height: CGFloat) -> some Shape
<
---
> /// The content and behavior of the view.
> public var body: _ShapeView<Self, ForegroundStyle> { get }
13862,13867c12604,12608
< /// A text field style with a system-defined square border.
< @available(OSX 10.15, *)
< @available(iOS, unavailable)
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
< public struct SquareBorderTextFieldStyle : TextFieldStyle {
---
> /// A navigation view style represented by a view stack that only shows a
> /// single top view at a time.
> @available(iOS 13.0, tvOS 13.0, watchOS 7.0, *)
> @available(OSX, unavailable)
> public struct StackNavigationViewStyle : NavigationViewStyle {
14165,14178d12905
< /// A system style that displays the components in an editable field, with
< /// adjoining stepper that can increment/decrement the selected component.
< ///
< /// This style is useful when space is constrained and users expect to
< /// make specific date and time selections.
< @available(OSX 10.15, *)
< @available(iOS, unavailable)
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
< public struct StepperFieldDatePickerStyle : DatePickerStyle {
<
< public init()
< }
<
14526,14738c13253,13262
< /// - Parameters:
< /// - key: The key for a string in the table identified by `tableName`.
< /// - tableName: The name of the string table to search. If `nil`, use the
< /// table in the `Localizable.strings` file.
< /// - bundle: The bundle containing the strings file. If `nil`, use the
< /// main bundle.
< /// - comment: Contextual information about this key-value pair.
< public init(_ key: LocalizedStringKey, tableName: String? = nil, bundle: Bundle? = nil, comment: StaticString? = nil)
<
< /// Returns a Boolean value indicating whether two values are equal.
< ///
< /// Equality is the inverse of inequality. For any values `a` and `b`,
< /// `a == b` implies that `a != b` is `false`.
< ///
< /// - Parameters:
< /// - lhs: A value to compare.
< /// - rhs: Another value to compare.
< public static func == (a: Text, b: Text) -> Bool
< }
<
< @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
< extension Text {
<
< /// Sets the color of the text displayed by this view.
< ///
< /// Use this method to change the color of the text rendered by a text view.
< ///
< /// For example, you can display the names of the colors red, green, and
< /// blue in their respective colors:
< ///
< /// HStack {
< /// Text("Red").foregroundColor(.red)
< /// Text("Green").foregroundColor(.green)
< /// Text("Blue").foregroundColor(.blue)
< /// }
< ///
< /// ![Three text views arranged horizontally, each containing
< /// the name of a color displayed in that
< /// color.](SwiftUI-Text-foregroundColor.png)
< ///
< /// - Parameter color: The color to use when displaying this text.
< /// - Returns: A text view that uses the color value you supply.
< public func foregroundColor(_ color: Color?) -> Text
<
< /// Sets the default font for text in the view.
< ///
< /// Use `font(_:)` to apply a specific font to an individual
< /// Text View, or all of the text views in a container.
< ///
< /// In the example below, the first text field has a font set directly,
< /// while the font applied to the following container applies to all of the
< /// text views inside that container:
< ///
< /// VStack {
< /// Text("Font applied to a text view.")
< /// .font(.largeTitle)
< ///
< /// VStack {
< /// Text("These two text views have the same font")
< /// Text("applied to their parent view.")
< /// }
< /// .font(.system(size: 16, weight: .light, design: .default))
< /// }
< ///
< ///
< /// ![Applying a font to a single text view or a view container](SwiftUI-view-font.png)
< ///
< /// - Parameter font: The font to use when displaying this text.
< /// - Returns: Text that uses the font you specify.
< public func font(_ font: Font?) -> Text
<
< /// Sets the font weight of the text.
< ///
< /// - Parameter weight: One of the available font weights.
< ///
< /// - Returns: Text that uses the font weight you specify.
< public func fontWeight(_ weight: Font.Weight?) -> Text
<
< /// Applies a bold font weight to the text.
< ///
< /// - Returns: Bold text.
< public func bold() -> Text
<
< /// Applies italics to the text.
< ///
< /// - Returns: Italic text.
< public func italic() -> Text
<
< /// Applies a strikethrough to the text.
< ///
< /// - Parameters:
< /// - active: A Boolean value that indicates whether the text has a
< /// strikethrough applied.
< /// - color: The color of the strikethrough. If `color` is `nil`, the
< /// strikethrough uses the default foreground color.
< ///
< /// - Returns: Text with a line through its center.
< public func strikethrough(_ active: Bool = true, color: Color? = nil) -> Text
<
< /// Applies an underline to the text.
< ///
< /// - Parameters:
< /// - active: A Boolean value that indicates whether the text has an
< /// underline.
< /// - color: The color of the underline. If `color` is `nil`, the
< /// underline uses the default foreground color.
< ///
< /// - Returns: Text with a line running along its baseline.
< public func underline(_ active: Bool = true, color: Color? = nil) -> Text
<
< /// Sets the spacing, or kerning, between characters.
< ///
< /// Kerning defines the offset, in points, that a text view should shift
< /// characters from the default spacing. Use positive kerning to widen the
< /// spacing between characters. Use negative kerning to tighten the spacing
< /// between characters.
< ///
< /// VStack(alignment: .leading) {
< /// Text("ABCDEF").kerning(-3)
< /// Text("ABCDEF")
< /// Text("ABCDEF").kerning(3)
< /// }
< ///
< /// The last character in the first case, which uses negative kerning,
< /// experiences cropping because the kerning affects the trailing edge of
< /// the text view as well.
< ///
< /// ![Three text views showing character groups, with progressively
< /// increasing spacing between the characters in each
< /// group.](SwiftUI-Text-kerning-1.png)
< ///
< /// Kerning attempts to maintain ligatures. For example, the Hoefler Text
< /// font uses a ligature for the letter combination _ffl_, as in the word
< /// _raffle_, shown here with a small negative and a small positive kerning:
< ///
< /// ![Two text views showing the word raffle in the Hoefler Text font, the
< /// first with small negative and the second with small positive kerning.
< /// The letter combination ffl has the same shape in both variants because
< /// it acts as a ligature.](SwiftUI-Text-kerning-2.png)
< ///
< /// The *ffl* letter combination keeps a constant shape as the other letters
< /// move together or apart. Beyond a certain point in either direction,
< /// however, kerning does disable nonessential ligatures.
< ///
< /// ![Two text views showing the word raffle in the Hoefler Text font, the
< /// first with large negative and the second with large positive kerning.
< /// The letter combination ffl does not act as a ligature in either
< /// case.](SwiftUI-Text-kerning-3.png)
< ///
< /// - Important: If you add both the ``Text/tracking(_:)`` and
< /// ``Text/kerning(_:)`` modifiers to a view, the view applies the
< /// tracking and ignores the kerning.
< ///
< /// - Parameter kerning: The spacing to use between individual characters in
< /// this text.
< ///
< /// - Returns: Text with the specified amount of kerning.
< public func kerning(_ kerning: CGFloat) -> Text
<
< /// Sets the tracking for the text.
< ///
< /// Tracking adds space, measured in points, between the characters in the
< /// text view. A positive value increases the spacing between characters,
< /// while a negative value brings the characters closer together.
< ///
< /// VStack(alignment: .leading) {
< /// Text("ABCDEF").tracking(-3)
< /// Text("ABCDEF")
< /// Text("ABCDEF").tracking(3)
< /// }
< ///
< /// The code above uses an unusually large amount of tracking to make it
< /// easy to see the effect.
< ///
< /// ![Three text views showing character groups with progressively
< /// increasing spacing between the characters in each
< /// group.](SwiftUI-Text-tracking.png)
< ///
< /// The effect of tracking resembles that of the ``Text/kerning(_:)``
< /// modifier, but adds or removes trailing whitespace, rather than changing
< /// character offsets. Also, using any nonzero amount of tracking disables
< /// nonessential ligatures, whereas kerning attempts to maintain ligatures.
< ///
< /// - Important: If you add both the ``Text/tracking(_:)`` and
< /// ``Text/kerning(_:)`` modifiers to a view, the view applies the
< /// tracking and ignores the kerning.
< ///
< /// - Parameter tracking: The amount of additional space, in points, that
< /// the view should add to each character cluster after layout.
< ///
< /// - Returns: Text with the specified amount of tracking.
< public func tracking(_ tracking: CGFloat) -> Text
<
< /// Sets the vertical offset for the text relative to its baseline.
< ///
< /// Change the baseline offset to move the text in the view (in points) up
< /// or down relative to its baseline. The bounds of the view expand to
< /// contain the moved text.
< ///
< /// HStack(alignment: .top) {
< /// Text("Hello")
< /// .baselineOffset(-10)
< /// .border(Color.red)
< /// Text("Hello")
< /// .border(Color.green)
< /// Text("Hello")
< /// .baselineOffset(10)
< /// .border(Color.blue)
< /// }
< /// .background(Color(white: 0.9))
< ///
< /// By drawing a border around each text view, you can see how the text
< /// moves, and how that affects the view.
---
> /// - Parameters:
> /// - key: The key for a string in the table identified by `tableName`.
> /// - tableName: The name of the string table to search. If `nil`, use the
> /// table in the `Localizable.strings` file.
> /// - bundle: The bundle containing the strings file. If `nil`, use the
> /// main bundle.
> /// - comment: Contextual information about this key-value pair.
> public init(_ key: LocalizedStringKey, tableName: String? = nil, bundle: Bundle? = nil, comment: StaticString? = nil)
>
> /// Returns a Boolean value indicating whether two values are equal.
14740,14744c13264,13265
< /// ![Three text views, each with the word "Hello" outlined by a border and
< /// aligned along the top edges. The first and last are larger than the
< /// second, with padding inside the border above the word "Hello" in the
< /// first case, and padding inside the border below the word in the last
< /// case.](SwiftUI-Text-baselineOffset.png)
---
> /// Equality is the inverse of inequality. For any values `a` and `b`,
> /// `a == b` implies that `a != b` is `false`.
14746,14749c13267,13276
< /// The first view, with a negative offset, grows downward to handle the
< /// lowered text. The last view, with a positive offset, grows upward. The
< /// enclosing ``HStack`` instance, shown in gray, ensures all the text views
< /// remain aligned at their top edge, regardless of the offset.
---
> /// - Parameters:
> /// - lhs: A value to compare.
> /// - rhs: Another value to compare.
> public static func == (a: Text, b: Text) -> Bool
> }
>
> @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
> extension Text {
>
> /// Concatenates the text in two text views in a new text view.
14751,14752c13278,13280
< /// - Parameter baselineOffset: The amount to shift the text vertically (up
< /// or down) relative to its baseline.
---
> /// - Parameters:
> /// - lhs: The first text view with text to combine.
> /// - rhs: The second text view with text to combine.
14754,14755c13282,13284
< /// - Returns: Text that's above or below its baseline.
< public func baselineOffset(_ baselineOffset: CGFloat) -> Text
---
> /// - Returns: A new text view containing the combined contents of the two
> /// input text views.
> public static func + (lhs: Text, rhs: Text) -> Text
14844,14857d13372
< /// Concatenates the text in two text views in a new text view.
< ///
< /// - Parameters:
< /// - lhs: The first text view with text to combine.
< /// - rhs: The second text view with text to combine.
< ///
< /// - Returns: A new text view containing the combined contents of the two
< /// input text views.
< public static func + (lhs: Text, rhs: Text) -> Text
< }
<
< @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
< extension Text {
<
14983,14985c13498,13712
< /// When you create a custom view, Swift infers this type from your
< /// implementation of the required `body` property.
< public typealias Body = Never
---
> /// When you create a custom view, Swift infers this type from your
> /// implementation of the required `body` property.
> public typealias Body = Never
> }
>
> @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
> extension Text {
>
> /// Sets the color of the text displayed by this view.
> ///
> /// Use this method to change the color of the text rendered by a text view.
> ///
> /// For example, you can display the names of the colors red, green, and
> /// blue in their respective colors:
> ///
> /// HStack {
> /// Text("Red").foregroundColor(.red)
> /// Text("Green").foregroundColor(.green)
> /// Text("Blue").foregroundColor(.blue)
> /// }
> ///
> /// ![Three text views arranged horizontally, each containing
> /// the name of a color displayed in that
> /// color.](SwiftUI-Text-foregroundColor.png)
> ///
> /// - Parameter color: The color to use when displaying this text.
> /// - Returns: A text view that uses the color value you supply.
> public func foregroundColor(_ color: Color?) -> Text
>
> /// Sets the default font for text in the view.
> ///
> /// Use `font(_:)` to apply a specific font to an individual
> /// Text View, or all of the text views in a container.
> ///
> /// In the example below, the first text field has a font set directly,
> /// while the font applied to the following container applies to all of the
> /// text views inside that container:
> ///
> /// VStack {
> /// Text("Font applied to a text view.")
> /// .font(.largeTitle)
> ///
> /// VStack {
> /// Text("These two text views have the same font")
> /// Text("applied to their parent view.")
> /// }
> /// .font(.system(size: 16, weight: .light, design: .default))
> /// }
> ///
> ///
> /// ![Applying a font to a single text view or a view container](SwiftUI-view-font.png)
> ///
> /// - Parameter font: The font to use when displaying this text.
> /// - Returns: Text that uses the font you specify.
> public func font(_ font: Font?) -> Text
>
> /// Sets the font weight of the text.
> ///
> /// - Parameter weight: One of the available font weights.
> ///
> /// - Returns: Text that uses the font weight you specify.
> public func fontWeight(_ weight: Font.Weight?) -> Text
>
> /// Applies a bold font weight to the text.
> ///
> /// - Returns: Bold text.
> public func bold() -> Text
>
> /// Applies italics to the text.
> ///
> /// - Returns: Italic text.
> public func italic() -> Text
>
> /// Applies a strikethrough to the text.
> ///
> /// - Parameters:
> /// - active: A Boolean value that indicates whether the text has a
> /// strikethrough applied.
> /// - color: The color of the strikethrough. If `color` is `nil`, the
> /// strikethrough uses the default foreground color.
> ///
> /// - Returns: Text with a line through its center.
> public func strikethrough(_ active: Bool = true, color: Color? = nil) -> Text
>
> /// Applies an underline to the text.
> ///
> /// - Parameters:
> /// - active: A Boolean value that indicates whether the text has an
> /// underline.
> /// - color: The color of the underline. If `color` is `nil`, the
> /// underline uses the default foreground color.
> ///
> /// - Returns: Text with a line running along its baseline.
> public func underline(_ active: Bool = true, color: Color? = nil) -> Text
>
> /// Sets the spacing, or kerning, between characters.
> ///
> /// Kerning defines the offset, in points, that a text view should shift
> /// characters from the default spacing. Use positive kerning to widen the
> /// spacing between characters. Use negative kerning to tighten the spacing
> /// between characters.
> ///
> /// VStack(alignment: .leading) {
> /// Text("ABCDEF").kerning(-3)
> /// Text("ABCDEF")
> /// Text("ABCDEF").kerning(3)
> /// }
> ///
> /// The last character in the first case, which uses negative kerning,
> /// experiences cropping because the kerning affects the trailing edge of
> /// the text view as well.
> ///
> /// ![Three text views showing character groups, with progressively
> /// increasing spacing between the characters in each
> /// group.](SwiftUI-Text-kerning-1.png)
> ///
> /// Kerning attempts to maintain ligatures. For example, the Hoefler Text
> /// font uses a ligature for the letter combination _ffl_, as in the word
> /// _raffle_, shown here with a small negative and a small positive kerning:
> ///
> /// ![Two text views showing the word raffle in the Hoefler Text font, the
> /// first with small negative and the second with small positive kerning.
> /// The letter combination ffl has the same shape in both variants because
> /// it acts as a ligature.](SwiftUI-Text-kerning-2.png)
> ///
> /// The *ffl* letter combination keeps a constant shape as the other letters
> /// move together or apart. Beyond a certain point in either direction,
> /// however, kerning does disable nonessential ligatures.
> ///
> /// ![Two text views showing the word raffle in the Hoefler Text font, the
> /// first with large negative and the second with large positive kerning.
> /// The letter combination ffl does not act as a ligature in either
> /// case.](SwiftUI-Text-kerning-3.png)
> ///
> /// - Important: If you add both the ``Text/tracking(_:)`` and
> /// ``Text/kerning(_:)`` modifiers to a view, the view applies the
> /// tracking and ignores the kerning.
> ///
> /// - Parameter kerning: The spacing to use between individual characters in
> /// this text.
> ///
> /// - Returns: Text with the specified amount of kerning.
> public func kerning(_ kerning: CGFloat) -> Text
>
> /// Sets the tracking for the text.
> ///
> /// Tracking adds space, measured in points, between the characters in the
> /// text view. A positive value increases the spacing between characters,
> /// while a negative value brings the characters closer together.
> ///
> /// VStack(alignment: .leading) {
> /// Text("ABCDEF").tracking(-3)
> /// Text("ABCDEF")
> /// Text("ABCDEF").tracking(3)
> /// }
> ///
> /// The code above uses an unusually large amount of tracking to make it
> /// easy to see the effect.
> ///
> /// ![Three text views showing character groups with progressively
> /// increasing spacing between the characters in each
> /// group.](SwiftUI-Text-tracking.png)
> ///
> /// The effect of tracking resembles that of the ``Text/kerning(_:)``
> /// modifier, but adds or removes trailing whitespace, rather than changing
> /// character offsets. Also, using any nonzero amount of tracking disables
> /// nonessential ligatures, whereas kerning attempts to maintain ligatures.
> ///
> /// - Important: If you add both the ``Text/tracking(_:)`` and
> /// ``Text/kerning(_:)`` modifiers to a view, the view applies the
> /// tracking and ignores the kerning.
> ///
> /// - Parameter tracking: The amount of additional space, in points, that
> /// the view should add to each character cluster after layout.
> ///
> /// - Returns: Text with the specified amount of tracking.
> public func tracking(_ tracking: CGFloat) -> Text
>
> /// Sets the vertical offset for the text relative to its baseline.
> ///
> /// Change the baseline offset to move the text in the view (in points) up
> /// or down relative to its baseline. The bounds of the view expand to
> /// contain the moved text.
> ///
> /// HStack(alignment: .top) {
> /// Text("Hello")
> /// .baselineOffset(-10)
> /// .border(Color.red)
> /// Text("Hello")
> /// .border(Color.green)
> /// Text("Hello")
> /// .baselineOffset(10)
> /// .border(Color.blue)
> /// }
> /// .background(Color(white: 0.9))
> ///
> /// By drawing a border around each text view, you can see how the text
> /// moves, and how that affects the view.
> ///
> /// ![Three text views, each with the word "Hello" outlined by a border and
> /// aligned along the top edges. The first and last are larger than the
> /// second, with padding inside the border above the word "Hello" in the
> /// first case, and padding inside the border below the word in the last
> /// case.](SwiftUI-Text-baselineOffset.png)
> ///
> /// The first view, with a negative offset, grows downward to handle the
> /// lowered text. The last view, with a positive offset, grows upward. The
> /// enclosing ``HStack`` instance, shown in gray, ensures all the text views
> /// remain aligned at their top edge, regardless of the offset.
> ///
> /// - Parameter baselineOffset: The amount to shift the text vertically (up
> /// or down) relative to its baseline.
> ///
> /// - Returns: Text that's above or below its baseline.
> public func baselineOffset(_ baselineOffset: CGFloat) -> Text
15258,15268d13984
< /// A window style which displays the title bar section of the window.
< @available(macCatalyst 14.0, OSX 10.16, *)
< @available(iOS, unavailable)
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
< public struct TitleBarWindowStyle : WindowStyle {
<
< /// Creates a title bar window style.
< public init()
< }
<
15653,15682d14368
< }
<
< /// A container for a view that you can show in the Touch Bar.
< @available(OSX 10.15, *)
< @available(iOS, unavailable)
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
< public struct TouchBar<Content> where Content : View {
<
< /// Creates a non-customizable Touch Bar view container.
< public init(@ViewBuilder content: () -> Content)
<
< /// Creates a customizable Touch Bar view container with a globally unique
< /// identifier.
< ///
< /// Be sure that each view in `content` has an explicit
< /// `touchBarItemPresence` value with customization identifier.
< ///
< /// - Parameters:
< /// - id: A globally unique identifier for this Touch Bar.
< /// - content: A collection of views to be displayed by the Touch Bar.
< public init(id: String, @ViewBuilder content: () -> Content)
< }
<
< /// Options that affect user customization of the Touch Bar.
< @available(OSX 10.15, *)
< @available(iOS, unavailable)
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
< public enum TouchBarItemPresence {
15684,15688c14370,14373
< /// The Touch Bar view is visible by default and cannot be removed during
< /// customization.
< ///
< /// - Parameter id: A globally unique identifier for this item.
< case required(String)
---
> /// The item is placed in the leading area of the navigation bar.
> @available(OSX, unavailable)
> @available(watchOS, unavailable)
> public static let navigationBarLeading: ToolbarItemPlacement
15690,15694c14375,14378
< /// The Touch Bar view is visible by default, but can be removed during
< /// customization.
< ///
< /// - Parameter id: A globally unique identifier for this item.
< case `default`(String)
---
> /// The item is placed in the trailing area of the navigation bar.
> @available(OSX, unavailable)
> @available(watchOS, unavailable)
> public static let navigationBarTrailing: ToolbarItemPlacement
15696,15700c14380,14384
< /// The Touch Bar view isn't visible by default, but appears in the
< /// customization palette.
< ///
< /// - Parameter id: A globally unique identifier for this item.
< case optional(String)
---
> /// The item is placed in the bottom toolbar.
> @available(OSX, unavailable)
> @available(tvOS, unavailable)
> @available(watchOS, unavailable)
> public static let bottomBar: ToolbarItemPlacement
15720,15732d14403
< /// A Boolean value that indicates whether the transaction originated from
< /// an action that produces a sequence of values.
< ///
< /// This value is `true` if a continuous action created the transaction, and
< /// is `false` otherwise. Continuous actions include things like dragging a
< /// slider or pressing and holding a stepper, as opposed to tapping a
< /// button.
< public var isContinuous: Bool
< }
<
< @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
< extension Transaction {
<
15749a14421,14433
> @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
> extension Transaction {
>
> /// A Boolean value that indicates whether the transaction originated from
> /// an action that produces a sequence of values.
> ///
> /// This value is `true` if a continuous action created the transaction, and
> /// is `false` otherwise. Continuous actions include things like dragging a
> /// slider or pressing and holding a stepper, as opposed to tapping a
> /// button.
> public var isContinuous: Bool
> }
>
15795,15799c14479,14481
< /// A window toolbar style similar to `UnifiedWindowToolbarStyle`,
< /// but with a more compact vertical sizing.
< @available(macCatalyst 14.0, OSX 10.16, *)
< @available(iOS, unavailable)
< @available(tvOS, unavailable)
---
> /// A property wrapper that is used in `App` to provide a delegate from UIKit.
> @available(iOS 14.0, tvOS 14.0, *)
> @available(OSX, unavailable)
15801c14483
< public struct UnifiedCompactWindowToolbarStyle : WindowToolbarStyle {
---
> @propertyWrapper public struct UIApplicationDelegateAdaptor<DelegateType> : DynamicProperty where DelegateType : NSObject, DelegateType : UIApplicationDelegate {
15803,15804c14485,14486
< /// Creates a unified compact window toolbar style.
< public init()
---
> /// The underlying delegate.
> public var wrappedValue: DelegateType { get }
15806c14488,14493
< /// Creates a unified compact window toolbar style.
---
> /// Creates an `UIApplicationDelegateAdaptor` using a UIKit Application
> /// Delegate.
> ///
> /// The framework will initialize the provided delegate and manage its
> /// lifetime, calling out to it when appropriate after performing its
> /// own work.
15808,15809c14495,14496
< /// - Parameter showsTitle: Whether the title should be displayed.
< public init(showsTitle: Bool)
---
> /// - Parameter delegate: the type of `UIApplicationDelegate` to use.
> public init(_ delegateType: DelegateType.Type = DelegateType.self)
15812,15815c14499,14500
< /// A window toolbar style which displays its toolbar and title bar inline.
< @available(macCatalyst 14.0, OSX 10.16, *)
< @available(iOS, unavailable)
< @available(tvOS, unavailable)
---
> @available(iOS 14.0, tvOS 14.0, *)
> @available(OSX, unavailable)
15817c14502
< public struct UnifiedWindowToolbarStyle : WindowToolbarStyle {
---
> extension UIApplicationDelegateAdaptor where DelegateType : ObservableObject {
15819,15820c14504,14515
< /// Creates a unified window toolbar style.
< public init()
---
> /// Creates an `UIApplicationDelegateAdaptor` using a UIKit
> /// Application Delegate.
> ///
> /// The framework will initialize the provided delegate and manage its
> /// lifetime, calling out to it when appropriate after performing its
> /// own work.
> ///
> /// - Parameter delegate: the type of `UIApplicationDelegate` to use.
> /// - Note: the instantiated delegate will be placed in the Environment
> /// and may be accessed by using the `@EnvironmentObject` property wrapper
> /// in the view hierarchy.
> public init(_ delegateType: DelegateType.Type = DelegateType.self)
15822c14517,14518
< /// Creates a unified window toolbar style.
---
> /// A projection of the observed object that creates bindings to its
> /// properties using dynamic member lookup.
15824,15825c14520,14523
< /// - Parameter showsTitle: Whether the title should be displayed.
< public init(showsTitle: Bool)
---
> /// Use the projected value to pass a binding value down a view
> /// hierarchy. To get the `projectedValue`, prefix the property
> /// variable with `$`.
> public var projectedValue: ObservedObject<DelegateType>.Wrapper { get }
15828,15829c14526,14529
< @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
< @frozen public struct UnitPoint : Hashable {
---
> @available(iOS 13.0, tvOS 13.0, *)
> @available(OSX, unavailable)
> @available(watchOS, unavailable)
> open class UIHostingController<Content> : UIViewController where Content : View {
15831c14531
< public var x: CGFloat
---
> public init(rootView: Content)
15833c14533
< public var y: CGFloat
---
> public init?(coder aDecoder: NSCoder, rootView: Content)
15835c14535
< @inlinable public init()
---
> @objc required dynamic public init?(coder aDecoder: NSCoder)
15837c14537
< @inlinable public init(x: CGFloat, y: CGFloat)
---
> @objc override dynamic open func viewWillAppear(_ animated: Bool)
15839c14539
< public static let zero: UnitPoint
---
> @objc override dynamic open func viewDidAppear(_ animated: Bool)
15841c14541
< public static let center: UnitPoint
---
> @objc override dynamic open func viewWillDisappear(_ animated: Bool)
15843c14543
< public static let leading: UnitPoint
---
> public var rootView: Content
15845c14545
< public static let trailing: UnitPoint
---
> public func sizeThatFits(in size: CGSize) -> CGSize
15847c14547
< public static let top: UnitPoint
---
> @objc override dynamic open func preferredContentSizeDidChange(forChildContentContainer container: UIContentContainer)
15849c14549
< public static let bottom: UnitPoint
---
> @objc override dynamic open var preferredStatusBarStyle: UIStatusBarStyle { get }
15851c14551
< public static let topLeading: UnitPoint
---
> @objc override dynamic open var prefersStatusBarHidden: Bool { get }
15853c14553
< public static let topTrailing: UnitPoint
---
> @objc override dynamic open var preferredStatusBarUpdateAnimation: UIStatusBarAnimation { get }
15855c14555
< public static let bottomLeading: UnitPoint
---
> @objc override dynamic open var childForStatusBarHidden: UIViewController? { get }
15857c14557
< public static let bottomTrailing: UnitPoint
---
> @objc override dynamic open func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator)
15859c14559,14598
< /// Returns a Boolean value indicating whether two values are equal.
---
> @objc override dynamic open func willMove(toParent parent: UIViewController?)
>
> @objc override dynamic open func didMove(toParent parent: UIViewController?)
>
> @objc override dynamic public init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?)
> }
>
> /// A view that represents a UIKit view controller.
> ///
> /// Use a ``UIViewControllerRepresentable`` instance to create and manage a
> /// <doc://com.apple.documentation/documentation/UIKit/UIViewController> object in your
> /// SwiftUI interface. Adopt this protocol in one of your app's custom
> /// instances, and use its methods to create, update, and tear down your view
> /// controller. The creation and update processes parallel the behavior of
> /// SwiftUI views, and you use them to configure your view controller with your
> /// app's current state information. Use the teardown process to remove your
> /// view controller cleanly from your SwiftUI. For example, you might use the
> /// teardown process to notify other objects that the view controller is
> /// disappearing.
> ///
> /// To add your view controller into your SwiftUI interface, create your
> /// ``UIViewControllerRepresentable`` instance and add it to your SwiftUI
> /// interface. The system calls the methods of your custom instance at
> /// appropriate times.
> ///
> /// The system doesn't automatically communicate changes occurring within your
> /// view controller to other parts of your SwiftUI interface. When you want your
> /// view controller to coordinate with other SwiftUI views, you must provide a
> /// ``NSViewControllerRepresentable/Coordinator`` instance to facilitate those
> /// interactions. For example, you use a coordinator to forward target-action
> /// and delegate messages from your view controller to any SwiftUI views.
> @available(iOS 13.0, tvOS 13.0, *)
> @available(OSX, unavailable)
> @available(watchOS, unavailable)
> public protocol UIViewControllerRepresentable : View where Self.Body == Never {
>
> /// The type of view controller to present.
> associatedtype UIViewControllerType : UIViewController
>
> /// Creates the view controller object and configures its initial state.
15861,15862c14600,14606
< /// Equality is the inverse of inequality. For any values `a` and `b`,
< /// `a == b` implies that `a != b` is `false`.
---
> /// You must implement this method and use it to create your view controller
> /// object. Create the view controller using your app's current data and
> /// contents of the `context` parameter. The system calls this method only
> /// once, when it creates your view controller for the first time. For all
> /// subsequent updates, the system calls the
> /// ``UIViewControllerRepresentable/updateUIViewController(_:context:)``
> /// method.
15864,15867c14608,14613
< /// - Parameters:
< /// - lhs: A value to compare.
< /// - rhs: Another value to compare.
< public static func == (a: UnitPoint, b: UnitPoint) -> Bool
---
> /// - Parameter context: A context structure containing information about
> /// the current state of the system.
> ///
> /// - Returns: Your UIKit view controller configured with the provided
> /// information.
> func makeUIViewController(context: Self.Context) -> Self.UIViewControllerType
15869c14615,14616
< /// The hash value.
---
> /// Updates the state of the specified view controller with new information
> /// from SwiftUI.
15871,15872c14618,14622
< /// Hash values are not guaranteed to be equal across different executions of
< /// your program. Do not save hash values to use during a future execution.
---
> /// When the state of your app changes, SwiftUI updates the portions of your
> /// interface affected by those changes. SwiftUI calls this method for any
> /// changes affecting the corresponding AppKit view controller. Use this
> /// method to update the configuration of your view controller to match the
> /// new state information provided in the `context` parameter.
15874,15876c14624,14628
< /// - Important: `hashValue` is deprecated as a `Hashable` requirement. To
< /// conform to `Hashable`, implement the `hash(into:)` requirement instead.
< public var hashValue: Int { get }
---
> /// - Parameters:
> /// - uiViewController: Your custom view controller object.
> /// - context: A context structure containing information about the current
> /// state of the system.
> func updateUIViewController(_ uiViewController: Self.UIViewControllerType, context: Self.Context)
15878,15884c14630,14631
< /// Hashes the essential components of this value by feeding them into the
< /// given hasher.
< ///
< /// Implement this method to conform to the `Hashable` protocol. The
< /// components used for hashing must be the same as the components compared
< /// in your type's `==` operator implementation. Call `hasher.combine(_:)`
< /// with each of these components.
---
> /// Cleans up the presented view controller (and coordinator) in
> /// anticipation of their removal.
15886,15887c14633,14635
< /// - Important: Never call `finalize()` on `hasher`. Doing so may become a
< /// compile-time error in the future.
---
> /// Use this method to perform additional clean-up work related to your
> /// custom view controller. For example, you might use this method to remove
> /// observers or update other parts of your SwiftUI interface.
15889,15895c14637,14642
< /// - Parameter hasher: The hasher to use when combining the components
< /// of this instance.
< public func hash(into hasher: inout Hasher)
< }
<
< @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
< extension UnitPoint : Animatable {
---
> /// - Parameters:
> /// - uiViewController: Your custom view controller object.
> /// - coordinator: The custom coordinator instance you use to communicate
> /// changes back to SwiftUI. If you do not use a custom coordinator, the
> /// system provides a default instance.
> static func dismantleUIViewController(_ uiViewController: Self.UIViewControllerType, coordinator: Self.Coordinator)
15897,15898c14644,14645
< /// The type defining the data to animate.
< public typealias AnimatableData = AnimatablePair<CGFloat, CGFloat>
---
> /// A type to coordinate with the view controller.
> associatedtype Coordinator = Void
15900,15901c14647,14665
< /// The data to animate.
< public var animatableData: UnitPoint.AnimatableData
---
> /// Creates the custom instance that you use to communicate changes from
> /// your view controller to other parts of your SwiftUI interface.
> ///
> /// Implement this method if changes to your view controller might affect
> /// other parts of your app. In your implementation, create a custom Swift
> /// instance that can communicate with other parts of your interface. For
> /// example, you might provide an instance that binds its variables to
> /// SwiftUI properties, causing the two to remain synchronized. If your view
> /// controller doesn't interact with other parts of your app, providing a
> /// coordinator is unnecessary.
> ///
> /// SwiftUI calls this method before calling the
> /// ``UIViewControllerRepresentable/makeUIViewController(context:)`` method.
> /// The system provides your coordinator either directly or as part of a
> /// context structure when calling the other methods of your representable
> /// instance.
> func makeCoordinator() -> Self.Coordinator
>
> typealias Context = UIViewControllerRepresentableContext<Self>
15904,15912c14668,14670
< /// A layout container that arranges its children in a vertical line and allows
< /// the user to resize them using dividers placed between them.
< @available(OSX 10.15, *)
< @available(iOS, unavailable)
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
< public struct VSplitView<Content> : View where Content : View {
<
< public init(@ViewBuilder content: () -> Content)
---
> @available(iOS 13.0, tvOS 13.0, watchOS 6.0, *)
> @available(OSX, unavailable)
> extension UIViewControllerRepresentable where Self.Coordinator == Void {
15914c14672,14673
< /// The type of view representing the body of this view.
---
> /// Creates the custom instance that you use to communicate changes from
> /// your view controller to other parts of your SwiftUI interface.
15916,15918c14675,14688
< /// When you create a custom view, Swift infers this type from your
< /// implementation of the required `body` property.
< public typealias Body = Never
---
> /// Implement this method if changes to your view controller might affect
> /// other parts of your app. In your implementation, create a custom Swift
> /// instance that can communicate with other parts of your interface. For
> /// example, you might provide an instance that binds its variables to
> /// SwiftUI properties, causing the two to remain synchronized. If your view
> /// controller doesn't interact with other parts of your app, providing a
> /// coordinator is unnecessary.
> ///
> /// SwiftUI calls this method before calling the
> /// ``UIViewControllerRepresentable/makeUIViewController(context:)`` method.
> /// The system provides your coordinator either directly or as part of a
> /// context structure when calling the other methods of your representable
> /// instance.
> public func makeCoordinator() -> Self.Coordinator
15921,15923c14691,14693
< /// A view that arranges its children in a vertical line.
< @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
< @frozen public struct VStack<Content> : View where Content : View {
---
> @available(iOS 13.0, tvOS 13.0, watchOS 6.0, *)
> @available(OSX, unavailable)
> extension UIViewControllerRepresentable {
15925c14695,14700
< /// Creates an instance with the given spacing and horizontal alignment.
---
> /// Cleans up the presented view controller (and coordinator) in
> /// anticipation of their removal.
> ///
> /// Use this method to perform additional clean-up work related to your
> /// custom view controller. For example, you might use this method to remove
> /// observers or update other parts of your SwiftUI interface.
15928,15934c14703,14707
< /// - alignment: The guide for aligning the subviews in this stack. It has
< /// the same horizontal screen coordinate for all children.
< /// - spacing: The distance between adjacent subviews, or `nil` if you
< /// want the stack to choose a default distance for each pair of
< /// subviews.
< /// - content: A view builder that creates the content of this stack.
< @inlinable public init(alignment: HorizontalAlignment = .center, spacing: CGFloat? = nil, @ViewBuilder content: () -> Content)
---
> /// - uiViewController: Your custom view controller object.
> /// - coordinator: The custom coordinator instance you use to communicate
> /// changes back to SwiftUI. If you do not use a custom coordinator, the
> /// system provides a default instance.
> public static func dismantleUIViewController(_ uiViewController: Self.UIViewControllerType, coordinator: Self.Coordinator)
15936,15940c14709,14710
< /// The type of view representing the body of this view.
< ///
< /// When you create a custom view, Swift infers this type from your
< /// implementation of the required `body` property.
< public typealias Body = Never
---
> /// Declares the content and behavior of this view.
> public var body: Never { get }
15943c14713,14714
< /// A type that can serve as the animatable data of an animatable type.
---
> /// Contextual information about the state of the system that you use to create
> /// and update your UIKit view controller.
15945,15950c14716,14727
< /// `VectorArithmetic` extends the `AdditiveArithmetic` protocol with scalar
< /// multiplication and a way to query the vector magnitude of the value. Use
< /// this type as the `animatableData` associated type of a type that conforms to
< /// the ``Animatable`` protocol.
< @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
< public protocol VectorArithmetic : AdditiveArithmetic {
---
> /// A ``UIViewControllerRepresentableContext`` structure contains details about
> /// the current state of the system. When creating and updating your view
> /// controller, the system creates one of these structures and passes it to the
> /// appropriate method of your custom ``UIViewControllerRepresentable``
> /// instance. Use the information in this structure to configure your view
> /// controller. For example, use the provided environment values to configure
> /// the appearance of your view controller and views. Don't create this
> /// structure yourself.
> @available(iOS 13.0, tvOS 13.0, *)
> @available(OSX, unavailable)
> @available(watchOS, unavailable)
> public struct UIViewControllerRepresentableContext<Representable> where Representable : UIViewControllerRepresentable {
15952,15953c14729,14730
< /// Multiplies each component of this value by the given value.
< mutating func scale(by rhs: Double)
---
> /// The view's associated coordinator.
> public let coordinator: Representable.Coordinator
15955,15956c14732,14739
< /// Returns the dot-product of this vector arithmetic instance with itself.
< var magnitudeSquared: Double { get }
---
> /// The current transaction.
> public var transaction: Transaction { get }
>
> /// Environment values that describe the current state of the system.
> ///
> /// Use the environment values to configure the state of your UIKit view
> /// controller when creating or updating it.
> public var environment: EnvironmentValues { get }
15959,15961c14742,14779
< /// An alignment position along the horizontal axis.
< @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
< @frozen public struct VerticalAlignment : Equatable {
---
> /// A wrapper for a UIKit view that you use to integrate that view into your
> /// SwiftUI view hierarchy.
> ///
> /// Use a ``UIViewRepresentable`` instance to create and manage a
> /// <doc://com.apple.documentation/documentation/UIKit/UIView> object in your SwiftUI
> /// interface. Adopt this protocol in one of your app's custom instances, and
> /// use its methods to create, update, and tear down your view. The creation and
> /// update processes parallel the behavior of SwiftUI views, and you use them to
> /// configure your view with your app's current state information. Use the
> /// teardown process to remove your view cleanly from your SwiftUI. For example,
> /// you might use the teardown process to notify other objects that the view is
> /// disappearing.
> ///
> /// To add your view into your SwiftUI interface, create your
> /// ``UIViewRepresentable`` instance and add it to your SwiftUI interface. The
> /// system calls the methods of your representable instance at appropriate times
> /// to create and update the view. The following example shows the inclusion of
> /// a custom `MyRepresentedCustomView` structure in the view hierarchy.
> ///
> /// struct ContentView: View {
> /// var body: some View {
> /// VStack {
> /// Text("Global Sales")
> /// MyRepresentedCustomView()
> /// }
> /// }
> /// }
> ///
> /// The system doesn't automatically communicate changes occurring within your
> /// view to other parts of your SwiftUI interface. When you want your view to
> /// coordinate with other SwiftUI views, you must provide a
> /// ``NSViewControllerRepresentable/Coordinator`` instance to facilitate those
> /// interactions. For example, you use a coordinator to forward target-action
> /// and delegate messages from your view to any SwiftUI views.
> @available(iOS 13.0, tvOS 13.0, *)
> @available(OSX, unavailable)
> @available(watchOS, unavailable)
> public protocol UIViewRepresentable : View where Self.Body == Never {
15963c14781,14784
< /// Creates an instance with the given identifier.
---
> /// The type of view to present.
> associatedtype UIViewType : UIView
>
> /// Creates the view object and configures its initial state.
15965c14786,14791
< /// Each instance needs a unique identifier.
---
> /// You must implement this method and use it to create your view object.
> /// Configure the view using your app's current data and contents of the
> /// `context` parameter. The system calls this method only once, when it
> /// creates your view for the first time. For all subsequent updates, the
> /// system calls the ``UIViewRepresentable/updateUIView(_:context:)``
> /// method.
15967,15969c14793,14797
< /// - Parameter id: An identifier that uniquely identifies the vertical
< /// alignment.
< public init(_ id: AlignmentID.Type)
---
> /// - Parameter context: A context structure containing information about
> /// the current state of the system.
> ///
> /// - Returns: Your UIKit view configured with the provided information.
> func makeUIView(context: Self.Context) -> Self.UIViewType
15971c14799,14800
< /// Returns a Boolean value indicating whether two values are equal.
---
> /// Updates the state of the specified view with new information from
> /// SwiftUI.
15973,15974c14802,14806
< /// Equality is the inverse of inequality. For any values `a` and `b`,
< /// `a == b` implies that `a != b` is `false`.
---
> /// When the state of your app changes, SwiftUI updates the portions of your
> /// interface affected by those changes. SwiftUI calls this method for any
> /// changes affecting the corresponding UIKit view. Use this method to
> /// update the configuration of your view to match the new state information
> /// provided in the `context` parameter.
15977,15983c14809,14812
< /// - lhs: A value to compare.
< /// - rhs: Another value to compare.
< public static func == (a: VerticalAlignment, b: VerticalAlignment) -> Bool
< }
<
< @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
< extension VerticalAlignment {
---
> /// - uiView: Your custom view object.
> /// - context: A context structure containing information about the current
> /// state of the system.
> func updateUIView(_ uiView: Self.UIViewType, context: Self.Context)
15985,15986c14814,14826
< /// A guide marking the top edge of the view.
< public static let top: VerticalAlignment
---
> /// Cleans up the presented UIKit view (and coordinator) in anticipation of
> /// their removal.
> ///
> /// Use this method to perform additional clean-up work related to your
> /// custom view. For example, you might use this method to remove observers
> /// or update other parts of your SwiftUI interface.
> ///
> /// - Parameters:
> /// - uiView: Your custom view object.
> /// - coordinator: The custom coordinator instance you use to communicate
> /// changes back to SwiftUI. If you do not use a custom coordinator, the
> /// system provides a default instance.
> static func dismantleUIView(_ uiView: Self.UIViewType, coordinator: Self.Coordinator)
15988,15989c14828,14829
< /// A guide marking the vertical center of the view.
< public static let center: VerticalAlignment
---
> /// A type to coordinate with the view.
> associatedtype Coordinator = Void
15991,15992c14831,14846
< /// A guide marking the bottom edge of the view.
< public static let bottom: VerticalAlignment
---
> /// Creates the custom instance that you use to communicate changes from
> /// your view to other parts of your SwiftUI interface.
> ///
> /// Implement this method if changes to your view might affect other parts
> /// of your app. In your implementation, create a custom Swift instance that
> /// can communicate with other parts of your interface. For example, you
> /// might provide an instance that binds its variables to SwiftUI
> /// properties, causing the two to remain synchronized. If your view doesn't
> /// interact with other parts of your app, providing a coordinator is
> /// unnecessary.
> ///
> /// SwiftUI calls this method before calling the
> /// ``UIViewRepresentable/makeUIView(context:)`` method. The system provides
> /// your coordinator either directly or as part of a context structure when
> /// calling the other methods of your representable instance.
> func makeCoordinator() -> Self.Coordinator
15994,15995c14848,14853
< /// A guide marking the topmost text baseline view.
< public static let firstTextBaseline: VerticalAlignment
---
> typealias Context = UIViewRepresentableContext<Self>
> }
>
> @available(iOS 13.0, tvOS 13.0, watchOS 6.0, *)
> @available(OSX, unavailable)
> extension UIViewRepresentable where Self.Coordinator == Void {
15997,15998c14855,14870
< /// A guide marking the bottom-most text baseline in a view.
< public static let lastTextBaseline: VerticalAlignment
---
> /// Creates the custom instance that you use to communicate changes from
> /// your view to other parts of your SwiftUI interface.
> ///
> /// Implement this method if changes to your view might affect other parts
> /// of your app. In your implementation, create a custom Swift instance that
> /// can communicate with other parts of your interface. For example, you
> /// might provide an instance that binds its variables to SwiftUI
> /// properties, causing the two to remain synchronized. If your view doesn't
> /// interact with other parts of your app, providing a coordinator is
> /// unnecessary.
> ///
> /// SwiftUI calls this method before calling the
> /// ``UIViewRepresentable/makeUIView(context:)`` method. The system provides
> /// your coordinator either directly or as part of a context structure when
> /// calling the other methods of your representable instance.
> public func makeCoordinator() -> Self.Coordinator
16001,16077c14873,14875
< /// A type that represents part of your app's user interface and provides
< /// modifiers that you use to configure views.
< ///
< /// You create custom views by declaring types that conform to the ``View``
< /// protocol. Implement the required ``View/body-swift.property`` computed
< /// property to provide the content for your custom view.
< ///
< /// struct MyView: View {
< /// var body: some View {
< /// Text("Hello, World!")
< /// }
< /// }
< ///
< /// Assemble the view's body by combining one or more of the primitive views
< /// provided by SwiftUI, like the ``Text`` instance in the example above, plus
< /// other custom views that you define, into a hierarchy of views.
< ///
< /// The ``View`` protocol provides a large set of modifiers, defined as protocol
< /// methods with default implementations, that you use to position and configure
< /// views in the layout of your app. Modifiers typically work by wrapping the
< /// view instance on which you call them in another view with the specified
< /// characteristics. For example, adding the ``View/opacity(_:)`` modifier to a
< /// text view returns a new view with some amount of transparency:
< ///
< /// Text("Hello, World!")
< /// .opacity(0.5) // Display partially transparent text.
< ///
< /// The effects of a modifier typically propagate to any child views that don't
< /// explicitly override the modifier. For example, a ``VStack`` instance on its
< /// own acts only to vertically stack other views, and has no text to display.
< /// Therefore, a ``View/font(_:)`` modifier that you apply to the stack has no
< /// effect on the stack itself. Yet the font modifier does apply to any of the
< /// stack's child views, some of which might display text. On the other hand,
< /// you can locally override the stack's modifier by adding another to a
< /// specific child view:
< ///
< /// VStack {
< /// Text("Title")
< /// .font(.headline) // Override the font of this one view.
< /// Text("First body line.")
< /// Text("Second body line.")
< /// }
< /// .font(.body) // Set a default for text in the stack.
< ///
< /// You commonly chain modifiers, each wrapping the result of the previous one.
< /// For example, you can wrap a text view in an invisible box with a given width
< /// using the ``View/frame(width:height:alignment:)`` modifier to influence its
< /// layout, and then use the ``View/border(_:width:)`` modifier to draw an
< /// outline around that:
< ///
< /// Text("Title")
< /// .frame(width: 100)
< /// .border(Color.gray)
< ///
< /// The order in which you apply modifiers matters. For example, the border that
< /// results from the above code outlines the full width of the frame.
< ///
< /// ![A screenshot of a text view displaying the string "Title", outlined by a
< /// gray rectangle that's wider than the string it encloses, leaving empty space
< /// inside the rectangle on either side of the string. A caption reads, "Apply
< /// the frame first."](SwiftUI-View-1.png)
< ///
< /// If you instead apply the border first, it outlines the text view, which
< /// never takes more space than it needs to render its contents.
< ///
< /// Text("Title")
< /// .border(Color.gray) // Apply the border first this time.
< /// .frame(width: 100)
< ///
< /// Wrapping that view in another invisible one with a fixed 100 point width
< /// affects the layout of the composite view, but has no effect on the border.
< ///
< /// ![A screenshot of a text view displaying the string "Title", outlined by a
< /// gray rectangle that hugs the text. A caption reads, "Apply the border
< /// first."](SwiftUI-View-2.png)
< @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
< public protocol View {
---
> @available(iOS 13.0, tvOS 13.0, watchOS 6.0, *)
> @available(OSX, unavailable)
> extension UIViewRepresentable {
16079c14877,14878
< /// The type of view representing the body of this view.
---
> /// Cleans up the presented UIKit view (and coordinator) in anticipation of
> /// their removal.
16081,16083c14880,14889
< /// When you create a custom view, Swift infers this type from your
< /// implementation of the required `body` property.
< associatedtype Body : View
---
> /// Use this method to perform additional clean-up work related to your
> /// custom view. For example, you might use this method to remove observers
> /// or update other parts of your SwiftUI interface.
> ///
> /// - Parameters:
> /// - uiView: Your custom view object.
> /// - coordinator: The custom coordinator instance you use to communicate
> /// changes back to SwiftUI. If you do not use a custom coordinator, the
> /// system provides a default instance.
> public static func dismantleUIView(_ uiView: Self.UIViewType, coordinator: Self.Coordinator)
16085,16086c14891,14892
< /// The content and behavior of the view.
< var body: Self.Body { get }
---
> /// Declares the content and behavior of this view.
> public var body: Never { get }
16089,16090c14895,14908
< @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
< extension View {
---
> /// Contextual information about the state of the system that you use to create
> /// and update your UIKit view.
> ///
> /// A ``UIViewRepresentableContext`` structure contains details about the
> /// current state of the system. When creating and updating your view, the
> /// system creates one of these structures and passes it to the appropriate
> /// method of your custom ``UIViewRepresentable`` instance. Use the information
> /// in this structure to configure your view. For example, use the provided
> /// environment values to configure the appearance of your view. Don't create
> /// this structure yourself.
> @available(iOS 13.0, tvOS 13.0, *)
> @available(OSX, unavailable)
> @available(watchOS, unavailable)
> public struct UIViewRepresentableContext<Representable> where Representable : UIViewRepresentable {
16092,16093c14910,14911
< /// Adds a condition for whether the view's view hierarchy is deletable.
< @inlinable public func deleteDisabled(_ isDisabled: Bool) -> some View
---
> /// The view's associated coordinator.
> public let coordinator: Representable.Coordinator
16095,16098c14913,14914
< }
<
< @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
< extension View {
---
> /// The current transaction.
> public var transaction: Transaction { get }
16100,16104c14916
< /// Sets the style for buttons within this view to a button style with a
< /// custom appearance and custom interaction behavior.
< ///
< /// To set a specific style for all button instances within a view, use the
< /// ``View/buttonStyle(_:)-66fbx`` modifier:
---
> /// The current environment.
16106,16112c14918,14920
< /// HStack {
< /// Button("Sign In", action: signIn)
< /// Button("Register", action: register)
< /// }
< /// .buttonStyle(BorderedButtonStyle())
< public func buttonStyle<S>(_ style: S) -> some View where S : PrimitiveButtonStyle
<
---
> /// Use the environment values to configure the state of your view when
> /// creating or updating it.
> public var environment: EnvironmentValues { get }
16116c14924
< extension View {
---
> @frozen public struct UnitPoint : Hashable {
16118,16129c14926
< /// Sets the style for buttons within this view to a button style with a
< /// custom appearance and standard interaction behavior.
< ///
< /// To set a specific style for all button instances within a view, use the
< /// ``View/buttonStyle(_:)-66fbx`` modifier:
< ///
< /// HStack {
< /// Button("Sign In", action: signIn)
< /// Button("Register", action: register)
< /// }
< /// .buttonStyle(BorderedButtonStyle())
< public func buttonStyle<S>(_ style: S) -> some View where S : ButtonStyle
---
> public var x: CGFloat
16131,16134c14928
< }
<
< @available(iOS 14.0, OSX 10.16, tvOS 14.0, watchOS 7.0, *)
< extension View {
---
> public var y: CGFloat
16136,16145c14930
< /// The default store used by `AppStorage` contained within the view.
< ///
< /// If unspecified, the default store for a view hierarchy is
< /// `UserDefaults.standard`, but can be set a to a custom one. For example,
< /// sharing defaults between an app and an extension can override the
< /// default store to one created with `UserDefaults.init(suiteName:_)`.
< ///
< /// - Parameter store: The user defaults to use as the default
< /// store for `AppStorage`.
< public func defaultAppStorage(_ store: UserDefaults) -> some View
---
> @inlinable public init()
16147,16150c14932
< }
<
< @available(iOS 14.0, OSX 10.16, tvOS 14.0, watchOS 7.0, *)
< extension View {
---
> @inlinable public init(x: CGFloat, y: CGFloat)
16152,16167c14934
< /// Adds help text to a view using a localized string that you provide.
< ///
< /// Adding help to a view configures the view's accessibility hint and
< /// its tooltip ("help tag") on macOS.
< ///
< /// For more information on using help tags, see [Help]
< /// (https://developer.apple.com/design/human-interface-guidelines/macos/user-interaction/help/)
< /// in the macOS Human Interface Guidelines.
< ///
< /// Button(action: composeMessage) {
< /// Image(systemName: "square.and.pencil")
< /// }
< /// .help("Compose a new message")
< ///
< /// - Parameter textKey: The key for the localized text to use as help.
< public func help(_ textKey: LocalizedStringKey) -> some View
---
> public static let zero: UnitPoint
16168a14936
> public static let center: UnitPoint
16170,16183c14938
< /// Adds help text to a view using a text view that you provide.
< ///
< /// Adding help to a view configures the view's accessibility hint and
< /// its tooltip ("help tag") on macOS.
< ///
< /// For more information on using help tags, see [Help]
< /// (https://developer.apple.com/design/human-interface-guidelines/macos/user-interaction/help/)
< /// in the macOS Human Interface Guidelines.
< ///
< /// Slider("Opacity", value: $selectedShape.opacity)
< /// .help(Text("Adjust the opacity of the selected \(selectedShape.name)"))
< ///
< /// - Parameter text: The Text view to use as help.
< public func help(_ text: Text) -> some View
---
> public static let leading: UnitPoint
16184a14940
> public static let trailing: UnitPoint
16186c14942,14954
< /// Adds help text to a view using a string that you provide.
---
> public static let top: UnitPoint
>
> public static let bottom: UnitPoint
>
> public static let topLeading: UnitPoint
>
> public static let topTrailing: UnitPoint
>
> public static let bottomLeading: UnitPoint
>
> public static let bottomTrailing: UnitPoint
>
> /// The hash value.
16188,16189c14956,14957
< /// Adding help to a view configures the view's accessibility hint and
< /// its tooltip ("help tag") on macOS.
---
> /// Hash values are not guaranteed to be equal across different executions of
> /// your program. Do not save hash values to use during a future execution.
16191,16193c14959,14964
< /// For more information on using help tags, see [Help]
< /// (https://developer.apple.com/design/human-interface-guidelines/macos/user-interaction/help/)
< /// in the macOS Human Interface Guidelines.
---
> /// - Important: `hashValue` is deprecated as a `Hashable` requirement. To
> /// conform to `Hashable`, implement the `hash(into:)` requirement instead.
> public var hashValue: Int { get }
>
> /// Hashes the essential components of this value by feeding them into the
> /// given hasher.
16195,16197c14966,14969
< /// Image(systemName: "pin.circle")
< /// .foregroundColor(pointOfInterest.tintColor)
< /// .help(pointOfInterest.name)
---
> /// Implement this method to conform to the `Hashable` protocol. The
> /// components used for hashing must be the same as the components compared
> /// in your type's `==` operator implementation. Call `hasher.combine(_:)`
> /// with each of these components.
16199,16200c14971,14976
< /// - Parameter text: The text to use as help.
< public func help<S>(_ text: S) -> some View where S : StringProtocol
---
> /// - Important: Never call `finalize()` on `hasher`. Doing so may become a
> /// compile-time error in the future.
> ///
> /// - Parameter hasher: The hasher to use when combining the components
> /// of this instance.
> public func hash(into hasher: inout Hasher)
16201a14978,14986
> /// Returns a Boolean value indicating whether two values are equal.
> ///
> /// Equality is the inverse of inequality. For any values `a` and `b`,
> /// `a == b` implies that `a != b` is `false`.
> ///
> /// - Parameters:
> /// - lhs: A value to compare.
> /// - rhs: Another value to compare.
> public static func == (a: UnitPoint, b: UnitPoint) -> Bool
16204,16205c14989,14990
< @available(iOS 14.0, OSX 10.16, tvOS 14.0, watchOS 7.0, *)
< extension View {
---
> @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
> extension UnitPoint : Animatable {
16207,16217c14992,14993
< /// Sets the style for labels within this view.
< ///
< /// Use this modifier to set a specific style for all labels within a view:
< ///
< /// VStack {
< /// Label("Fire", systemImage: "flame.fill")
< /// Label("Lightning", systemImage: "bolt.fill")
< /// }
< /// .labelStyle(MyCustomLabelStyle())
< ///
< public func labelStyle<S>(_ style: S) -> some View where S : LabelStyle
---
> /// The type defining the data to animate.
> public typealias AnimatableData = AnimatablePair<CGFloat, CGFloat>
16218a14995,14996
> /// The data to animate.
> public var animatableData: UnitPoint.AnimatableData
16221,16222c14999,15004
< @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
< extension View {
---
> /// A set of values that indicate the visual size available to the view.
> @available(iOS 13.0, *)
> @available(OSX, unavailable)
> @available(tvOS, unavailable)
> @available(watchOS, unavailable)
> public enum UserInterfaceSizeClass {
16224,16229c15006,15012
< /// Applies the given transaction mutation function to all transactions used
< /// within the view.
< ///
< /// Use this modifier on leaf views rather than container views. The
< /// transformation applies to all child views within this view; calling
< /// `transaction(_:)` on a container view can lead to unbounded scope.
---
> /// The compact size class.
> case compact
>
> /// The regular size class.
> case regular
>
> /// Returns a Boolean value indicating whether two values are equal.
16231,16232c15014,15015
< /// - Parameter transform: The transformation to apply to transactions
< /// within this view.
---
> /// Equality is the inverse of inequality. For any values `a` and `b`,
> /// `a == b` implies that `a != b` is `false`.
16234,16236c15017,15020
< /// - Returns: A view that wraps this view and applies `transformation` to
< /// all transactions used within the view.
< @inlinable public func transaction(_ transform: @escaping (inout Transaction) -> Void) -> some View
---
> /// - Parameters:
> /// - lhs: A value to compare.
> /// - rhs: Another value to compare.
> public static func == (a: UserInterfaceSizeClass, b: UserInterfaceSizeClass) -> Bool
16237a15022,15029
> /// The hash value.
> ///
> /// Hash values are not guaranteed to be equal across different executions of
> /// your program. Do not save hash values to use during a future execution.
> ///
> /// - Important: `hashValue` is deprecated as a `Hashable` requirement. To
> /// conform to `Hashable`, implement the `hash(into:)` requirement instead.
> public var hashValue: Int { get }
16239c15031,15032
< /// Applies the given animation to all animatable values within this view.
---
> /// Hashes the essential components of this value by feeding them into the
> /// given hasher.
16241,16243c15034,15037
< /// Use this modifier on leaf views rather than container views. The
< /// animation applies to all child views within this view; calling
< /// `animation(_:)` on a container view can lead to unbounded scope.
---
> /// Implement this method to conform to the `Hashable` protocol. The
> /// components used for hashing must be the same as the components compared
> /// in your type's `==` operator implementation. Call `hasher.combine(_:)`
> /// with each of these components.
16245,16246c15039,15040
< /// - Parameter animation: The animation to apply to animatable values
< /// within this view.
---
> /// - Important: Never call `finalize()` on `hasher`. Doing so may become a
> /// compile-time error in the future.
16248,16250c15042,15047
< /// - Returns: A view that wraps this view and applies `animation` to all
< /// animatable values used within the view.
< @inlinable public func animation(_ animation: Animation?) -> some View
---
> /// - Parameter hasher: The hasher to use when combining the components
> /// of this instance.
> public func hash(into hasher: inout Hasher)
> }
>
> extension UserInterfaceSizeClass {
16251a15049,15068
> /// Create a size class from its UIUserInterfaceSizeClass equivalent.
> @available(iOS 14.0, *)
> @available(OSX, unavailable)
> @available(tvOS, unavailable)
> @available(watchOS, unavailable)
> public init?(_ uiUserInterfaceSizeClass: UIUserInterfaceSizeClass)
> }
>
> @available(iOS 13.0, *)
> @available(OSX, unavailable)
> @available(tvOS, unavailable)
> @available(watchOS, unavailable)
> extension UserInterfaceSizeClass : Equatable {
> }
>
> @available(iOS 13.0, *)
> @available(OSX, unavailable)
> @available(tvOS, unavailable)
> @available(watchOS, unavailable)
> extension UserInterfaceSizeClass : Hashable {
16253a15071
> /// A view that arranges its children in a vertical line.
16255c15073
< extension View {
---
> @frozen public struct VStack<Content> : View where Content : View {
16257,16270c15075
< /// Masks this view using the alpha channel of the given view.
< ///
< /// Use `mask(_:)` when you want to apply the alpha (opacity) value of
< /// another view to the current view.
< ///
< /// This example shows an image masked by rectangle with a 10% opacity:
< ///
< /// Image(systemName: "envelope.badge.fill")
< /// .foregroundColor(Color.blue)
< /// .font(.system(size: 128, weight: .regular))
< /// .mask(Rectangle().opacity(0.1))
< ///
< /// ![A screenshot of a view masked by a rectangle with 10%
< /// opacity.](SwiftUI-View-mask.png)
---
> /// Creates an instance with the given spacing and horizontal alignment.
16272,16274c15077,15084
< /// - Parameter mask: The view whose alpha the rendering system applies to
< /// the specified view.
< @inlinable public func mask<Mask>(_ mask: Mask) -> some View where Mask : View
---
> /// - Parameters:
> /// - alignment: The guide for aligning the subviews in this stack. It has
> /// the same horizontal screen coordinate for all children.
> /// - spacing: The distance between adjacent subviews, or `nil` if you
> /// want the stack to choose a default distance for each pair of
> /// subviews.
> /// - content: A view builder that creates the content of this stack.
> @inlinable public init(alignment: HorizontalAlignment = .center, spacing: CGFloat? = nil, @ViewBuilder content: () -> Content)
16275a15086,15090
> /// The type of view representing the body of this view.
> ///
> /// When you create a custom view, Swift infers this type from your
> /// implementation of the required `body` property.
> public typealias Body = Never
16277a15093,15098
> /// A type that can serve as the animatable data of an animatable type.
> ///
> /// `VectorArithmetic` extends the `AdditiveArithmetic` protocol with scalar
> /// multiplication and a way to query the vector magnitude of the value. Use
> /// this type as the `animatableData` associated type of a type that conforms to
> /// the ``Animatable`` protocol.
16279,16287c15100
< extension View {
<
< /// Sets the environment value of the specified key path to the given value.
< @inlinable public func environment<V>(_ keyPath: WritableKeyPath<EnvironmentValues, V>, _ value: V) -> some View
<
< }
<
< @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 7.0, *)
< extension View {
---
> public protocol VectorArithmetic : AdditiveArithmetic {
16289,16291c15102,15103
< /// Sets the style for navigation views within this view.
< @available(watchOS 7.0, *)
< public func navigationViewStyle<S>(_ style: S) -> some View where S : NavigationViewStyle
---
> /// Multiplies each component of this value by the given value.
> mutating func scale(by rhs: Double)
16292a15105,15106
> /// Returns the dot-product of this vector arithmetic instance with itself.
> var magnitudeSquared: Double { get }
16295,16299c15109,15111
< @available(OSX 10.15, *)
< @available(iOS, unavailable)
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
< extension View {
---
> /// An alignment position along the horizontal axis.
> @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
> @frozen public struct VerticalAlignment : Equatable {
16301,16326c15113
< /// Sets the Touch Bar content to be shown in the Touch Bar when applicable.
< ///
< /// Use ``View/touchBar(_:)`` to provide a static set of views that are
< /// displayed by the Touch Bar when appropriate, depending on whether the
< /// view has focus.
< ///
< /// The example below provides Touch Bar content in-line, that creates the
< /// content the Touch Bar displays:
< ///
< /// func selectHearts() {/* ... */ }
< /// func selectClubs() { /* ... */ }
< /// func selectSpades() { /* ... */ }
< /// func selectDiamonds() { /* ... */ }
< ///
< /// TextField("TouchBar Demo", text: $placeholder)
< /// .frame(maxWidth: .infinity, maxHeight: .infinity)
< /// .focusable()
< /// .touchBar {
< /// Button("♥️ - Hearts", action: selectHearts)
< /// Button("♣️ - Clubs", action: selectClubs)
< /// Button("♠️ - Spades", action: selectSpades)
< /// Button("♦️ - Diamonds", action: selectDiamonds)
< /// }
< ///
< /// ![A Touch Bar that shows content you create by using a static collection
< /// of views as the content of the Touch Bar.](SwiftUI-touchbar-static.png)
---
> /// Creates an instance with the given identifier.
16328c15115
< /// - Parameter touchBar: A collection of views that the Touch Bar displays.
---
> /// Each instance needs a unique identifier.
16330,16335c15117,15119
< /// - Returns: A view that contains the Touch Bar content.
< @available(iOS, unavailable)
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
< public func touchBar<Content>(_ touchBar: TouchBar<Content>) -> some View where Content : View
<
---
> /// - Parameter id: An identifier that uniquely identifies the vertical
> /// alignment.
> public init(_ id: AlignmentID.Type)
16337,16359c15121
< /// Sets the content that the Touch Bar displays.
< ///
< /// Use `touchBar(_:)` when you need to dynamically construct items to show
< /// in the Touch Bar. The content is displayed by the Touch Bar when
< /// appropriate, depending on focus.
< ///
< /// In the example below, four buttons are added to a Touch Bar content
< /// struct and then added to the Touch Bar:
< ///
< /// let touchBarItems = TouchBar(id: "myBarItems") {
< /// Button("♣️", action: {})
< /// Button("♥️", action: {})
< /// Button("♠️", action: {})
< /// Button("♦️", action: {})
< /// }
< ///
< /// TextField("TouchBar Demo", text: $placeholder)
< /// .frame(maxWidth: .infinity, maxHeight: .infinity)
< /// .focusable()
< /// .touchBar(touchBarItems)
< ///
< /// ![A Touch Bar that shows content you create using a Touch Bar content
< /// structure.](SwiftUI-View-touchBar.png)
---
> /// Returns a Boolean value indicating whether two values are equal.
16361,16362c15123,15124
< /// - Parameter content: A collection of views to be displayed by the Touch
< /// Bar.
---
> /// Equality is the inverse of inequality. For any values `a` and `b`,
> /// `a == b` implies that `a != b` is `false`.
16364,16369c15126,15129
< /// - Returns: A view that contains the Touch Bar content.
< @available(iOS, unavailable)
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
< public func touchBar<Content>(@ViewBuilder content: () -> Content) -> some View where Content : View
<
---
> /// - Parameters:
> /// - lhs: A value to compare.
> /// - rhs: Another value to compare.
> public static func == (a: VerticalAlignment, b: VerticalAlignment) -> Bool
16373c15133
< extension View where Self : Equatable {
---
> extension VerticalAlignment {
16375,16377c15135,15148
< /// Prevents the view from updating its child view when its new value is the
< /// same as its old value.
< @inlinable public func equatable() -> EquatableView<Self>
---
> /// A guide marking the top edge of the view.
> public static let top: VerticalAlignment
>
> /// A guide marking the vertical center of the view.
> public static let center: VerticalAlignment
>
> /// A guide marking the bottom edge of the view.
> public static let bottom: VerticalAlignment
>
> /// A guide marking the topmost text baseline view.
> public static let firstTextBaseline: VerticalAlignment
>
> /// A guide marking the bottom-most text baseline in a view.
> public static let lastTextBaseline: VerticalAlignment
16380,16382c15151,15227
< @available(iOS 13.0, OSX 10.15, watchOS 6.0, *)
< @available(tvOS, unavailable)
< extension View {
---
> /// A type that represents part of your app's user interface and provides
> /// modifiers that you use to configure views.
> ///
> /// You create custom views by declaring types that conform to the ``View``
> /// protocol. Implement the required ``View/body-swift.property`` computed
> /// property to provide the content for your custom view.
> ///
> /// struct MyView: View {
> /// var body: some View {
> /// Text("Hello, World!")
> /// }
> /// }
> ///
> /// Assemble the view's body by combining one or more of the primitive views
> /// provided by SwiftUI, like the ``Text`` instance in the example above, plus
> /// other custom views that you define, into a hierarchy of views.
> ///
> /// The ``View`` protocol provides a large set of modifiers, defined as protocol
> /// methods with default implementations, that you use to position and configure
> /// views in the layout of your app. Modifiers typically work by wrapping the
> /// view instance on which you call them in another view with the specified
> /// characteristics. For example, adding the ``View/opacity(_:)`` modifier to a
> /// text view returns a new view with some amount of transparency:
> ///
> /// Text("Hello, World!")
> /// .opacity(0.5) // Display partially transparent text.
> ///
> /// The effects of a modifier typically propagate to any child views that don't
> /// explicitly override the modifier. For example, a ``VStack`` instance on its
> /// own acts only to vertically stack other views, and has no text to display.
> /// Therefore, a ``View/font(_:)`` modifier that you apply to the stack has no
> /// effect on the stack itself. Yet the font modifier does apply to any of the
> /// stack's child views, some of which might display text. On the other hand,
> /// you can locally override the stack's modifier by adding another to a
> /// specific child view:
> ///
> /// VStack {
> /// Text("Title")
> /// .font(.headline) // Override the font of this one view.
> /// Text("First body line.")
> /// Text("Second body line.")
> /// }
> /// .font(.body) // Set a default for text in the stack.
> ///
> /// You commonly chain modifiers, each wrapping the result of the previous one.
> /// For example, you can wrap a text view in an invisible box with a given width
> /// using the ``View/frame(width:height:alignment:)`` modifier to influence its
> /// layout, and then use the ``View/border(_:width:)`` modifier to draw an
> /// outline around that:
> ///
> /// Text("Title")
> /// .frame(width: 100)
> /// .border(Color.gray)
> ///
> /// The order in which you apply modifiers matters. For example, the border that
> /// results from the above code outlines the full width of the frame.
> ///
> /// ![A screenshot of a text view displaying the string "Title", outlined by a
> /// gray rectangle that's wider than the string it encloses, leaving empty space
> /// inside the rectangle on either side of the string. A caption reads, "Apply
> /// the frame first."](SwiftUI-View-1.png)
> ///
> /// If you instead apply the border first, it outlines the text view, which
> /// never takes more space than it needs to render its contents.
> ///
> /// Text("Title")
> /// .border(Color.gray) // Apply the border first this time.
> /// .frame(width: 100)
> ///
> /// Wrapping that view in another invisible one with a fixed 100 point width
> /// affects the layout of the composite view, but has no effect on the border.
> ///
> /// ![A screenshot of a text view displaying the string "Title", outlined by a
> /// gray rectangle that hugs the text. A caption reads, "Apply the border
> /// first."](SwiftUI-View-2.png)
> @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
> public protocol View {
16384,16385c15229,15233
< /// Adds an action to perform when this view recognizes a tap gesture.
< public func onTapGesture(count: Int = 1, perform action: @escaping () -> Void) -> some View
---
> /// The type of view representing the body of this view.
> ///
> /// When you create a custom view, Swift infers this type from your
> /// implementation of the required `body` property.
> associatedtype Body : View
16386a15235,15236
> /// The content and behavior of the view.
> var body: Self.Body { get }
16389c15239,15241
< @available(iOS 14.0, OSX 10.16, tvOS 14.0, watchOS 7.0, *)
---
> @available(iOS 13.0, OSX 10.15, *)
> @available(tvOS, unavailable)
> @available(watchOS, unavailable)
16392,16430c15244,15247
< /// Adds a modifier for this view that fires an action when a specific
< /// value changes.
< ///
< /// You can use `onChange` to trigger a side effect as the result of a
< /// value changing, such as an `Environment` key or a `Binding`.
< ///
< /// `onChange` is called on the main thread. Avoid performing long-running
< /// tasks on the main thread. If you need to perform a long-running task in
< /// response to `value` changing, you should dispatch to a background queue.
< ///
< /// The new value is passed into the closure. The previous value may be
< /// captured by the closure to compare it to the new value. For example, in
< /// the following code example, `PlayerView` passes both the old and new
< /// values to the model.
< ///
< /// struct PlayerView : View {
< /// var episode: Episode
< /// @State private var playState: PlayState
< ///
< /// var body: some View {
< /// VStack {
< /// Text(episode.title)
< /// Text(episode.showTitle)
< /// PlayButton(playState: $playState)
< /// }
< /// }
< /// .onChange(of: playState) { [playState] newState in
< /// model.playStateDidChange(from: playState, to: newState)
< /// }
< /// }
< ///
< /// - Parameters:
< /// - value: The value to check against when determining whether
< /// to run the closure.
< /// - action: A closure to run when the value changes.
< /// - newValue: The new value that failed the comparison check.
< ///
< /// - Returns: A view that fires an action when the specified value changes.
< @inlinable public func onChange<V>(of value: V, perform action: @escaping (V) -> Void) -> some View where V : Equatable
---
> /// Sets the style for date pickers within this view.
> @available(tvOS, unavailable)
> @available(watchOS, unavailable)
> public func datePickerStyle<S>(_ style: S) -> some View where S : DatePickerStyle
16437,16455c15254,15255
< /// Overrides the device for a preview.
< ///
< /// If you set the preview device to `nil`, as it is by default, Xcode
< /// automatically chooses an appropriate device based on your target.
< ///
< /// You can get a list of supported values, like "iPhone 11",
< /// "iPad Pro (11-inch)", and "Apple Watch Series 5 - 44mm" by using the
< /// `xcrun` command in the Terminal app:
< ///
< /// % xcrun simctl list devicetypes
< ///
< /// Additionally, the following values are supported for macOS platform
< /// development:
< /// - "Mac"
< /// - "Mac Catalyst"
< @inlinable public func previewDevice(_ value: PreviewDevice?) -> some View
<
<
< /// Overrides the size of the container for the preview.
---
> /// Presents a sheet using the given item as a data source
> /// for the sheet's content.
16457,16458c15257,15265
< /// The default value is ``PreviewLayout/device``.
< @inlinable public func previewLayout(_ value: PreviewLayout) -> some View
---
> /// - Parameters:
> /// - item: A binding to an optional source of truth for the sheet.
> /// When representing a non-`nil` item, the system uses `content` to
> /// create a sheet representation of the item.
> /// If the identity changes, the system dismisses a
> /// currently-presented sheet and replaces it with a new sheet.
> /// - onDismiss: A closure executed when the sheet dismisses.
> /// - content: A closure returning the content of the sheet.
> public func sheet<Item, Content>(item: Binding<Item?>, onDismiss: (() -> Void)? = nil, @ViewBuilder content: @escaping (Item) -> Content) -> some View where Item : Identifiable, Content : View
16461c15268
< /// Provides a user visible name shown in the editor.
---
> /// Presents a sheet when a given condition is true.
16463,16464c15270,15274
< /// The default value is `nil`.
< @inlinable public func previewDisplayName(_ value: String?) -> some View
---
> /// - Parameters:
> /// - isPresented: A binding to whether the sheet is presented.
> /// - onDismiss: A closure executed when the sheet dismisses.
> /// - content: A closure returning the content of the sheet.
> public func sheet<Content>(isPresented: Binding<Bool>, onDismiss: (() -> Void)? = nil, @ViewBuilder content: @escaping () -> Content) -> some View where Content : View
16467c15277,15278
< /// Declares a context for the preview.
---
> /// Presents a modal view that covers as much of the screen as
> /// possible using the given item as a data source for the sheet's content.
16469,16471c15280,15300
< /// - Parameter value: The context for the preview; the default is `nil`.
< @available(iOS 14.0, OSX 10.16, tvOS 14.0, watchOS 7.0, *)
< @inlinable public func previewContext<C>(_ value: C) -> some View where C : PreviewContext
---
> /// - Parameters:
> /// - item: A binding to an optional source of truth for the cover
> /// modal view. When representing a non-nil item, the system uses
> /// `content` to create a modal representation of the item.
> /// If the identity of `item` changes, the system will dismiss a
> /// currently-presented modal view and replace it by a new modal view.
> /// - onDismiss: A closure executed when the modal view dismisses.
> /// - content: A closure returning the content of the modal view.
> @available(OSX, unavailable)
> public func fullScreenCover<Item, Content>(item: Binding<Item?>, onDismiss: (() -> Void)? = nil, @ViewBuilder content: @escaping (Item) -> Content) -> some View where Item : Identifiable, Content : View
>
>
> /// Presents a modal view that covers as much of the screen as
> /// possible when a given condition is true.
> ///
> /// - Parameters:
> /// - isPresented: A binding to whether the modal view is presented.
> /// - onDismiss: A closure executed when the modal view dismisses.
> /// - content: A closure returning the content of the modal view.
> @available(OSX, unavailable)
> public func fullScreenCover<Content>(isPresented: Binding<Bool>, onDismiss: (() -> Void)? = nil, @ViewBuilder content: @escaping () -> Content) -> some View where Content : View
16475,16478c15304
< @available(OSX 10.15, *)
< @available(iOS, unavailable)
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
---
> @available(iOS 13.0, OSX 10.15, watchOS 6.0, tvOS 14.0, *)
16481,16494c15307,15308
< /// Adds an action to perform in response to the given selector.
< ///
< /// This view or one of the views it contains must be in focus in order
< /// for the action to trigger. Other actions for the same command
< /// on views *closer* to the view in focus take priority, potentially
< /// overriding this action.
< ///
< /// - Parameters:
< /// - selector: The selector to register for `action`.
< /// - action: The action to perform. If `action` is `nil`, `command`
< /// keeps its association with this view but doesn't trigger.
< ///
< /// - Returns: A view that triggers `action` when the `command` occurs.
< @available(iOS, unavailable)
---
> /// Adds an action to perform when this view recognizes a long press
> /// gesture.
16496,16497c15310
< @available(watchOS, unavailable)
< public func onCommand(_ selector: Selector, perform action: (() -> Void)?) -> some View
---
> public func onLongPressGesture(minimumDuration: Double = 0.5, maximumDistance: CGFloat = 10, pressing: ((Bool) -> Void)? = nil, perform action: @escaping () -> Void) -> some View
16498a15312,15314
> }
>
> extension View {
16500c15316
< /// Adds an action to perform in response to the system's Paste command.
---
> /// Sets whether to disable autocorrection for this view.
16502,16505c15318,15321
< /// Pass an array of uniform type identifiers to the `supportedContentTypes`
< /// parameter. Place the higher priority types closer to the beginning of
< /// the array. The pasteboard items that the `action` closure receives have
< /// the most preferred type out of all the types the source supports.
---
> /// Use `disableAutocorrection(_:)` when the effect of autocorrection would
> /// make it more difficult for the user to input information. The entry of
> /// proper names and street addresses are examples where autocorrection can
> /// negatively affect the user's ability complete a data entry task.
16507,16510c15323,15326
< /// For example, if your app can handle plain text and rich text, but you
< /// prefer rich text, place the rich text type first in the array. If rich
< /// text is available when the paste action occurs, the `action` closure
< /// passes that rich text along.
---
> /// In the example below configures a ``TextField`` with the `.default`
> /// keyboard. Disabling autocorrection allows the user to enter arbitrary
> /// text without the autocorrection system offering suggestions or
> /// attempting to override their input.
16512,16520c15328,15330
< /// - Parameters:
< /// - supportedContentTypes: The uniform type identifiers that describe the
< /// types of content this view can accept through a paste action.
< /// If the pasteboard doesn't contain any of the supported types, the
< /// paste command doesn't trigger.
< /// - payloadAction: The action to perform when the paste command
< /// triggers. The action closure's parameter contains items from the
< /// pasteboard with the types you specify in the `supportedContentTypes`
< /// parameter.
---
> /// TextField("1234 Main St.", text: $address)
> /// .keyboardType(.default)
> /// .disableAutocorrection(true)
16522,16526c15332,15334
< /// - Returns: A view that triggers `action` when a system paste command
< /// occurs.
< @available(OSX 10.16, *)
< @available(iOS, unavailable)
< @available(tvOS, unavailable)
---
> /// - Parameter enabled: A Boolean value that indicates whether
> /// autocorrection is disabled for this view.
> @available(iOS 13.0, OSX 10.15, tvOS 13.0, *)
16528c15336
< public func onPasteCommand(of supportedContentTypes: [UTType], perform payloadAction: @escaping ([NSItemProvider]) -> Void) -> some View
---
> public func disableAutocorrection(_ disable: Bool?) -> some View
16529a15338,15340
> }
>
> extension View {
16531,16542c15342
< /// Adds an action to perform in response to the system's Paste command with
< /// items that you validate.
< ///
< /// Pass an array of uniform type identifiers to the `supportedContentTypes`
< /// parameter. Place the higher priority types closer to the beginning of
< /// the array. The pasteboard items that the `validator` closure receives
< /// have the most preferred type out of all the types the source supports.
< ///
< /// For example, if your app can handle plain text and rich text, but you
< /// prefer rich text, place the rich text type first in the array. If rich
< /// text is available when the paste action occurs, the `validator` closure
< /// passes that rich text along.
---
> /// Sets the style for the index view within the current environment.
16544,16561c15344,15346
< /// - Parameters:
< /// - supportedContentTypes: The uniform type identifiers that describe the
< /// types of content this view can accept through a paste action.
< /// If the pasteboard doesn't contain any of the supported types, the
< /// paste command doesn't trigger.
< /// - validator: A handler that validates the command. This handler
< /// receives items from the pasteboard with the types you specify in the
< /// `supportedContentTypes`. Use this handler to decide whether
< /// the items are valid and preprocess them for the `action` closure.
< /// If you return `nil` instead, the paste command doesn't trigger.
< /// - payloadAction: The action to perform when the paste command
< /// triggers.
< ///
< /// - Returns: A view that triggers `action` when the system paste command
< /// is invoked, validating the paste command with `validator`.
< @available(OSX 10.16, *)
< @available(iOS, unavailable)
< @available(tvOS, unavailable)
---
> /// - Parameter style: The style to apply to this view.
> @available(iOS 14.0, tvOS 14.0, *)
> @available(OSX, unavailable)
16563c15348
< public func onPasteCommand<Payload>(of supportedContentTypes: [UTType], validator: @escaping ([NSItemProvider]) -> Payload?, perform payloadAction: @escaping (Payload) -> Void) -> some View
---
> public func indexViewStyle<S>(_ style: S) -> some View where S : IndexViewStyle
16564a15350,15353
> }
>
> @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
> extension View {
16566,16580c15355,15357
< /// Adds an action to perform in response to the system's Copy command.
< ///
< /// - Parameters:
< /// - payloadAction: An action closure returning the
< /// <doc://com.apple.documentation/documentation/Foundation/NSItemProvider> items that
< /// should be copied to the pasteboard when the copy command is
< /// triggered. If `action` is `nil`, the copy command is considered
< /// disabled.
< ///
< /// - Returns: A view that triggers `action` when a system copy command
< /// occurs.
< @available(iOS, unavailable)
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
< public func onCopyCommand(perform payloadAction: (() -> [NSItemProvider])?) -> some View
---
> /// Provides a closure that vends the drag representation to be used for a
> /// particular data element.
> @inlinable public func itemProvider(_ action: (() -> NSItemProvider?)?) -> some View
16581a15359,15362
> }
>
> @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
> extension View {
16583,16598c15364,15365
< /// Adds an action to perform in response to the system's Cut command.
< ///
< /// - Parameters:
< /// - payloadAction: An action closure that should delete the selected
< /// data and return
< /// <doc://com.apple.documentation/documentation/Foundation/NSItemProvider> items
< /// corresponding to that data, which should be written to the
< /// pasteboard. If `action` is `nil`, the cut command is considered
< /// disabled.
< ///
< /// - Returns: A view that triggers `action` when a system cut command
< /// occurs.
< @available(iOS, unavailable)
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
< public func onCutCommand(perform payloadAction: (() -> [NSItemProvider])?) -> some View
---
> /// Adds a condition for whether the view's view hierarchy is deletable.
> @inlinable public func deleteDisabled(_ isDisabled: Bool) -> some View
16602,16605c15369
< @available(iOS, unavailable)
< @available(OSX, introduced: 10.15, deprecated: 100000.0, message: "Provide `UTType`s as the `supportedContentTypes` instead.")
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
---
> @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
16608,16660c15372,15373
< /// Adds an action to perform in response to the system's
< /// Paste command.
< ///
< /// Pass an array of uniform type identifiers to the `supportedTypes`
< /// parameter. Place the higher priority types closer to the beginning of the
< /// array. The pasteboard items that the `action` closure receives have the
< /// most preferred type out of all the types the source supports.
< ///
< /// For example, if your app can handle plain text and rich text, but you
< /// prefer rich text, place the rich text type first in the array. If rich
< /// text is available when the paste action occurs, the `action` closure
< /// passes that rich text along.
< ///
< /// - Parameters:
< /// - supportedTypes: The uniform type identifiers that describe the
< /// types of content this view can accept through a paste action.
< /// If the pasteboard doesn't contain any of the supported types, the
< /// paste command doesn't trigger.
< /// - payloadAction: The action to perform when the paste command triggers.
< /// The action closure's parameter contains items from the pasteboard
< /// with the types you specify in the `supportedTypes` parameter.
< /// - Returns: A view that triggers `action` when a system paste command
< /// occurs.
< public func onPasteCommand(of supportedTypes: [String], perform payloadAction: @escaping ([NSItemProvider]) -> Void) -> some View
<
<
< /// Adds an action to perform in response to the system's
< /// Paste command with items that you validate.
< ///
< /// Pass an array of uniform type identifiers to the `supportedTypes`
< /// parameter. Place the higher priority types closer to the beginning of the
< /// array. The pasteboard items that the `validator` closure receives have the
< /// most preferred type out of all the types the source supports.
< ///
< /// For example, if your app can handle plain text and rich text, but you
< /// prefer rich text, place the rich text type first in the array. If rich
< /// text is available when the paste action occurs, the `validator` closure
< /// passes that rich text along.
< ///
< /// - Parameters:
< /// - supportedTypes: The uniform type identifiers that describe the
< /// types of content this view can accept through a paste action.
< /// If the pasteboard doesn't contain any of the supported types, the
< /// paste command doesn't trigger.
< /// - validator: A handler that validates the command. This handler
< /// receives items from the pasteboard with the types you specify in the
< /// `supportedTypes` parameter. Use this handler to decide whether
< /// the items are valid and preprocess them for the `action` closure.
< /// If you return `nil` instead, the paste command doesn't trigger.
< /// - payloadAction: The action to perform when the paste command triggers.
< /// - Returns: A view that triggers `action` when the system paste command
< /// is invoked, validating the paste command with `validator`.
< public func onPasteCommand<Payload>(of supportedTypes: [String], validator: @escaping ([NSItemProvider]) -> Payload?, perform payloadAction: @escaping (Payload) -> Void) -> some View
---
> /// Adds a condition for whether the view's view hierarchy is movable.
> @inlinable public func moveDisabled(_ isDisabled: Bool) -> some View
16687d15399
< @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
16690,16694c15402,15403
< /// Binds a view's identity to the given proxy value.
< ///
< /// When the proxy value specified by the `id` parameter changes, the
< /// identity of the view — for example, its state — is reset.
< @inlinable public func id<ID>(_ id: ID) -> some View where ID : Hashable
---
> /// Adds an accessibility action to this view.
> public func accessibilityAction(_ actionKind: AccessibilityActionKind = .default, _ handler: @escaping () -> Void) -> ModifiedContent<Self, AccessibilityAttachmentModifier>
16695a15405,15406
> /// Adds a custom accessibility action to the view and all subviews.
> public func accessibilityAction(named name: Text, _ handler: @escaping () -> Void) -> ModifiedContent<Self, AccessibilityAttachmentModifier>
16697a15409
> @available(iOS 14.0, OSX 10.16, tvOS 14.0, watchOS 7.0, *)
16700,16706c15412
< /// Sets the text content type for this view, which the system uses to
< /// offer suggestions while the user enters text on macOS.
< ///
< /// Use `textContentType(_:)` to set the content type for this view.
< ///
< /// This example configures the `TextField` as intended for entry of
< /// usernames:
---
> /// Sets the style for the tab view within the the current environment.
16708,16709c15414,15423
< /// TextField("billjames2@icloud.com", text: $emailAddress)
< /// .textContentType(.username)
---
> /// - Parameter style: The style to apply to this tab view.
> public func tabViewStyle<S>(_ style: S) -> some View where S : TabViewStyle
>
> }
>
> @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
> extension View {
>
> /// Sets the style for buttons within this view to a button style with a
> /// custom appearance and custom interaction behavior.
16710a15425,15426
> /// To set a specific style for all button instances within a view, use the
> /// ``View/buttonStyle(_:)-66fbx`` modifier:
16712,16719c15428,15433
< /// - Parameter textContentType: One of the content types available in the
< /// `NSTextContentType` enumeration that identify the semantic meaning
< /// expected for a text-entry area.
< @available(OSX 10.16, *)
< @available(iOS, unavailable)
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
< @inlinable public func textContentType(_ textContentType: NSTextContentType?) -> some View
---
> /// HStack {
> /// Button("Sign In", action: signIn)
> /// Button("Register", action: register)
> /// }
> /// .buttonStyle(BorderedButtonStyle())
> public func buttonStyle<S>(_ style: S) -> some View where S : PrimitiveButtonStyle
16726,16727c15440,15441
< /// Adds an action to perform when the specified preference key's value
< /// changes.
---
> /// Adds an action to perform when this view detects data emitted by the
> /// given publisher.
16730,16732c15444,15447
< /// - key: The key to monitor for value changes.
< /// - action: The action to perform when the value for `key` changes. The
< /// `action` closure passes the new value as its parameter.
---
> /// - publisher: The publisher to subscribe to.
> /// - action: The action to perform when an event is emitted by
> /// `publisher`. The event emitted by publisher is passed as a
> /// parameter to `action`.
16734,16736c15449,15456
< /// - Returns: A view that triggers `action` when the value for `key`
< /// changes.
< @inlinable public func onPreferenceChange<K>(_ key: K.Type = K.self, perform action: @escaping (K.Value) -> Void) -> some View where K : PreferenceKey, K.Value : Equatable
---
> /// - Returns: A view that triggers `action` when `publisher` emits an
> /// event.
> @inlinable public func onReceive<P>(_ publisher: P, perform action: @escaping (P.Output) -> Void) -> some View where P : Publisher, P.Failure == Never
>
> }
>
> @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
> extension View {
16737a15458,15459
> /// Applies a modifier to a view.
> @inlinable public func modifier<T>(_ modifier: T) -> ModifiedContent<Self, T>
16751,16752c15473
< /// Presents a sheet using the given item as a data source
< /// for the sheet's content.
---
> /// Adds an action to perform when this view appears.
16754,16762c15475,15479
< /// - Parameters:
< /// - item: A binding to an optional source of truth for the sheet.
< /// When representing a non-`nil` item, the system uses `content` to
< /// create a sheet representation of the item.
< /// If the identity changes, the system dismisses a
< /// currently-presented sheet and replaces it with a new sheet.
< /// - onDismiss: A closure executed when the sheet dismisses.
< /// - content: A closure returning the content of the sheet.
< public func sheet<Item, Content>(item: Binding<Item?>, onDismiss: (() -> Void)? = nil, @ViewBuilder content: @escaping (Item) -> Content) -> some View where Item : Identifiable, Content : View
---
> /// - Parameter action: The action to perform. If `action` is `nil`, the
> /// call has no effect.
> ///
> /// - Returns: A view that triggers `action` when this view appears.
> @inlinable public func onAppear(perform action: (() -> Void)? = nil) -> some View
16765c15482,15564
< /// Presents a sheet when a given condition is true.
---
> /// Adds an action to perform when this view disappears.
> ///
> /// - Parameter action: The action to perform. If `action` is `nil`, the
> /// call has no effect.
> ///
> /// - Returns: A view that triggers `action` when this view disappears.
> @inlinable public func onDisappear(perform action: (() -> Void)? = nil) -> some View
>
> }
>
> @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
> extension View where Self : Equatable {
>
> /// Prevents the view from updating its child view when its new value is the
> /// same as its old value.
> @inlinable public func equatable() -> EquatableView<Self>
> }
>
> @available(iOS 13.0, OSX 10.15, tvOS 14.0, *)
> @available(watchOS, introduced: 6.0, deprecated: 7.0)
> extension View {
>
> /// Adds a context menu to the view.
> ///
> /// Use contextual menus to add actions that change depending on the user's
> /// current focus and task.
> ///
> /// The following example creates a ``Text`` view with a contextual menu.
> /// Note that the actions invoked by the menu selection could be coded
> /// directly inside the button closures or, as shown below, invoked via
> /// function references.
> ///
> /// func selectHearts() {
> /// // Act on hearts selection.
> /// }
> /// func selectClubs() { ... }
> /// func selectSpades() { ... }
> /// func selectDiamonds() { ... }
> ///
> /// Text("Favorite Card Suit")
> /// .padding()
> /// .contextMenu {
> /// Button("♥️ - Hearts", action: selectHearts)
> /// Button("♣️ - Clubs", action: selectClubs)
> /// Button("♠️ - Spades", action: selectSpades)
> /// Button("♦️ - Diamonds", action: selectDiamonds)
> /// }
> ///
> /// ![A context menu showing four menu items.](SwiftUI-contextMenu.png)
> ///
> /// - Parameter menuItems: A `contextMenu` that contains one or more menu items.
> /// - Returns: A view that adds a contextual menu to this view.
> public func contextMenu<MenuItems>(@ViewBuilder menuItems: () -> MenuItems) -> some View where MenuItems : View
>
>
> /// Attaches a context menu and its children to the view.
> ///
> /// Use `contextMenu(_:)` to attach a contextual menu struct and its
> /// children to the view. This modifier allows for the contextual menu to be
> /// conditionally available by passing `nil` as the value for `contextMenu`.
> ///
> /// In the example below a ``ContextMenu`` that contains four menu items is
> /// created and is passed into the `contextMenu(_:)` modifier. The
> /// attachment of context menu is controlled by the Boolean value
> /// `shouldShowMenu` which is `true`, enabling the contextual menu.
> ///
> /// Note that the actions invoked by the menu selection could be coded
> /// directly inside the button closures or, as shown below, invoked via
> /// function references.
> ///
> /// func selectHearts() {
> /// // Act on hearts selection.
> /// }
> /// func selectClubs() { ... }
> /// func selectSpades() { ... }
> /// func selectDiamonds() { ... }
> ///
> /// let menuItems = ContextMenu {
> /// Button("♥️ - Hearts", action: selectHearts)
> /// Button("♣️ - Clubs", action: selectClubs)
> /// Button("♠️ - Spades", action: selectSpades)
> /// Button("♦️ - Diamonds", action: selectDiamonds)
> /// }
16767,16778c15566,15575
< /// - Parameters:
< /// - isPresented: A binding to whether the sheet is presented.
< /// - onDismiss: A closure executed when the sheet dismisses.
< /// - content: A closure returning the content of the sheet.
< public func sheet<Content>(isPresented: Binding<Bool>, onDismiss: (() -> Void)? = nil, @ViewBuilder content: @escaping () -> Content) -> some View where Content : View
<
< }
<
< @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
< extension View {
<
< /// Presents an alert to the user.
---
> /// struct ContextMenuMenuItems: View {
> /// private var shouldShowMenu = true
> /// var body: some View {
> /// VStack {
> /// Text("Favorite Card Suit")
> /// .padding()
> /// .contextMenu(shouldShowMenu ? menuItems : nil)
> /// }
> /// }
> /// }
16780,16790c15577,15578
< /// - Parameters:
< /// - item: A binding to an optional source of truth for the alert.
< /// When representing a non-`nil` item, the system uses `content` to
< /// create an alert representation of the item.
< /// If the identity changes, the system dismisses a
< /// currently-presented alert and replace it by a new alert.
< /// - content: A closure returning the alert to present.
< public func alert<Item>(item: Binding<Item?>, content: (Item) -> Alert) -> some View where Item : Identifiable
<
<
< /// Presents an alert to the user.
---
> /// - Parameter contextMenu: A context menu container for views that you
> /// present as menu items in a contextual menu.
16792,16795c15580,15581
< /// - Parameters:
< /// - isPresented: A binding to whether the alert should be shown.
< /// - content: A closure returning the alert to present.
< public func alert(isPresented: Binding<Bool>, content: () -> Alert) -> some View
---
> /// - Returns: A view that adds a contextual menu to this view.
> public func contextMenu<MenuItems>(_ contextMenu: ContextMenu<MenuItems>?) -> some View where MenuItems : View
16821,16834c15607,15608
< /// Applies a projection transformation to this view's rendered output.
< ///
< /// Use `projectionEffect(_:)` to apply a 3D transformation to the view.
< ///
< /// The example below rotates the text 30˚ around the `z` axis, which is the
< /// axis pointing out of the screen:
< ///
< /// // This transform represents a 30˚ rotation around the z axis.
< /// let transform = CATransform3DMakeRotation(
< /// -30 * (.pi / 180), 0.0, 0.0, 1.0)
< ///
< /// Text("Projection effects using transforms")
< /// .projectionEffect(.init(transform))
< /// .border(Color.gray)
---
> /// Sets the style for buttons within this view to a button style with a
> /// custom appearance and standard interaction behavior.
16836,16837c15610,15611
< /// ![A screenshot showing text rotated 30 degrees around the axis pointing
< /// out of the screen.](SwiftUI-View-projectionEffect.png)
---
> /// To set a specific style for all button instances within a view, use the
> /// ``View/buttonStyle(_:)-66fbx`` modifier:
16839,16840c15613,15625
< /// - Parameter transform: A ``ProjectionTransform`` to apply to the view.
< @inlinable public func projectionEffect(_ transform: ProjectionTransform) -> some View
---
> /// HStack {
> /// Button("Sign In", action: signIn)
> /// Button("Register", action: register)
> /// }
> /// .buttonStyle(BorderedButtonStyle())
> public func buttonStyle<S>(_ style: S) -> some View where S : ButtonStyle
>
> }
>
> @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
> extension View {
>
> @inlinable public func transformAnchorPreference<A, K>(key _: K.Type = K.self, value: Anchor<A>.Source, transform: @escaping (inout K.Value, Anchor<A>) -> Void) -> some View where K : PreferenceKey
16893,16899d15677
< /// Applies a modifier to a view.
< @inlinable public func modifier<T>(_ modifier: T) -> ModifiedContent<Self, T>
< }
<
< @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
< extension View {
<
16951,17134c15729
< @inlinable public func border<S>(_ content: S, width: CGFloat = 1) -> some View where S : ShapeStyle
<
< }
<
< @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
< extension View {
<
< /// Adds a condition for whether the view's view hierarchy is movable.
< @inlinable public func moveDisabled(_ isDisabled: Bool) -> some View
<
< }
<
< @available(OSX 10.15, tvOS 13.0, watchOS 6.0, *)
< @available(iOS, unavailable)
< extension View {
<
< /// Specifies if the view is focusable and, if so, adds an action to perform
< /// when the view comes into focus.
< ///
< /// - Parameters:
< /// - isFocusable: A Boolean value that indicates whether this view is
< /// focusable.
< /// - onFocusChange: A closure that's called whenever this view either gains
< /// or loses focus. The Boolean parameter to `onFocusChange` is `true` when
< /// the view is in focus; otherwise, it's `false`.
< ///
< /// - Returns: A view that sets whether a view is focusable, and triggers
< /// `onFocusChange` when the view gains or loses focus.
< public func focusable(_ isFocusable: Bool = true, onFocusChange: @escaping (Bool) -> Void = { _ in }) -> some View
<
< }
<
< @available(iOS 14.0, OSX 10.16, *)
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
< extension View {
<
< /// Defines the destination of a drag-and-drop operation that handles the
< /// dropped content with a closure that you specify.
< ///
< /// The drop destination is the same size and position as this view.
< ///
< /// - Parameters:
< /// - supportedContentTypes: The uniform type identifiers that describe the
< /// types of content this view can accept through drag and drop.
< /// If the drag and drop operation doesn't contain any of the supported
< /// types, then this drop destination doesn't activate and `isTargeted`
< /// doesn't update.
< /// - isTargeted: A binding that updates when a drag and drop operation
< /// enters or exits the drop target area. The binding's value is `true` when
< /// the cursor is inside the area, and `false` when the cursor is outside.
< /// - action: A closure that takes the dropped content and responds
< /// appropriately. The parameter to `action` contains the dropped
< /// items, with types specified by `supportedContentTypes`. Return `true`
< /// if the drop operation was successful; otherwise, return `false`.
< ///
< /// - Returns: A view that provides a drop destination for a drag
< /// operation of the specified types.
< public func onDrop(of supportedContentTypes: [UTType], isTargeted: Binding<Bool>?, perform action: @escaping ([NSItemProvider]) -> Bool) -> some View
<
<
< /// Defines the destination of a drag and drop operation that handles the
< /// dropped content with a closure that you specify.
< ///
< /// The drop destination is the same size and position as this view.
< ///
< /// - Parameters:
< /// - supportedContentTypes: The uniform type identifiers that describe
< /// the types of content this view can accept through drag and drop.
< /// If the drag and drop operation doesn't contain any of the supported
< /// types, then this drop destination doesn't activate and `isTargeted`
< /// doesn't update.
< /// - isTargeted: A binding that updates when a drag and drop operation
< /// enters or exits the drop target area. The binding's value is `true` when
< /// the cursor is inside the area, and `false` when the cursor is outside.
< /// - action: A closure that takes the dropped content and responds
< /// appropriately. The first parameter to `action` contains the dropped
< /// items, with types specified by `supportedContentTypes`. The second
< /// parameter contains the drop location in this view's coordinate
< /// space. Return `true` if the drop operation was successful;
< /// otherwise, return `false`.
< ///
< /// - Returns: A view that provides a drop destination for a drag
< /// operation of the specified types.
< public func onDrop(of supportedContentTypes: [UTType], isTargeted: Binding<Bool>?, perform action: @escaping ([NSItemProvider], CGPoint) -> Bool) -> some View
<
<
< /// Defines the destination of a drag and drop operation using behavior
< /// controlled by the delegate that you provide.
< ///
< /// The drop destination is the same size and position as this view.
< ///
< /// - Parameters:
< /// - supportedContentTypes: The uniform type identifiers that describe the
< /// types of content this view can accept through drag and drop.
< /// If the drag and drop operation doesn't contain any of the supported
< /// types, then this drop destination doesn't activate and `isTargeted`
< /// doesn't update.
< /// - delegate: A type that conforms to the ``DropDelegate`` protocol. You
< /// have comprehensive control over drop behavior when you use a
< /// delegate.
< ///
< /// - Returns: A view that provides a drop destination for a drag
< /// operation of the specified types.
< public func onDrop(of supportedContentTypes: [UTType], delegate: DropDelegate) -> some View
<
< }
<
< @available(iOS, introduced: 13.4, deprecated: 100000.0, message: "Provide `UTType`s as the `supportedContentTypes` instead.")
< @available(OSX, introduced: 10.15, deprecated: 100000.0, message: "Provide `UTType`s as the `supportedContentTypes` instead.")
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
< extension View {
<
< /// Defines the destination for a drag and drop operation, using the same
< /// size and position as this view, handling dropped content with the given
< /// closure.
< ///
< /// - Parameters:
< /// - supportedTypes: The uniform type identifiers that describe the
< /// types of content this view can accept through drag and drop.
< /// If the drag and drop operation doesn't contain any of the supported
< /// types, then this drop destination doesn't activate and `isTargeted`
< /// doesn't update.
< /// - isTargeted: A binding that updates when a drag and drop operation
< /// enters or exits the drop target area. The binding's value is `true`
< /// when the cursor is inside the area, and `false` when the cursor is
< /// outside.
< /// - action: A closure that takes the dropped content and responds
< /// appropriately. The parameter to `action` contains the dropped
< /// items, with types specified by `supportedTypes`. Return `true`
< /// if the drop operation was successful; otherwise, return `false`.
< /// - Returns: A view that provides a drop destination for a drag
< /// operation of the specified types.
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
< public func onDrop(of supportedTypes: [String], isTargeted: Binding<Bool>?, perform action: @escaping ([NSItemProvider]) -> Bool) -> some View
<
<
< /// Defines the destination for a drag and drop operation with the same size
< /// and position as this view, handling dropped content and the drop
< /// location with the given closure.
< ///
< /// - Parameters:
< /// - supportedTypes: The uniform type identifiers that describe the
< /// types of content this view can accept through drag and drop.
< /// If the drag and drop operation doesn't contain any of the supported
< /// types, then this drop destination doesn't activate and `isTargeted`
< /// doesn't update.
< /// - isTargeted: A binding that updates when a drag and drop operation
< /// enters or exits the drop target area. The binding's value is `true`
< /// when the cursor is inside the area, and `false` when the cursor is
< /// outside.
< /// - action: A closure that takes the dropped content and responds
< /// appropriately. The first parameter to `action` contains the dropped
< /// items, with types specified by `supportedTypes`. The second
< /// parameter contains the drop location in this view's coordinate
< /// space. Return `true` if the drop operation was successful;
< /// otherwise, return `false`.
< /// - Returns: A view that provides a drop destination for a drag
< /// operation of the specified types.
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
< public func onDrop(of supportedTypes: [String], isTargeted: Binding<Bool>?, perform action: @escaping ([NSItemProvider], CGPoint) -> Bool) -> some View
<
<
< /// Defines the destination for a drag and drop operation with the same size
< /// and position as this view, with behavior controlled by the given
< /// delegate.
< ///
< /// - Parameters:
< /// - supportedTypes: The uniform type identifiers that describe the
< /// types of content this view can accept through drag and drop.
< /// If the drag and drop operation doesn't contain any of the supported
< /// types, then this drop destination doesn't activate and `isTargeted`
< /// doesn't update.
< /// - delegate: A type that conforms to the `DropDelegate` protocol. You
< /// have comprehensive control over drop behavior when you use a
< /// delegate.
< /// - Returns: A view that provides a drop destination for a drag
< /// operation of the specified types.
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
< public func onDrop(of supportedTypes: [String], delegate: DropDelegate) -> some View
---
> @inlinable public func border<S>(_ content: S, width: CGFloat = 1) -> some View where S : ShapeStyle
17252a15848,15945
> /// Fixes this view at its ideal size in the specified dimensions.
> ///
> /// This function behaves like ``View/fixedSize()``, except with
> /// `fixedSize(horizontal:vertical:)` the fixing of the axes can be
> /// optionally specified in one or both dimensions. For example, if you
> /// horizontally fix a text view before wrapping it in the frame view,
> /// you're telling the text view to maintain its ideal _width_. The view
> /// calculates this to be the space needed to represent the entire string.
> ///
> /// Text("A single line of text, too long to fit in a box.")
> /// .fixedSize(horizontal: true, vertical: false)
> /// .frame(width: 200, height: 200)
> /// .border(Color.gray)
> ///
> /// This can result in the view exceeding the parent's bounds, which may or
> /// may not be the effect you want.
> ///
> /// ![A screenshot showing a text view exceeding the bounds of its
> /// parent.](SwiftUI-View-fixedSize-3.png)
> ///
> /// - Parameters:
> /// - horizontal: A Boolean value that indicates whether to fix the width
> /// of the view.
> /// - vertical: A Boolean value that indicates whether to fix the height
> /// of the view.
> ///
> /// - Returns: A view that fixes this view at its ideal size in the
> /// dimensions specified by `horizontal` and `vertical`.
> @inlinable public func fixedSize(horizontal: Bool, vertical: Bool) -> some View
>
>
> /// Fixes this view at its ideal size.
> ///
> /// During the layout of the view hierarchy, each view proposes a size to
> /// each child view it contains. If the child view doesn't need a fixed size
> /// it can accept and conform to the size offered by the parent.
> ///
> /// For example, a ``Text`` view placed in an explicitly sized frame wraps
> /// and truncates its string to remain within its parent's bounds:
> ///
> /// Text("A single line of text, too long to fit in a box.")
> /// .frame(width: 200, height: 200)
> /// .border(Color.gray)
> ///
> /// ![A screenshot showing the text in a text view contained within its
> /// parent.](SwiftUI-View-fixedSize-1.png)
> ///
> /// The `fixedSize()` modifier can be used to create a view that maintains
> /// the *ideal size* of its children both dimensions:
> ///
> /// Text("A single line of text, too long to fit in a box.")
> /// .fixedSize()
> /// .frame(width: 200, height: 200)
> /// .border(Color.gray)
> ///
> /// This can result in the view exceeding the parent's bounds, which may or
> /// may not be the effect you want.
> ///
> /// ![A screenshot showing a text view exceeding the bounds of its
> /// parent.](SwiftUI-View-fixedSize-2.png)
> ///
> /// You can think of `fixedSize()` as the creation of a *counter proposal*
> /// to the view size proposed to a view by its parent. The ideal size of a
> /// view, and the specific effects of `fixedSize()` depends on the
> /// particular view and how you have configured it.
> ///
> /// To create a view that fixes the view's size in either the horizontal or
> /// vertical dimensions, see ``View/fixedSize(horizontal:vertical:)``.
> ///
> /// - Returns: A view that fixes this view at its ideal size.
> @inlinable public func fixedSize() -> some View
>
> }
>
> @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
> extension View {
>
> /// Sets the color of the foreground elements displayed by this view.
> ///
> /// - Parameter color: The foreground color to use when displaying this
> /// view.
> ///
> /// - Returns: A view that uses the foreground color you supply.
> @inlinable public func foregroundColor(_ color: Color?) -> some View
>
> }
>
> @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
> extension View {
>
> /// Sets the style for pickers within this view.
> public func pickerStyle<S>(_ style: S) -> some View where S : PickerStyle
>
> }
>
> @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
> extension View {
>
17339,17360d16031
< @available(OSX 10.16, *)
< @available(iOS, unavailable)
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
< extension View {
<
< /// Sets the style for menus within this view.
< ///
< /// To set a specific style for all menu instances within a view, use the
< /// `menuStyle(_:)` modifier:
< ///
< /// Menu("PDF") {
< /// Button("Open in Preview", action: openInPreview)
< /// Button("Save as PDF", action: safeAsPDF)
< /// Button("Save as PostScript", action: saveAsPostScript)
< /// }
< /// .menuStyle(ButtonMenuStyle())
< ///
< public func menuStyle<S>(_ style: S) -> some View where S : MenuStyle
<
< }
<
17414c16085
< @available(iOS 13.0, OSX 10.16, tvOS 13.0, watchOS 6.0, *)
---
> @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
17417c16088
< /// Sets the preferred color scheme for this presentation.
---
> /// Sets the view's horizontal alignment.
17419,17421c16090,16093
< /// The color scheme applies to the nearest enclosing presentation, such as
< /// a popover or window. Views may read the color scheme using the
< /// `colorScheme` environment value.
---
> /// Use `alignmentGuide(_:computeValue:)` to calculate specific offsets
> /// to reposition views in relationship to one another. You can return a
> /// constant or can use the ``ViewDimensions`` argument to the closure to
> /// calculate a return value.
17423,17424c16095,16096
< /// In the example below the presentation containing the ``VStack`` has its
< /// color scheme set to ``ColorScheme/dark``:
---
> /// In the example below, the ``HStack`` is offset by a constant of 50
> /// points to the right of center:
17427,17428c16099,16105
< /// Button(action: {}) {
< /// Text(" Button")
---
> /// Text("Today's Weather")
> /// .font(.title)
> /// .border(Color.gray)
> /// HStack {
> /// Text("🌧")
> /// Text("Rain & Thunderstorms")
> /// Text("⛈")
17429a16107,16143
> /// .alignmentGuide(HorizontalAlignment.center) { _ in 50 }
> /// .border(Color.gray)
> /// }
> /// .border(Color.gray)
> ///
> /// Changing the alignment of one view may have effects on surrounding
> /// views. Here the offset values inside a stack and its contained views is
> /// the difference of their absolute offsets.
> ///
> /// ![A view showing the two emoji offset from a text element using a
> /// horizontal alignment guide.](SwiftUI-View-HAlignmentGuide.png)
> ///
> /// - Parameters:
> /// - g: A ``HorizontalAlignment`` value at which to a base the offset.
> /// - computeValue: A closure that returns the offset value to apply to
> /// this view.
> ///
> /// - Returns: A view modified with respect to its horizontal alignment
> /// according to the computation performed in the method's closure.
> @inlinable public func alignmentGuide(_ g: HorizontalAlignment, computeValue: @escaping (ViewDimensions) -> CGFloat) -> some View
>
>
> /// Sets the view's vertical alignment.
> ///
> /// Use `alignmentGuide(_:computeValue:)` to calculate specific offsets
> /// to reposition views in relationship to one another. You can return a
> /// constant or can use the ``ViewDimensions`` argument to the closure to
> /// calculate a return value.
> ///
> /// In the example below, the weather emoji are offset 20 points from the
> /// vertical center of the ``HStack``.
> ///
> /// VStack {
> /// Text("Today's Weather")
> /// .font(.title)
> /// .border(Color.gray)
> ///
17431,17432c16145,16151
< /// Text(" Slider").accentColor(Color.green)
< /// Slider(value: $sliderValue, in: -100...100, step: 0.1)
---
> /// Text("🌧")
> /// .alignmentGuide(VerticalAlignment.center) { _ in -20 }
> /// Text("Rain & Thunderstorms")
> /// .border(Color.gray)
> /// Text("⛈")
> /// .alignmentGuide(VerticalAlignment.center) { _ in 20 }
> /// .border(Color.gray)
17434c16153
< /// }.preferredColorScheme(.dark)
---
> /// }
17436c16155,16157
< /// - Parameter colorScheme: The color scheme for this view.
---
> /// Changing the alignment of one view may have effects on surrounding
> /// views. Here the offset values inside a stack and its contained views is
> /// the difference of their absolute offsets.
17438,17439c16159,16169
< /// - Returns: A view that wraps this view and sets the color scheme.
< @inlinable public func preferredColorScheme(_ colorScheme: ColorScheme?) -> some View
---
> /// ![A view showing the two emoji offset from a text element using a
> /// vertical alignment guide.](SwiftUI-View-VAlignmentGuide.png)
> ///
> /// - Parameters:
> /// - g: A ``VerticalAlignment`` value at which to a base the offset.
> /// - computeValue: A closure that returns the offset value to apply to
> /// this view.
> ///
> /// - Returns: A view modified with respect to its vertical alignment
> /// according to the computation performed in the method's closure.
> @inlinable public func alignmentGuide(_ g: VerticalAlignment, computeValue: @escaping (ViewDimensions) -> CGFloat) -> some View
17465,17466c16195,16262
< /// Positions the center of this view at the specified coordinates in its
< /// parent's coordinate space.
---
> /// Positions the center of this view at the specified coordinates in its
> /// parent's coordinate space.
> ///
> /// Use the `position(x:y:)` modifier to place the center of a view at a
> /// specific coordinate in the parent view using an `x` and `y` offset.
> ///
> /// Text("Position by passing the x and y coordinates")
> /// .position(x: 175, y: 100)
> /// .border(Color.gray)
> ///
> /// - Parameters:
> /// - x: The x-coordinate at which to place the center of this view.
> /// - y: The y-coordinate at which to place the center of this view.
> ///
> /// - Returns: A view that fixes the center of this view at `x` and `y`.
> @inlinable public func position(x: CGFloat = 0, y: CGFloat = 0) -> some View
>
> }
>
> @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
> extension View {
>
> /// Changes the view's proposed area to extend outside the screen's safe
> /// areas.
> ///
> /// Use `edgesIgnoringSafeArea(_:)` to change the area proposed for this
> /// view so that — were the proposal accepted — this view could extend
> /// outside the safe area to the bounds of the screen for the specified
> /// edges.
> ///
> /// For example, you can propose that a text view ignore the safe area's top
> /// inset:
> ///
> /// VStack {
> /// Text("This text is outside of the top safe area.")
> /// .edgesIgnoringSafeArea([.top])
> /// .border(Color.purple)
> /// Text("This text is inside VStack.")
> /// .border(Color.yellow)
> /// }
> /// .border(Color.gray)
> ///
> /// ![A screenshot showing a view whose bounds exceed the safe area of the
> /// screen.](SwiftUI-View-edgesIgnoringSafeArea.png)
> ///
> /// Depending on the surrounding view hierarchy, SwiftUI may not honor an
> /// `edgesIgnoringSafeArea(_:)` request. This can happen, for example, if
> /// the view is inside a container that respects the screen's safe area. In
> /// that case you may need to apply `edgesIgnoringSafeArea(_:)` to the
> /// container instead.
> ///
> /// - Parameter edges: The set of the edges in which to expand the size
> /// requested for this view.
> ///
> /// - Returns: A view that may extend outside of the screen's safe area
> /// on the edges specified by `edges`.
> @inlinable public func edgesIgnoringSafeArea(_ edges: Edge.Set) -> some View
>
> }
>
> @available(iOS 14.0, *)
> @available(macCatalyst, unavailable)
> @available(OSX, unavailable)
> @available(tvOS, unavailable)
> @available(watchOS, unavailable)
> extension View {
>
> /// Presents a StoreKit overlay when a given condition is true.
17468,17469c16264,16266
< /// Use the `position(x:y:)` modifier to place the center of a view at a
< /// specific coordinate in the parent view using an `x` and `y` offset.
---
> /// You use `appStoreOverlay` to display an overlay that recommends another
> /// app. The overlay enables users to instantly view the other app’s page on
> /// the App Store.
17471,17473c16268,16270
< /// Text("Position by passing the x and y coordinates")
< /// .position(x: 175, y: 100)
< /// .border(Color.gray)
---
> /// When `isPresented` is true, the system will run `configuration` to
> /// determine how to configure the overlay. The overlay will automatically
> /// be presented over the current scene.
17476,17480c16273,16277
< /// - x: The x-coordinate at which to place the center of this view.
< /// - y: The y-coordinate at which to place the center of this view.
< ///
< /// - Returns: A view that fixes the center of this view at `x` and `y`.
< @inlinable public func position(x: CGFloat = 0, y: CGFloat = 0) -> some View
---
> /// - isPresented: A Binding to a boolean value indicating whether the
> /// overlay should be presented.
> /// - configuration: A closure providing the configuration of the overlay.
> /// - SeeAlso: SKOverlay.Configuration.
> public func appStoreOverlay(isPresented: Binding<Bool>, configuration: @escaping () -> SKOverlay.Configuration) -> some View
17487,17495c16284,16285
< /// Defines the content shape for hit testing.
< ///
< /// - Parameters:
< /// - shape: The hit testing shape for the view.
< /// - eoFill: A Boolean that indicates whether the shape is interpreted
< /// with the even-odd winding number rule.
< ///
< /// - Returns: A view that uses the given shape for hit testing.
< @inlinable public func contentShape<S>(_ shape: S, eoFill: Bool = false) -> some View where S : Shape
---
> /// Sets the environment value of the specified key path to the given value.
> @inlinable public func environment<V>(_ keyPath: WritableKeyPath<EnvironmentValues, V>, _ value: V) -> some View
17499,17501c16289
< @available(iOS 13.4, OSX 10.15, *)
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
---
> @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
17504,17505c16292
< /// Adds an action to perform when the user moves the pointer over or away
< /// from the view's frame.
---
> /// Controls the display order of overlapping views.
17507,17508c16294,16295
< /// Calling this method defines a region for detecting pointer movement with
< /// the size and position of this view.
---
> /// Use `zIndex(_:)` when you want to control the front-to-back ordering of
> /// views.
17510,17512c16297,16298
< /// - Parameter action: The action to perform whenever the pointer enters or
< /// exits this view's frame. If the pointer is in the view's frame, the
< /// `action` closure passes `true` as a parameter; otherwise, `false`.
---
> /// In this example there are two overlapping rotated rectangles. The
> /// frontmost is represented by the larger index value.
17514,17516c16300,16319
< /// - Returns: A view that triggers `action` when the pointer enters or
< /// exits this view's frame.
< @inlinable public func onHover(perform action: @escaping (Bool) -> Void) -> some View
---
> /// VStack {
> /// Rectangle()
> /// .fill(Color.yellow)
> /// .frame(width: 100, height: 100, alignment: .center)
> /// .zIndex(1) // Top layer.
> ///
> /// Rectangle()
> /// .fill(Color.red)
> /// .frame(width: 100, height: 100, alignment: .center)
> /// .rotationEffect(.degrees(45))
> /// // Here a zIndex of 0 is the default making
> /// // this the bottom layer.
> /// }
> ///
> /// ![A screenshot showing two overlapping rectangles. The frontmost view is
> /// represented by the larger zIndex value.](SwiftUI-View-zIndex.png)
> ///
> /// - Parameter value: A relative front-to-back ordering for this view; the
> /// default is `0`.
> @inlinable public func zIndex(_ value: Double) -> some View
17545a16349,16425
> extension View {
>
> /// Presents an action sheet using the given item as a data source for the
> /// sheet's content.
> ///
> /// - Parameters:
> /// - item: A binding to an optional source of truth for the action
> /// sheet. When representing a non-`nil` item, the system uses
> /// `content` to create an action sheet representation of the item.
> /// If the identity changes, the system dismisses a currently-presented
> /// action sheet and replace it with a new one.
> /// - content: A closure returning the action sheet to present.
> @available(iOS 13.0, tvOS 13.0, watchOS 6.0, *)
> @available(OSX, unavailable)
> public func actionSheet<T>(item: Binding<T?>, content: (T) -> ActionSheet) -> some View where T : Identifiable
>
>
> /// Presents an action sheet when a given condition is true.
> ///
> /// - Parameters:
> /// - isPresented: A binding to whether the action sheet should be
> /// shown.
> /// - content: A closure returning the `ActionSheet` to present.
> @available(iOS 13.0, tvOS 13.0, watchOS 6.0, *)
> @available(OSX, unavailable)
> public func actionSheet(isPresented: Binding<Bool>, content: () -> ActionSheet) -> some View
>
> }
>
> @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
> extension View {
>
> /// Sets the accent color for this view and the views it contains.
> ///
> /// Use `accentColor(_:)` when you want to apply a broad theme color to
> /// your app's user interface. Some styles of controls use the accent color
> /// as a default tint color.
> ///
> /// On macOS, customization of the accent color is only applied if the
> /// "Multicolor" accent color is selected in System Preferences.
> ///
> /// In the example below, the outer ``VStack`` contains two child views, the
> /// first is a ``VStack`` containing a default accented button. The second
> /// ``VStack`` contains a button and a slider both of which adopt the purple
> /// accent color of their containing view. Note that the ``Text`` element
> /// used as a label alongside the `Slider` retains its default color.
> ///
> /// VStack {
> /// VStack {
> /// Button(action: {}) {
> /// Text("Regular Button")
> /// }
> /// }.padding()
> /// VStack {
> /// Button(action: {}) {
> /// Text("Accented Button")
> /// }
> /// HStack {
> /// Text("Accented Slider")
> /// Slider(value: $sliderValue, in: -100...100, step: 0.1)
> /// }
> /// }.accentColor(.purple)
> /// }
> ///
> /// ![A VStack showing two child views: one VStack containing a default
> /// accented button, and a second VStack where the VStack has a purple
> /// accent color applied. The accent color modifies the enclosed button and
> /// slider, but not the color of a Text item used as a label for the
> /// slider.](SwiftUI-View-accentColor.png)
> ///
> /// - Parameter accentColor: The color to use as an accent color. If `nil`,
> /// the accent color continues to be inherited
> @available(iOS 13.0, OSX 10.16, tvOS 13.0, watchOS 6.0, *)
> @inlinable public func accentColor(_ accentColor: Color?) -> some View
>
> }
>
17574,17586d16453
< /// Sets the color of the foreground elements displayed by this view.
< ///
< /// - Parameter color: The foreground color to use when displaying this
< /// view.
< ///
< /// - Returns: A view that uses the foreground color you supply.
< @inlinable public func foregroundColor(_ color: Color?) -> some View
<
< }
<
< @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
< extension View {
<
17690,17701d16556
< /// Hides this view.
< ///
< /// Hidden views are invisible and can't receive or respond to interactions.
< ///
< /// - Returns: A hidden view.
< @inlinable public func hidden() -> some View
<
< }
<
< @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
< extension View {
<
17712,17823c16567,16576
< /// struct Blur: View {
< /// var body: some View {
< /// VStack {
< /// Text("This is some text.")
< /// .padding()
< /// Text("This is some blurry text.")
< /// .blur(radius: 2.0)
< /// }
< /// }
< /// }
< ///
< /// ![A screenshot showing the effect of applying gaussian blur effect to
< /// the rendering of a view.](SwiftUI-View-blurRadius.png)
< ///
< /// - Parameters:
< /// - radius: The radial size of the blur. A blur is more diffuse when its
< /// radius is large.
< /// - opaque: A Boolean value that indicates whether the blur renderer
< /// permits transparency in the blur output. Set to `true` to create an
< /// opaque blur, or set to `false` to permit transparency.
< @inlinable public func blur(radius: CGFloat, opaque: Bool = false) -> some View
<
< }
<
< @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
< extension View {
<
< /// Positions this view within an invisible frame with the specified size.
< ///
< /// Use this method to specify a fixed size for a view's width, height, or
< /// both. If you only specify one of the dimensions, the resulting view
< /// assumes this view's sizing behavior in the other dimension.
< ///
< /// For example, the following code lays out an ellipse in a fixed 200 by
< /// 100 frame. Because a shape always occupies the space offered to it by
< /// the layout system, the first ellipse is 200x100 points. The second
< /// ellipse is laid out in a frame with only a fixed height, so it occupies
< /// that height, and whatever width the layout system offers to its parent.
< ///
< /// VStack {
< /// Ellipse()
< /// .fill(Color.purple)
< /// .frame(width: 200, height: 100)
< /// Ellipse()
< /// .fill(Color.blue)
< /// .frame(height: 100)
< /// }
< ///
< /// ![A screenshot showing the effect of frame size options: a purple
< /// ellipse shows the effect of a fixed frame size, while a blue ellipse
< /// shows the effect of constraining a view in one
< /// dimension.](SwiftUI-View-frame-1.png)
< ///
< /// `The alignment` parameter specifies this view's alignment within the
< /// frame.
< ///
< /// Text("Hello world!")
< /// .frame(width: 200, height: 30, alignment: .topLeading)
< /// .border(Color.gray)
< ///
< /// In the example above, the text is positioned at the top, leading corner
< /// of the frame. If the text is taller than the frame, its bounds may
< /// extend beyond the bottom of the frame's bounds.
< ///
< /// ![A screenshot showing the effect of frame size options on a text view
< /// showing a fixed frame size with a specified
< /// alignment.](SwiftUI-View-frame-2.png)
< ///
< /// - Parameters:
< /// - width: A fixed width for the resulting view. If `width` is `nil`,
< /// the resulting view assumes this view's sizing behavior.
< /// - height: A fixed height for the resulting view. If `height` is `nil`,
< /// the resulting view assumes this view's sizing behavior.
< /// - alignment: The alignment of this view inside the resulting view.
< /// `alignment` applies if this view is smaller than the size given by
< /// the resulting frame.
< ///
< /// - Returns: A view with fixed dimensions of `width` and `height`, for the
< /// parameters that are non-`nil`.
< @inlinable public func frame(width: CGFloat? = nil, height: CGFloat? = nil, alignment: Alignment = .center) -> some View
<
<
< /// This function should never be used.
< ///
< /// It is merely a hack to catch the case where the user writes .frame(),
< /// which is nonsensical.
< @available(*, deprecated, message: "Please pass one or more parameters.")
< @inlinable public func frame() -> some View
<
< }
<
< @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
< extension View {
<
< /// Positions this view within an invisible frame having the specified size
< /// constraints.
< ///
< /// Always specify at least one size characteristic when calling this
< /// method. Pass `nil` or leave out a characteristic to indicate that the
< /// frame should adopt this view's sizing behavior, constrained by the other
< /// non-`nil` arguments.
< ///
< /// The size proposed to this view is the size proposed to the frame,
< /// limited by any constraints specified, and with any ideal dimensions
< /// specified replacing any corresponding unspecified dimensions in the
< /// proposal.
< ///
< /// If no minimum or maximum constraint is specified in a given dimension,
< /// the frame adopts the sizing behavior of its child in that dimension. If
< /// both constraints are specified in a dimension, the frame unconditionally
< /// adopts the size proposed for it, clamped to the constraints. Otherwise,
< /// the size of the frame in either dimension is:
---
> /// struct Blur: View {
> /// var body: some View {
> /// VStack {
> /// Text("This is some text.")
> /// .padding()
> /// Text("This is some blurry text.")
> /// .blur(radius: 2.0)
> /// }
> /// }
> /// }
17825,17831c16578,16579
< /// - If a minimum constraint is specified and the size proposed for the
< /// frame by the parent is less than the size of this view, the proposed
< /// size, clamped to that minimum.
< /// - If a maximum constraint is specified and the size proposed for the
< /// frame by the parent is greater than the size of this view, the
< /// proposed size, clamped to that maximum.
< /// - Otherwise, the size of this view.
---
> /// ![A screenshot showing the effect of applying gaussian blur effect to
> /// the rendering of a view.](SwiftUI-View-blurRadius.png)
17834,17846c16582,16587
< /// - minWidth: The minimum width of the resulting frame.
< /// - idealWidth: The ideal width of the resulting frame.
< /// - maxWidth: The maximum width of the resulting frame.
< /// - minHeight: The minimum height of the resulting frame.
< /// - idealHeight: The ideal height of the resulting frame.
< /// - maxHeight: The maximum height of the resulting frame.
< /// - alignment: The alignment of this view inside the resulting frame.
< /// Note that most alignment values have no apparent effect when the
< /// size of the frame happens to match that of this view.
< ///
< /// - Returns: A view with flexible dimensions given by the call's non-`nil`
< /// parameters.
< @inlinable public func frame(minWidth: CGFloat? = nil, idealWidth: CGFloat? = nil, maxWidth: CGFloat? = nil, minHeight: CGFloat? = nil, idealHeight: CGFloat? = nil, maxHeight: CGFloat? = nil, alignment: Alignment = .center) -> some View
---
> /// - radius: The radial size of the blur. A blur is more diffuse when its
> /// radius is large.
> /// - opaque: A Boolean value that indicates whether the blur renderer
> /// permits transparency in the blur output. Set to `true` to create an
> /// opaque blur, or set to `false` to permit transparency.
> @inlinable public func blur(radius: CGFloat, opaque: Bool = false) -> some View
17887,18000d16627
< /// Sets the view's horizontal alignment.
< ///
< /// Use `alignmentGuide(_:computeValue:)` to calculate specific offsets
< /// to reposition views in relationship to one another. You can return a
< /// constant or can use the ``ViewDimensions`` argument to the closure to
< /// calculate a return value.
< ///
< /// In the example below, the ``HStack`` is offset by a constant of 50
< /// points to the right of center:
< ///
< /// VStack {
< /// Text("Today's Weather")
< /// .font(.title)
< /// .border(Color.gray)
< /// HStack {
< /// Text("🌧")
< /// Text("Rain & Thunderstorms")
< /// Text("⛈")
< /// }
< /// .alignmentGuide(HorizontalAlignment.center) { _ in 50 }
< /// .border(Color.gray)
< /// }
< /// .border(Color.gray)
< ///
< /// Changing the alignment of one view may have effects on surrounding
< /// views. Here the offset values inside a stack and its contained views is
< /// the difference of their absolute offsets.
< ///
< /// ![A view showing the two emoji offset from a text element using a
< /// horizontal alignment guide.](SwiftUI-View-HAlignmentGuide.png)
< ///
< /// - Parameters:
< /// - g: A ``HorizontalAlignment`` value at which to a base the offset.
< /// - computeValue: A closure that returns the offset value to apply to
< /// this view.
< ///
< /// - Returns: A view modified with respect to its horizontal alignment
< /// according to the computation performed in the method's closure.
< @inlinable public func alignmentGuide(_ g: HorizontalAlignment, computeValue: @escaping (ViewDimensions) -> CGFloat) -> some View
<
<
< /// Sets the view's vertical alignment.
< ///
< /// Use `alignmentGuide(_:computeValue:)` to calculate specific offsets
< /// to reposition views in relationship to one another. You can return a
< /// constant or can use the ``ViewDimensions`` argument to the closure to
< /// calculate a return value.
< ///
< /// In the example below, the weather emoji are offset 20 points from the
< /// vertical center of the ``HStack``.
< ///
< /// VStack {
< /// Text("Today's Weather")
< /// .font(.title)
< /// .border(Color.gray)
< ///
< /// HStack {
< /// Text("🌧")
< /// .alignmentGuide(VerticalAlignment.center) { _ in -20 }
< /// Text("Rain & Thunderstorms")
< /// .border(Color.gray)
< /// Text("⛈")
< /// .alignmentGuide(VerticalAlignment.center) { _ in 20 }
< /// .border(Color.gray)
< /// }
< /// }
< ///
< /// Changing the alignment of one view may have effects on surrounding
< /// views. Here the offset values inside a stack and its contained views is
< /// the difference of their absolute offsets.
< ///
< /// ![A view showing the two emoji offset from a text element using a
< /// vertical alignment guide.](SwiftUI-View-VAlignmentGuide.png)
< ///
< /// - Parameters:
< /// - g: A ``VerticalAlignment`` value at which to a base the offset.
< /// - computeValue: A closure that returns the offset value to apply to
< /// this view.
< ///
< /// - Returns: A view modified with respect to its vertical alignment
< /// according to the computation performed in the method's closure.
< @inlinable public func alignmentGuide(_ g: VerticalAlignment, computeValue: @escaping (ViewDimensions) -> CGFloat) -> some View
<
< }
<
< extension View {
<
< /// Sets whether to disable autocorrection for this view.
< ///
< /// Use `disableAutocorrection(_:)` when the effect of autocorrection would
< /// make it more difficult for the user to input information. The entry of
< /// proper names and street addresses are examples where autocorrection can
< /// negatively affect the user's ability complete a data entry task.
< ///
< /// In the example below configures a ``TextField`` with the `.default`
< /// keyboard. Disabling autocorrection allows the user to enter arbitrary
< /// text without the autocorrection system offering suggestions or
< /// attempting to override their input.
< ///
< /// TextField("1234 Main St.", text: $address)
< /// .keyboardType(.default)
< /// .disableAutocorrection(true)
< ///
< /// - Parameter enabled: A Boolean value that indicates whether
< /// autocorrection is disabled for this view.
< @available(iOS 13.0, OSX 10.15, tvOS 13.0, *)
< @available(watchOS, unavailable)
< public func disableAutocorrection(_ disable: Bool?) -> some View
<
< }
<
< @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
< extension View {
<
18103,18197d16729
< @available(iOS 14.0, OSX 10.16, tvOS 14.0, watchOS 7.0, *)
< extension View {
<
< /// Configures the view's title for purposes of navigation.
< ///
< /// A view's navigation title is used to visually display
< /// the current navigation state of an interface.
< /// On iOS and watchOS, when a view is navigated to inside
< /// of a navigation view, that view's title is displayed
< /// in the navigation bar. On iPadOS, the primary destination's
< /// navigation title is reflected as the window's title in the
< /// App Switcher. Similarly on macOS, the primary destination's title
< /// is used as the window title in the titlebar, Windows menu
< /// and Mission Control.
< ///
< /// - Parameter title: The title to display.
< public func navigationTitle(_ title: Text) -> some View
<
<
< /// Configures the view's title for purposes of navigation,
< /// using a localized string.
< ///
< /// A view's navigation title is used to visually display
< /// the current navigation state of an interface.
< /// On iOS and watchOS, when a view is navigated to inside
< /// of a navigation view, that view's title is displayed
< /// in the navigation bar. On iPadOS, the primary destination's
< /// navigation title is reflected as the window's title in the
< /// App Switcher. Similarly on macOS, the primary destination's title
< /// is used as the window title in the titlebar, Windows menu
< /// and Mission Control.
< ///
< /// - Parameter titleKey: The key to a localized string to display.
< public func navigationTitle(_ titleKey: LocalizedStringKey) -> some View
<
<
< /// Configures the view's title for purposes of navigation, using a string.
< ///
< /// A view's navigation title is used to visually display
< /// the current navigation state of an interface.
< /// On iOS and watchOS, when a view is navigated to inside
< /// of a navigation view, that view's title is displayed
< /// in the navigation bar. On iPadOS, the primary destination's
< /// navigation title is reflected as the window's title in the
< /// App Switcher. Similarly on macOS, the primary destination's title
< /// is used as the window title in the titlebar, Windows menu
< /// and Mission Control.
< ///
< /// - Parameter title: The string to display.
< public func navigationTitle<S>(_ title: S) -> some View where S : StringProtocol
<
< }
<
< @available(macCatalyst 14.0, OSX 10.16, *)
< @available(iOS, unavailable)
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
< extension View {
<
< /// Configures the view's subtitle for purposes of navigation.
< ///
< /// A view's navigation subtitle is used to provide additional
< /// contextual information alongside the navigation title.
< /// On macOS, the primary destination's subtitle is displayed
< /// with the navigation title in the titlebar.
< ///
< /// - Parameter subtitle: The subtitle to display.
< public func navigationSubtitle(_ subtitle: Text) -> some View
<
<
< /// Configures the view's subtitle for purposes of navigation,
< /// using a localized string.
< ///
< /// A view's navigation subtitle is used to provide additional
< /// contextual information alongside the navigation title.
< /// On macOS, the primary destination's subtitle is displayed
< /// with the navigation title in the titlebar.
< ///
< /// - Parameter subtitleKey: The key to a localized string to display.
< public func navigationSubtitle(_ subtitleKey: LocalizedStringKey) -> some View
<
<
< /// Configures the view's subtitle for purposes of navigation,
< /// using a string.
< ///
< /// A view's navigation subtitle is used to provide additional
< /// contextual information alongside the navigation title.
< /// On macOS, the primary destination's subtitle is displayed
< /// with the navigation title in the titlebar.
< ///
< /// - Parameter title: The subtitle to display.
< public func navigationSubtitle<S>(_ subtitle: S) -> some View where S : StringProtocol
<
< }
<
18322,18323c16854,16884
< /// - Returns: A view that applies a hue rotation effect to this view.
< @inlinable public func hueRotation(_ angle: Angle) -> some View
---
> /// - Returns: A view that applies a hue rotation effect to this view.
> @inlinable public func hueRotation(_ angle: Angle) -> some View
>
> }
>
> @available(iOS 13.0, OSX 10.16, tvOS 13.0, watchOS 6.0, *)
> extension View {
>
> /// Sets the preferred color scheme for this presentation.
> ///
> /// The color scheme applies to the nearest enclosing presentation, such as
> /// a popover or window. Views may read the color scheme using the
> /// `colorScheme` environment value.
> ///
> /// In the example below the presentation containing the ``VStack`` has its
> /// color scheme set to ``ColorScheme/dark``:
> ///
> /// VStack {
> /// Button(action: {}) {
> /// Text(" Button")
> /// }
> /// HStack {
> /// Text(" Slider").accentColor(Color.green)
> /// Slider(value: $sliderValue, in: -100...100, step: 0.1)
> /// }
> /// }.preferredColorScheme(.dark)
> ///
> /// - Parameter colorScheme: The color scheme for this view.
> ///
> /// - Returns: A view that wraps this view and sets the color scheme.
> @inlinable public func preferredColorScheme(_ colorScheme: ColorScheme?) -> some View
18415a16977,16984
> /// Associates a transition with the view.
> @inlinable public func transition(_ t: AnyTransition) -> some View
>
> }
>
> @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
> extension View {
>
18471c17040
< @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 7.0, *)
---
> @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
18474c17043
< /// Sets the tab bar item associated with this view.
---
> /// Sets the unique tag value of this view.
18476,18477c17045,17048
< /// Use `tabItem(_:)` to configure a view as a tab bar item in a
< /// ``TabView``. The example below adds two views as tabs in a ``TabView``:
---
> /// Use `tag(_:)` to differentiate between a number of views for the purpose
> /// of selecting controls like pickers and lists. Tag values can be of any
> /// type that conforms to the <doc://com.apple.documentation/documentation/Swift/Hashable>
> /// protocol.
18479,18483c17050,17055
< /// struct View1: View {
< /// var body: some View {
< /// Text("View 1")
< /// }
< /// }
---
> /// In the example below, the ``ForEach`` loop in the ``Picker`` view
> /// builder iterates over the `Flavor` enumeration. It extracts the text raw
> /// value of each enumeration element for use as the row item label and uses
> /// the enumeration item itself as input to the `tag(_:)` modifier.
> /// The tag identifier can be any value that conforms to the
> /// <doc://com.apple.documentation/documentation/Swift/Hashable> protocol:
18485,18487c17057,17060
< /// struct View2: View {
< /// var body: some View {
< /// Text("View 2")
---
> /// struct FlavorPicker: View {
> /// enum Flavor: String, CaseIterable, Identifiable {
> /// var id: String { self.rawValue }
> /// case vanilla, chocolate, strawberry
18489d17061
< /// }
18491c17063
< /// struct TabItem: View {
---
> /// @State private var selectedFlavor: Flavor? = nil
18493,18504c17065,17068
< /// TabView {
< /// View1()
< /// .tabItem {
< /// Image(systemName: "list.dash")
< /// Text("Menu")
< /// }
< ///
< /// View2()
< /// .tabItem {
< /// Image(systemName: "square.and.pencil")
< /// Text("Order")
< /// }
---
> /// Picker("Flavor", selection: $selectedFlavor) {
> /// ForEach(Flavor.allCases) {
> /// Text($0.rawValue).tag($0)
> /// }
18509,18510c17073,17075
< /// ![A screenshot of a two views configured as tab items in a tab
< /// view.](SwiftUI-View-tabItem.png)
---
> /// - SeeAlso: `List`, `Picker`, `Hashable`
> /// - Parameter tag: A <doc://com.apple.documentation/documentation/Swift/Hashable> value
> /// to use as the view's tag.
18512,18513c17077,17078
< /// - Parameter label: The tab bar item to associate with this view.
< public func tabItem<V>(@ViewBuilder _ label: () -> V) -> some View where V : View
---
> /// - Returns: A view with the specified tag set.
> @inlinable public func tag<V>(_ tag: V) -> some View where V : Hashable
18552,18561c17117
< /// Transforms the environment value of the specified key path with the
< /// given function.
< @inlinable public func transformEnvironment<V>(_ keyPath: WritableKeyPath<EnvironmentValues, V>, transform: @escaping (inout V) -> Void) -> some View
<
< }
<
< @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
< extension View {
<
< /// Sets the style for toggles within this view.
---
> /// Places a custom background view behind a list row item.
18563,18564c17119,17120
< /// To set a specific style for all toggle instances within a view, use the
< /// ``View/toggleStyle(_:)`` modifier, as follows:
---
> /// Use `listRowBackground(_:)` to place a custom background view behind a
> /// list row item.
18566,18568c17122,17141
< /// VStack {
< /// Toggle("Vibrate on Ring", isOn: $vibrateOnRing)
< /// Toggle("Vibrate on Silent", isOn: $vibrateOnSilent)
---
> /// In the example below, the `Flavor` enumeration provides content for list
> /// items. The SwiftUI ``List`` builder iterates over the `Flavor`
> /// enumeration and extracts the raw value of each of its elements using the
> /// resulting text to create each list row item. After the list builder
> /// finishes, the `listRowBackground(_:)` modifier places the view you
> /// supply behind each of the list row items.
> ///
> /// struct ListRowBackground: View {
> ///
> /// enum Flavor: String, CaseIterable, Identifiable {
> /// var id: String { self.rawValue }
> /// case vanilla, chocolate, strawberry
> /// }
> ///
> /// var body: some View {
> /// List(Flavor.allCases, id: \.self) {
> /// Text($0.rawValue)
> /// }
> /// .listRowBackground(Image(systemName: "sparkles"))
> /// }
18570d17142
< /// .toggleStyle(SwitchToggleStyle())
18572,18573c17144,17148
< /// - Parameter style: The style to set.
< public func toggleStyle<S>(_ style: S) -> some View where S : ToggleStyle
---
> /// - Parameter view: The ``View`` to use as the background behind the list
> /// row view.
> ///
> /// - Returns: A list row view with `view` as its background view.
> @inlinable public func listRowBackground<V>(_ view: V?) -> some View where V : View
18605,18607c17180,17328
< /// > Note: Views backed by native platform views may not render into the
< /// image. Instead, they log a warning and display a placeholder image to
< /// highlight the error.
---
> /// > Note: Views backed by native platform views may not render into the
> /// image. Instead, they log a warning and display a placeholder image to
> /// highlight the error.
> ///
> /// ![A screenshot showing the effects on several stacks configured as a
> /// drawing group.](SwiftUI-View-drawingGroup.png)
> ///
> /// - Parameters:
> /// - opaque: A Boolean value that indicates whether the image is opaque.
> /// The default is `false`; if set to `true`, the alpha channel of the
> /// image must be `1`.
> /// - colorMode: One of the working color space and storage formats
> /// defined in ``ColorRenderingMode``. The default is
> /// ``ColorRenderingMode/NonLinear``.
> ///
> /// - Returns: A view that composites this view's contents into an offscreen
> /// image before display.
> public func drawingGroup(opaque: Bool = false, colorMode: ColorRenderingMode = .nonLinear) -> some View
>
> }
>
> @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
> extension View {
>
> /// Wraps this view in a compositing group.
> ///
> /// A compositing group makes compositing effects in this view's ancestor
> /// views, such as opacity and the blend mode, take effect before this view
> /// is rendered.
> ///
> /// Use `compositingGroup()` to apply effects to a parent view before
> /// applying effects to this view.
> ///
> /// In the example below the `compositingGroup()` modifier separates the
> /// application of effects into stages. It applies the ``View/opacity(_:)``
> /// effect to the VStack before the `blur(radius:)` effect is applied to the
> /// views inside the enclosed ``ZStack``. This limits the scope of the
> /// opacity change to the outermost view.
> ///
> /// VStack {
> /// ZStack {
> /// Text("CompositingGroup")
> /// .foregroundColor(.black)
> /// .padding(20)
> /// .background(Color.red)
> /// Text("CompositingGroup")
> /// .blur(radius: 2)
> /// }
> /// .font(.largeTitle)
> /// .compositingGroup()
> /// .opacity(0.9)
> /// }
> ///
> /// ![A view showing the effect of the compositingGroup modifier in applying
> /// compositing effects to parent views before child views are
> /// rendered.](SwiftUI-View-compositingGroup.png)
> ///
> /// - Returns: A view that wraps this view in a compositing group.
> @inlinable public func compositingGroup() -> some View
>
> }
>
> @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
> extension View {
>
> /// Overrides the device for a preview.
> ///
> /// If you set the preview device to `nil`, as it is by default, Xcode
> /// automatically chooses an appropriate device based on your target.
> ///
> /// You can get a list of supported values, like "iPhone 11",
> /// "iPad Pro (11-inch)", and "Apple Watch Series 5 - 44mm" by using the
> /// `xcrun` command in the Terminal app:
> ///
> /// % xcrun simctl list devicetypes
> ///
> /// Additionally, the following values are supported for macOS platform
> /// development:
> /// - "Mac"
> /// - "Mac Catalyst"
> @inlinable public func previewDevice(_ value: PreviewDevice?) -> some View
>
>
> /// Overrides the size of the container for the preview.
> ///
> /// The default value is ``PreviewLayout/device``.
> @inlinable public func previewLayout(_ value: PreviewLayout) -> some View
>
>
> /// Provides a user visible name shown in the editor.
> ///
> /// The default value is `nil`.
> @inlinable public func previewDisplayName(_ value: String?) -> some View
>
>
> /// Declares a context for the preview.
> ///
> /// - Parameter value: The context for the preview; the default is `nil`.
> @available(iOS 14.0, OSX 10.16, tvOS 14.0, watchOS 7.0, *)
> @inlinable public func previewContext<C>(_ value: C) -> some View where C : PreviewContext
>
> }
>
> @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
> extension View {
>
> @inlinable public func anchorPreference<A, K>(key _: K.Type = K.self, value: Anchor<A>.Source, transform: @escaping (Anchor<A>) -> K.Value) -> some View where K : PreferenceKey
>
> }
>
> @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
> extension View {
>
> /// Sets a clipping shape for this view.
> ///
> /// Use `clipShape(_:style:)` to clip the view to the provided shape. By
> /// applying a clipping shape to a view, you preserve the parts of the view
> /// covered by the shape, while eliminating other parts of the view. The
> /// clipping shape itself isn't visible.
> ///
> /// For example, this code applies a circular clipping shape to a `Text`
> /// view:
> ///
> /// Text("Clipped text in a circle")
> /// .frame(width: 175, height: 100)
> /// .foregroundColor(Color.white)
> /// .background(Color.black)
> /// .clipShape(Circle())
> ///
> /// The resulting view shows only the portion of the text that lies within
> /// the bounds of the circle.
> ///
> /// ![A screenshot of text clipped to the shape of a
> /// circle.](SwiftUI-View-clipShape.png)
> ///
> /// - Parameters:
> /// - shape: The clipping shape to use for this view. The `shape` fills
> /// the view's frame, while maintaining its aspect ratio.
> /// - style: The fill style to use when rasterizing `shape`.
> ///
> /// - Returns: A view that clips this view to `shape`, using `style` to
> /// define the shape's rasterization.
> @inlinable public func clipShape<S>(_ shape: S, style: FillStyle = FillStyle()) -> some View where S : Shape
>
>
> /// Clips this view to its bounding rectangular frame.
> ///
> /// Use the `clipped(antialiased:)` modifier to hide any content that
> /// extends beyond the layout bounds of the shape.
18609,18610c17330,17331
< /// ![A screenshot showing the effects on several stacks configured as a
< /// drawing group.](SwiftUI-View-drawingGroup.png)
---
> /// By default, a view's bounding frame is used only for layout, so any
> /// content that extends beyond the edges of the frame is still visible.
18612,18618c17333,17337
< /// - Parameters:
< /// - opaque: A Boolean value that indicates whether the image is opaque.
< /// The default is `false`; if set to `true`, the alpha channel of the
< /// image must be `1`.
< /// - colorMode: One of the working color space and storage formats
< /// defined in ``ColorRenderingMode``. The default is
< /// ``ColorRenderingMode/NonLinear``.
---
> /// Text("This long text string is clipped")
> /// .fixedSize()
> /// .frame(width: 175, height: 100)
> /// .clipped()
> /// .border(Color.gray)
18620,18622c17339,17347
< /// - Returns: A view that composites this view's contents into an offscreen
< /// image before display.
< public func drawingGroup(opaque: Bool = false, colorMode: ColorRenderingMode = .nonLinear) -> some View
---
> /// ![Screenshot showing text clipped to its
> /// frame.](SwiftUI-View-clipped.png)
> ///
> /// - Parameter antialiased: A Boolean value that indicates whether the
> /// rendering system applies smoothing to the edges of the clipping
> /// rectangle.
> ///
> /// - Returns: A view that clips this view to its bounding frame.
> @inlinable public func clipped(antialiased: Bool = false) -> some View
18624,18627d17348
< }
<
< @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
< extension View {
18629c17350
< /// Wraps this view in a compositing group.
---
> /// Clips this view to its bounding frame, with the specified corner radius.
18631,18633c17352,17355
< /// A compositing group makes compositing effects in this view's ancestor
< /// views, such as opacity and the blend mode, take effect before this view
< /// is rendered.
---
> /// By default, a view's bounding frame only affects its layout, so any
> /// content that extends beyond the edges of the frame remains visible. Use
> /// `cornerRadius(_:antialiased:)` to hide any content that extends beyond
> /// these edges while applying a corner radius.
18635,18636c17357
< /// Use `compositingGroup()` to apply effects to a parent view before
< /// applying effects to this view.
---
> /// The following code applies a corner radius of 25 to a text view:
18638,18642c17359,17363
< /// In the example below the `compositingGroup()` modifier separates the
< /// application of effects into stages. It applies the ``View/opacity(_:)``
< /// effect to the VStack before the `blur(radius:)` effect is applied to the
< /// views inside the enclosed ``ZStack``. This limits the scope of the
< /// opacity change to the outermost view.
---
> /// Text("Rounded Corners")
> /// .frame(width: 175, height: 75)
> /// .foregroundColor(Color.white)
> /// .background(Color.black)
> /// .cornerRadius(25)
18644,18656c17365,17366
< /// VStack {
< /// ZStack {
< /// Text("CompositingGroup")
< /// .foregroundColor(.black)
< /// .padding(20)
< /// .background(Color.red)
< /// Text("CompositingGroup")
< /// .blur(radius: 2)
< /// }
< /// .font(.largeTitle)
< /// .compositingGroup()
< /// .opacity(0.9)
< /// }
---
> /// ![A screenshot of a rectangle with rounded corners bounding a text
> /// view.](SwiftUI-View-cornerRadius.png)
18658,18660c17368,17370
< /// ![A view showing the effect of the compositingGroup modifier in applying
< /// compositing effects to parent views before child views are
< /// rendered.](SwiftUI-View-compositingGroup.png)
---
> /// - Parameter antialiased: A Boolean value that indicates whether the
> /// rendering system applies smoothing to the edges of the clipping
> /// rectangle.
18662,18663c17372,17374
< /// - Returns: A view that wraps this view in a compositing group.
< @inlinable public func compositingGroup() -> some View
---
> /// - Returns: A view that clips this view to its bounding frame with the
> /// specified corner radius.
> @inlinable public func cornerRadius(_ radius: CGFloat, antialiased: Bool = true) -> some View
18711,18741c17422
< /// Adds an action to perform when this view detects data emitted by the
< /// given publisher.
< ///
< /// - Parameters:
< /// - publisher: The publisher to subscribe to.
< /// - action: The action to perform when an event is emitted by
< /// `publisher`. The event emitted by publisher is passed as a
< /// parameter to `action`.
< ///
< /// - Returns: A view that triggers `action` when `publisher` emits an
< /// event.
< @inlinable public func onReceive<P>(_ publisher: P, perform action: @escaping (P.Output) -> Void) -> some View where P : Publisher, P.Failure == Never
<
< }
<
< @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
< extension View {
<
< /// Sets the unique tag value of this view.
< ///
< /// Use `tag(_:)` to differentiate between a number of views for the purpose
< /// of selecting controls like pickers and lists. Tag values can be of any
< /// type that conforms to the <doc://com.apple.documentation/documentation/Swift/Hashable>
< /// protocol.
< ///
< /// In the example below, the ``ForEach`` loop in the ``Picker`` view
< /// builder iterates over the `Flavor` enumeration. It extracts the text raw
< /// value of each enumeration element for use as the row item label and uses
< /// the enumeration item itself as input to the `tag(_:)` modifier.
< /// The tag identifier can be any value that conforms to the
< /// <doc://com.apple.documentation/documentation/Swift/Hashable> protocol:
---
> /// Sets the style for toggles within this view.
18743,18747c17424,17425
< /// struct FlavorPicker: View {
< /// enum Flavor: String, CaseIterable, Identifiable {
< /// var id: String { self.rawValue }
< /// case vanilla, chocolate, strawberry
< /// }
---
> /// To set a specific style for all toggle instances within a view, use the
> /// ``View/toggleStyle(_:)`` modifier, as follows:
18749,18756c17427,17429
< /// @State private var selectedFlavor: Flavor? = nil
< /// var body: some View {
< /// Picker("Flavor", selection: $selectedFlavor) {
< /// ForEach(Flavor.allCases) {
< /// Text($0.rawValue).tag($0)
< /// }
< /// }
< /// }
---
> /// VStack {
> /// Toggle("Vibrate on Ring", isOn: $vibrateOnRing)
> /// Toggle("Vibrate on Silent", isOn: $vibrateOnSilent)
18757a17431
> /// .toggleStyle(SwitchToggleStyle())
18759,18764c17433,17434
< /// - SeeAlso: `List`, `Picker`, `Hashable`
< /// - Parameter tag: A <doc://com.apple.documentation/documentation/Swift/Hashable> value
< /// to use as the view's tag.
< ///
< /// - Returns: A view with the specified tag set.
< @inlinable public func tag<V>(_ tag: V) -> some View where V : Hashable
---
> /// - Parameter style: The style to set.
> public func toggleStyle<S>(_ style: S) -> some View where S : ToggleStyle
18815,18920c17485
< /// relative to the available space.](SwiftUI-View-imageScale.png)
< ///
< /// - Parameter scale: One of the relative sizes provided by the image scale
< /// enumeration.
< @available(OSX 10.16, *)
< @inlinable public func imageScale(_ scale: Image.Scale) -> some View
<
<
< /// Sets the default font for text in this view.
< ///
< /// Use `font(_:)` to apply a specific font to all of the text in a view.
< ///
< /// The example below shows the effects of applying fonts to individual
< /// views and to view hierarchies. Font information flows down the view
< /// hierarchy as part of the environment, and remains in effect unless
< /// overridden at the level of an individual view or view container.
< ///
< /// Here, the outermost ``VStack`` applies a 16-point system font as a
< /// default font to views contained in that ``VStack``. Inside that stack,
< /// the example applies a ``Font/largeTitle`` font to just the first text
< /// view; this explicitly overrides the default. The remaining stack and the
< /// views contained with it continue to use the 16-point system font set by
< /// their containing view:
< ///
< /// VStack {
< /// Text("Font applied to a text view.")
< /// .font(.largeTitle)
< ///
< /// VStack {
< /// Text("These 2 text views have the same font")
< /// Text("applied to their parent hierarchy")
< /// }
< /// }
< /// .font(.system(size: 16, weight: .light, design: .default))
< ///
< /// ![A screenshot showing the application fonts to an individual text field
< /// and view hierarchy.](SwiftUI-view-font.png)
< ///
< /// - Parameter font: The default font to use in this view.
< ///
< /// - Returns: A view with the default font set to the value you supply.
< @inlinable public func font(_ font: Font?) -> some View
<
< }
<
< extension View {
<
< /// Adds an accessibility action to this view.
< public func accessibilityAction(_ actionKind: AccessibilityActionKind = .default, _ handler: @escaping () -> Void) -> ModifiedContent<Self, AccessibilityAttachmentModifier>
<
< /// Adds a custom accessibility action to the view and all subviews.
< public func accessibilityAction(named name: Text, _ handler: @escaping () -> Void) -> ModifiedContent<Self, AccessibilityAttachmentModifier>
< }
<
< @available(iOS 13.0, OSX 10.15, *)
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
< extension View {
<
< /// Presents a popover using the given item as a data source for the
< /// popover's content.
< ///
< /// - Parameters:
< /// - item: A binding to an optional source of truth for the popover.
< /// When representing a non-`nil` item, the system uses `content` to
< /// create a popover representation of the item.
< /// If the identity changes, the system dismisses a
< /// currently-presented popover and replace it by a new popover.
< /// - attachmentAnchor: The positioning anchor which defines where the
< /// popover is attached.
< /// - arrowEdge: The edge of the `attachmentAnchor` where the popover's
< /// arrow is located.
< /// - content: A closure returning the content of the popover.
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
< public func popover<Item, Content>(item: Binding<Item?>, attachmentAnchor: PopoverAttachmentAnchor = .rect(.bounds), arrowEdge: Edge = .top, @ViewBuilder content: @escaping (Item) -> Content) -> some View where Item : Identifiable, Content : View
<
<
< /// Presents a popover when a given condition is true.
< ///
< /// - Parameters:
< /// - isPresented: A binding to whether the popover is presented.
< /// - attachmentAnchor: The positioning anchor which defines where the
< /// popover is attached.
< /// - arrowEdge: The edge of the `attachmentAnchor` where the popover's
< /// arrow is located.
< /// - content: A closure returning the content of the popover.
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
< public func popover<Content>(isPresented: Binding<Bool>, attachmentAnchor: PopoverAttachmentAnchor = .rect(.bounds), arrowEdge: Edge = .top, @ViewBuilder content: @escaping () -> Content) -> some View where Content : View
<
< }
<
< @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
< extension View {
<
< /// Provides a closure that vends the drag representation to be used for a
< /// particular data element.
< @inlinable public func itemProvider(_ action: (() -> NSItemProvider?)?) -> some View
<
< }
<
< @available(iOS 14.0, OSX 10.16, tvOS 14.0, watchOS 7.0, *)
< extension View {
<
< /// Sets the style for the tab view within the the current environment.
---
> /// relative to the available space.](SwiftUI-View-imageScale.png)
18922,18923c17487,17490
< /// - Parameter style: The style to apply to this tab view.
< public func tabViewStyle<S>(_ style: S) -> some View where S : TabViewStyle
---
> /// - Parameter scale: One of the relative sizes provided by the image scale
> /// enumeration.
> @available(OSX 10.16, *)
> @inlinable public func imageScale(_ scale: Image.Scale) -> some View
18925,18929d17491
< }
<
< @available(iOS 13.0, OSX 10.15, tvOS 14.0, *)
< @available(watchOS, introduced: 6.0, deprecated: 7.0)
< extension View {
18931c17493
< /// Adds a context menu to the view.
---
> /// Sets the default font for text in this view.
18933,18934c17495
< /// Use contextual menus to add actions that change depending on the user's
< /// current focus and task.
---
> /// Use `font(_:)` to apply a specific font to all of the text in a view.
18936,18939c17497,17500
< /// The following example creates a ``Text`` view with a contextual menu.
< /// Note that the actions invoked by the menu selection could be coded
< /// directly inside the button closures or, as shown below, invoked via
< /// function references.
---
> /// The example below shows the effects of applying fonts to individual
> /// views and to view hierarchies. Font information flows down the view
> /// hierarchy as part of the environment, and remains in effect unless
> /// overridden at the level of an individual view or view container.
18941,18946c17502,17507
< /// func selectHearts() {
< /// // Act on hearts selection.
< /// }
< /// func selectClubs() { ... }
< /// func selectSpades() { ... }
< /// func selectDiamonds() { ... }
---
> /// Here, the outermost ``VStack`` applies a 16-point system font as a
> /// default font to views contained in that ``VStack``. Inside that stack,
> /// the example applies a ``Font/largeTitle`` font to just the first text
> /// view; this explicitly overrides the default. The remaining stack and the
> /// views contained with it continue to use the 16-point system font set by
> /// their containing view:
18948,18954c17509,17515
< /// Text("Favorite Card Suit")
< /// .padding()
< /// .contextMenu {
< /// Button("♥️ - Hearts", action: selectHearts)
< /// Button("♣️ - Clubs", action: selectClubs)
< /// Button("♠️ - Spades", action: selectSpades)
< /// Button("♦️ - Diamonds", action: selectDiamonds)
---
> /// VStack {
> /// Text("Font applied to a text view.")
> /// .font(.largeTitle)
> ///
> /// VStack {
> /// Text("These 2 text views have the same font")
> /// Text("applied to their parent hierarchy")
18955a17517,17518
> /// }
> /// .font(.system(size: 16, weight: .light, design: .default))
18957c17520,17521
< /// ![A context menu showing four menu items.](SwiftUI-contextMenu.png)
---
> /// ![A screenshot showing the application fonts to an individual text field
> /// and view hierarchy.](SwiftUI-view-font.png)
18959,18961c17523,17526
< /// - Parameter menuItems: A `contextMenu` that contains one or more menu items.
< /// - Returns: A view that adds a contextual menu to this view.
< public func contextMenu<MenuItems>(@ViewBuilder menuItems: () -> MenuItems) -> some View where MenuItems : View
---
> /// - Parameter font: The default font to use in this view.
> ///
> /// - Returns: A view with the default font set to the value you supply.
> @inlinable public func font(_ font: Font?) -> some View
18962a17528,17531
> }
>
> @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
> extension View {
18964,18968c17533
< /// Attaches a context menu and its children to the view.
< ///
< /// Use `contextMenu(_:)` to attach a contextual menu struct and its
< /// children to the view. This modifier allows for the contextual menu to be
< /// conditionally available by passing `nil` as the value for `contextMenu`.
---
> /// Positions this view within an invisible frame with the specified size.
18970,18973c17535,17537
< /// In the example below a ``ContextMenu`` that contains four menu items is
< /// created and is passed into the `contextMenu(_:)` modifier. The
< /// attachment of context menu is controlled by the Boolean value
< /// `shouldShowMenu` which is `true`, enabling the contextual menu.
---
> /// Use this method to specify a fixed size for a view's width, height, or
> /// both. If you only specify one of the dimensions, the resulting view
> /// assumes this view's sizing behavior in the other dimension.
18975,18977c17539,17543
< /// Note that the actions invoked by the menu selection could be coded
< /// directly inside the button closures or, as shown below, invoked via
< /// function references.
---
> /// For example, the following code lays out an ellipse in a fixed 200 by
> /// 100 frame. Because a shape always occupies the space offered to it by
> /// the layout system, the first ellipse is 200x100 points. The second
> /// ellipse is laid out in a frame with only a fixed height, so it occupies
> /// that height, and whatever width the layout system offers to its parent.
18979,18980c17545,17551
< /// func selectHearts() {
< /// // Act on hearts selection.
---
> /// VStack {
> /// Ellipse()
> /// .fill(Color.purple)
> /// .frame(width: 200, height: 100)
> /// Ellipse()
> /// .fill(Color.blue)
> /// .frame(height: 100)
18982,18984d17552
< /// func selectClubs() { ... }
< /// func selectSpades() { ... }
< /// func selectDiamonds() { ... }
18986,18991c17554,17557
< /// let menuItems = ContextMenu {
< /// Button("♥️ - Hearts", action: selectHearts)
< /// Button("♣️ - Clubs", action: selectClubs)
< /// Button("♠️ - Spades", action: selectSpades)
< /// Button("♦️ - Diamonds", action: selectDiamonds)
< /// }
---
> /// ![A screenshot showing the effect of frame size options: a purple
> /// ellipse shows the effect of a fixed frame size, while a blue ellipse
> /// shows the effect of constraining a view in one
> /// dimension.](SwiftUI-View-frame-1.png)
18993,19002c17559,17560
< /// struct ContextMenuMenuItems: View {
< /// private var shouldShowMenu = true
< /// var body: some View {
< /// VStack {
< /// Text("Favorite Card Suit")
< /// .padding()
< /// .contextMenu(shouldShowMenu ? menuItems : nil)
< /// }
< /// }
< /// }
---
> /// `The alignment` parameter specifies this view's alignment within the
> /// frame.
19004,19005c17562,17564
< /// - Parameter contextMenu: A context menu container for views that you
< /// present as menu items in a contextual menu.
---
> /// Text("Hello world!")
> /// .frame(width: 200, height: 30, alignment: .topLeading)
> /// .border(Color.gray)
19007,19008c17566,17593
< /// - Returns: A view that adds a contextual menu to this view.
< public func contextMenu<MenuItems>(_ contextMenu: ContextMenu<MenuItems>?) -> some View where MenuItems : View
---
> /// In the example above, the text is positioned at the top, leading corner
> /// of the frame. If the text is taller than the frame, its bounds may
> /// extend beyond the bottom of the frame's bounds.
> ///
> /// ![A screenshot showing the effect of frame size options on a text view
> /// showing a fixed frame size with a specified
> /// alignment.](SwiftUI-View-frame-2.png)
> ///
> /// - Parameters:
> /// - width: A fixed width for the resulting view. If `width` is `nil`,
> /// the resulting view assumes this view's sizing behavior.
> /// - height: A fixed height for the resulting view. If `height` is `nil`,
> /// the resulting view assumes this view's sizing behavior.
> /// - alignment: The alignment of this view inside the resulting view.
> /// `alignment` applies if this view is smaller than the size given by
> /// the resulting frame.
> ///
> /// - Returns: A view with fixed dimensions of `width` and `height`, for the
> /// parameters that are non-`nil`.
> @inlinable public func frame(width: CGFloat? = nil, height: CGFloat? = nil, alignment: Alignment = .center) -> some View
>
>
> /// This function should never be used.
> ///
> /// It is merely a hack to catch the case where the user writes .frame(),
> /// which is nonsensical.
> @available(*, deprecated, message: "Please pass one or more parameters.")
> @inlinable public func frame() -> some View
19015c17600,17601
< /// Fixes this view at its ideal size in the specified dimensions.
---
> /// Positions this view within an invisible frame having the specified size
> /// constraints.
19017,19022c17603,17606
< /// This function behaves like ``View/fixedSize()``, except with
< /// `fixedSize(horizontal:vertical:)` the fixing of the axes can be
< /// optionally specified in one or both dimensions. For example, if you
< /// horizontally fix a text view before wrapping it in the frame view,
< /// you're telling the text view to maintain its ideal _width_. The view
< /// calculates this to be the space needed to represent the entire string.
---
> /// Always specify at least one size characteristic when calling this
> /// method. Pass `nil` or leave out a characteristic to indicate that the
> /// frame should adopt this view's sizing behavior, constrained by the other
> /// non-`nil` arguments.
19024,19027c17608,17611
< /// Text("A single line of text, too long to fit in a box.")
< /// .fixedSize(horizontal: true, vertical: false)
< /// .frame(width: 200, height: 200)
< /// .border(Color.gray)
---
> /// The size proposed to this view is the size proposed to the frame,
> /// limited by any constraints specified, and with any ideal dimensions
> /// specified replacing any corresponding unspecified dimensions in the
> /// proposal.
19029,19030c17613,17617
< /// This can result in the view exceeding the parent's bounds, which may or
< /// may not be the effect you want.
---
> /// If no minimum or maximum constraint is specified in a given dimension,
> /// the frame adopts the sizing behavior of its child in that dimension. If
> /// both constraints are specified in a dimension, the frame unconditionally
> /// adopts the size proposed for it, clamped to the constraints. Otherwise,
> /// the size of the frame in either dimension is:
19032,19033c17619,17625
< /// ![A screenshot showing a text view exceeding the bounds of its
< /// parent.](SwiftUI-View-fixedSize-3.png)
---
> /// - If a minimum constraint is specified and the size proposed for the
> /// frame by the parent is less than the size of this view, the proposed
> /// size, clamped to that minimum.
> /// - If a maximum constraint is specified and the size proposed for the
> /// frame by the parent is greater than the size of this view, the
> /// proposed size, clamped to that maximum.
> /// - Otherwise, the size of this view.
19036,19039c17628,17636
< /// - horizontal: A Boolean value that indicates whether to fix the width
< /// of the view.
< /// - vertical: A Boolean value that indicates whether to fix the height
< /// of the view.
---
> /// - minWidth: The minimum width of the resulting frame.
> /// - idealWidth: The ideal width of the resulting frame.
> /// - maxWidth: The maximum width of the resulting frame.
> /// - minHeight: The minimum height of the resulting frame.
> /// - idealHeight: The ideal height of the resulting frame.
> /// - maxHeight: The maximum height of the resulting frame.
> /// - alignment: The alignment of this view inside the resulting frame.
> /// Note that most alignment values have no apparent effect when the
> /// size of the frame happens to match that of this view.
19041,19043c17638,17640
< /// - Returns: A view that fixes this view at its ideal size in the
< /// dimensions specified by `horizontal` and `vertical`.
< @inlinable public func fixedSize(horizontal: Bool, vertical: Bool) -> some View
---
> /// - Returns: A view with flexible dimensions given by the call's non-`nil`
> /// parameters.
> @inlinable public func frame(minWidth: CGFloat? = nil, idealWidth: CGFloat? = nil, maxWidth: CGFloat? = nil, minHeight: CGFloat? = nil, idealHeight: CGFloat? = nil, maxHeight: CGFloat? = nil, alignment: Alignment = .center) -> some View
19044a17642,17647
> }
>
> @available(iOS 14.0, OSX 10.16, *)
> @available(tvOS, unavailable)
> @available(watchOS, unavailable)
> extension View {
19046,19057c17649
< /// Fixes this view at its ideal size.
< ///
< /// During the layout of the view hierarchy, each view proposes a size to
< /// each child view it contains. If the child view doesn't need a fixed size
< /// it can accept and conform to the size offered by the parent.
< ///
< /// For example, a ``Text`` view placed in an explicitly sized frame wraps
< /// and truncates its string to remain within its parent's bounds:
< ///
< /// Text("A single line of text, too long to fit in a box.")
< /// .frame(width: 200, height: 200)
< /// .border(Color.gray)
---
> /// Sets the style for group boxes within this view.
19059,19060c17651,17659
< /// ![A screenshot showing the text in a text view contained within its
< /// parent.](SwiftUI-View-fixedSize-1.png)
---
> /// - Parameter style: The style to apply to boxes within this view.
> public func groupBoxStyle<S>(_ style: S) -> some View where S : GroupBoxStyle
>
> }
>
> @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 7.0, *)
> extension View {
>
> /// Sets the tab bar item associated with this view.
19062,19063c17661,17662
< /// The `fixedSize()` modifier can be used to create a view that maintains
< /// the *ideal size* of its children both dimensions:
---
> /// Use `tabItem(_:)` to configure a view as a tab bar item in a
> /// ``TabView``. The example below adds two views as tabs in a ``TabView``:
19065,19068c17664,17668
< /// Text("A single line of text, too long to fit in a box.")
< /// .fixedSize()
< /// .frame(width: 200, height: 200)
< /// .border(Color.gray)
---
> /// struct View1: View {
> /// var body: some View {
> /// Text("View 1")
> /// }
> /// }
19070,19071c17670,17674
< /// This can result in the view exceeding the parent's bounds, which may or
< /// may not be the effect you want.
---
> /// struct View2: View {
> /// var body: some View {
> /// Text("View 2")
> /// }
> /// }
19073,19074c17676,17683
< /// ![A screenshot showing a text view exceeding the bounds of its
< /// parent.](SwiftUI-View-fixedSize-2.png)
---
> /// struct TabItem: View {
> /// var body: some View {
> /// TabView {
> /// View1()
> /// .tabItem {
> /// Image(systemName: "list.dash")
> /// Text("Menu")
> /// }
19076,19079c17685,17692
< /// You can think of `fixedSize()` as the creation of a *counter proposal*
< /// to the view size proposed to a view by its parent. The ideal size of a
< /// view, and the specific effects of `fixedSize()` depends on the
< /// particular view and how you have configured it.
---
> /// View2()
> /// .tabItem {
> /// Image(systemName: "square.and.pencil")
> /// Text("Order")
> /// }
> /// }
> /// }
> /// }
19081,19082c17694,17695
< /// To create a view that fixes the view's size in either the horizontal or
< /// vertical dimensions, see ``View/fixedSize(horizontal:vertical:)``.
---
> /// ![A screenshot of a two views configured as tab items in a tab
> /// view.](SwiftUI-View-tabItem.png)
19084,19085c17697,17698
< /// - Returns: A view that fixes this view at its ideal size.
< @inlinable public func fixedSize() -> some View
---
> /// - Parameter label: The tab bar item to associate with this view.
> public func tabItem<V>(@ViewBuilder _ label: () -> V) -> some View where V : View
19089,19090c17702
< @available(iOS, unavailable)
< @available(OSX, introduced: 10.15, deprecated: 100000.0, message: "Use `menuStyle(_:)` instead.")
---
> @available(iOS 13.0, OSX 10.15, *)
19095,19096c17707,17723
< /// Sets the style for menu buttons within this view.
< public func menuButtonStyle<S>(_ style: S) -> some View where S : MenuButtonStyle
---
> /// Presents a popover using the given item as a data source for the
> /// popover's content.
> ///
> /// - Parameters:
> /// - item: A binding to an optional source of truth for the popover.
> /// When representing a non-`nil` item, the system uses `content` to
> /// create a popover representation of the item.
> /// If the identity changes, the system dismisses a
> /// currently-presented popover and replace it by a new popover.
> /// - attachmentAnchor: The positioning anchor which defines where the
> /// popover is attached.
> /// - arrowEdge: The edge of the `attachmentAnchor` where the popover's
> /// arrow is located.
> /// - content: A closure returning the content of the popover.
> @available(tvOS, unavailable)
> @available(watchOS, unavailable)
> public func popover<Item, Content>(item: Binding<Item?>, attachmentAnchor: PopoverAttachmentAnchor = .rect(.bounds), arrowEdge: Edge = .top, @ViewBuilder content: @escaping (Item) -> Content) -> some View where Item : Identifiable, Content : View
19098,19103d17724
< }
<
< @available(iOS 13.0, OSX 10.15, *)
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
< extension View {
19105c17726,17734
< /// Sets the style for date pickers within this view.
---
> /// Presents a popover when a given condition is true.
> ///
> /// - Parameters:
> /// - isPresented: A binding to whether the popover is presented.
> /// - attachmentAnchor: The positioning anchor which defines where the
> /// popover is attached.
> /// - arrowEdge: The edge of the `attachmentAnchor` where the popover's
> /// arrow is located.
> /// - content: A closure returning the content of the popover.
19108c17737
< public func datePickerStyle<S>(_ style: S) -> some View where S : DatePickerStyle
---
> public func popover<Content>(isPresented: Binding<Bool>, attachmentAnchor: PopoverAttachmentAnchor = .rect(.bounds), arrowEdge: Edge = .top, @ViewBuilder content: @escaping () -> Content) -> some View where Content : View
19112c17741
< @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
---
> @available(iOS 14.0, OSX 10.16, tvOS 14.0, watchOS 7.0, *)
19115c17744,17754
< @inlinable public func anchorPreference<A, K>(key _: K.Type = K.self, value: Anchor<A>.Source, transform: @escaping (Anchor<A>) -> K.Value) -> some View where K : PreferenceKey
---
> /// Sets the style for labels within this view.
> ///
> /// Use this modifier to set a specific style for all labels within a view:
> ///
> /// VStack {
> /// Label("Fire", systemImage: "flame.fill")
> /// Label("Lightning", systemImage: "bolt.fill")
> /// }
> /// .labelStyle(MyCustomLabelStyle())
> ///
> public func labelStyle<S>(_ style: S) -> some View where S : LabelStyle
19119,19120c17758
< @available(macCatalyst 14.0, OSX 10.16, *)
< @available(iOS, unavailable)
---
> @available(iOS 13.4, OSX 10.15, *)
19125,19126c17763,17775
< /// Sets the style for windows created by interacting with this view.
< public func presentedWindowStyle<S>(_ style: S) -> some View where S : WindowStyle
---
> /// Adds an action to perform when the user moves the pointer over or away
> /// from the view's frame.
> ///
> /// Calling this method defines a region for detecting pointer movement with
> /// the size and position of this view.
> ///
> /// - Parameter action: The action to perform whenever the pointer enters or
> /// exits this view's frame. If the pointer is in the view's frame, the
> /// `action` closure passes `true` as a parameter; otherwise, `false`.
> ///
> /// - Returns: A view that triggers `action` when the pointer enters or
> /// exits this view's frame.
> @inlinable public func onHover(perform action: @escaping (Bool) -> Void) -> some View
19130c17779,17782
< @available(iOS 13.0, OSX 10.15, watchOS 6.0, tvOS 14.0, *)
---
> @available(iOS 13.4, *)
> @available(OSX, unavailable)
> @available(tvOS, unavailable)
> @available(watchOS, unavailable)
19133,19134c17785,17789
< /// Adds an action to perform when this view recognizes a long press
< /// gesture.
---
> /// Applies a pointer hover effect to the view.
> ///
> /// > Note: The system may fall back to a more appropriate effect.
> @available(iOS 13.4, *)
> @available(OSX, unavailable)
19136c17791,17792
< public func onLongPressGesture(minimumDuration: Double = 0.5, maximumDistance: CGFloat = 10, pressing: ((Bool) -> Void)? = nil, perform action: @escaping () -> Void) -> some View
---
> @available(watchOS, unavailable)
> public func hoverEffect(_ effect: HoverEffect = .automatic) -> some View
19140c17796,17797
< @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
---
> @available(iOS 14.0, OSX 10.16, tvOS 14.0, *)
> @available(watchOS, unavailable)
19143,19144c17800,17805
< /// Adds an accessibility scroll action to the view.
< public func accessibilityScrollAction(_ handler: @escaping (Edge) -> Void) -> ModifiedContent<Self, AccessibilityAttachmentModifier>
---
> /// Sets the style used for displaying the control
> /// (see `SignInWithAppleButton.Style`).
> ///
> /// - Parameter style: The sign in style to apply to this button.
> public func signInWithAppleButtonStyle(_ style: SignInWithAppleButton.Style) -> some View
>
19150,19151c17811,17876
< /// Wraps this view as a new accessibility element.
< public func accessibilityElement(children: AccessibilityChildBehavior = .ignore) -> some View
---
> /// Hides this view.
> ///
> /// Hidden views are invisible and can't receive or respond to interactions.
> ///
> /// - Returns: A hidden view.
> @inlinable public func hidden() -> some View
>
> }
>
> extension View {
>
> /// Sets the keyboard type for this view.
> ///
> /// Use `keyboardType(_:)` to specify the keyboard type to use for text
> /// entry. A number of different keyboard types are available to meet
> /// specialized input needs, such as entering email addresses or phone
> /// numbers.
> ///
> /// The example below presents a ``TextField`` to input an email address.
> /// Setting the text field's keyboard type to `.emailAddress` ensures the
> /// user can only enter correctly formatted email addresses.
> ///
> /// TextField("someone@example.com", text: $emailAddress)
> /// .keyboardType(.emailAddress)
> ///
> /// There are several different kinds of specialized keyboard types
> /// available though the
> /// <doc://com.apple.documentation/documentation/UIKit/UIKeyboardType> enumeration. To
> /// specify the default system keyboard type, use `.default`.
> ///
> /// ![A screenshot showing the use of a specialized keyboard type with a
> /// text field.](SwiftUI-View-keyboardType.png)
> ///
> /// - Parameter type: One of the keyboard types defined in the
> /// <doc://com.apple.documentation/documentation/UIKit/UIKeyboardType> enumeration.
> @available(iOS 13.0, tvOS 13.0, *)
> @available(OSX, unavailable)
> @available(watchOS, unavailable)
> public func keyboardType(_ type: UIKeyboardType) -> some View
>
> }
>
> extension View {
>
> /// Sets whether to apply auto-capitalization to this view.
> ///
> /// Use `autocapitalization(_:)` when you need to automatically capitalize
> /// words, sentences, or other text like proper nouns.
> ///
> /// In example below, as the user enters text each word is automatically
> /// capitalized:
> ///
> /// TextField("Last, First", text: $fullName)
> /// .autocapitalization(UITextAutocapitalizationType.words)
> ///
> /// The <doc://com.apple.documentation/documentation/UIKit/UITextAutocapitalizationType>
> /// enumeration defines the available capitalization modes. The default is
> /// <doc://com.apple.documentation/documentation/UIKit/UITextAutocapitalizationType/sentences>.
> ///
> /// - Parameter style: One of the autocapitalization modes defined in the
> /// <doc://com.apple.documentation/documentation/UIKit/UITextAutocapitalizationType>
> /// enumeration.
> @available(iOS 13.0, tvOS 13.0, *)
> @available(OSX, unavailable)
> @available(watchOS, unavailable)
> public func autocapitalization(_ style: UITextAutocapitalizationType) -> some View
19192,19193c17917,18042
< /// - Returns: A new view that defines an entry in the global
< /// database of views synchronizing their geometry.
---
> /// - Returns: A new view that defines an entry in the global
> /// database of views synchronizing their geometry.
> ///
> @inlinable public func matchedGeometryEffect<ID>(id: ID, in namespace: Namespace.ID, properties: MatchedGeometryProperties = .frame, anchor: UnitPoint = .center, isSource: Bool = true) -> some View where ID : Hashable
>
> }
>
> @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
> extension View {
>
> /// Adds an action to perform when the specified preference key's value
> /// changes.
> ///
> /// - Parameters:
> /// - key: The key to monitor for value changes.
> /// - action: The action to perform when the value for `key` changes. The
> /// `action` closure passes the new value as its parameter.
> ///
> /// - Returns: A view that triggers `action` when the value for `key`
> /// changes.
> @inlinable public func onPreferenceChange<K>(_ key: K.Type = K.self, perform action: @escaping (K.Value) -> Void) -> some View where K : PreferenceKey, K.Value : Equatable
>
> }
>
> @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 7.0, *)
> extension View {
>
> /// Sets the style for navigation views within this view.
> @available(watchOS 7.0, *)
> public func navigationViewStyle<S>(_ style: S) -> some View where S : NavigationViewStyle
>
> }
>
> @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
> extension View {
>
> /// Sets the style for lists within this view.
> public func listStyle<S>(_ style: S) -> some View where S : ListStyle
>
> }
>
> @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
> extension View {
>
> /// Applies a transformation to a preference value.
> @inlinable public func transformPreference<K>(_ key: K.Type = K.self, _ callback: @escaping (inout K.Value) -> Void) -> some View where K : PreferenceKey
>
> }
>
> @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
> extension View {
>
> /// Sets whether this view flips its contents horizontally when the layout
> /// direction is right-to-left.
> ///
> /// Use `flipsForRightToLeftLayoutDirection(_:)` when you need the system to
> /// horizontally flip the contents of the view to support right-to-left
> /// layout.
> ///
> /// In the example below, the text flips horizontally when the layout system
> /// is right-to-left:
> ///
> /// Text("שָׁלוֹם")
> /// .flipsForRightToLeftLayoutDirection(true)
> ///
> /// - Parameter enabled: A Boolean value that indicates whether this view
> /// flips its content horizontally when the layout direction is
> /// right-to-left.
> ///
> /// - Returns: A view that conditionally flips its contents horizontally
> /// when the layout direction is right-to-left.
> @inlinable public func flipsForRightToLeftLayoutDirection(_ enabled: Bool) -> some View
>
> }
>
> extension View {
>
> /// Sets the text content type for this view, which the system uses to
> /// offer suggestions while the user enters text on an iOS or tvOS device.
> ///
> /// Use `textContentType(_:)` to set the content type for this view.
> ///
> /// This example configures the `TextField` for the entry of email
> /// addresses:
> ///
> /// TextField("billjames2@icloud.com", text: $emailAddress)
> /// .textContentType(.emailAddress)
> /// }
> ///
> /// - Parameter textContentType: One of the content types available in the
> /// `UITextContentType` enumeration that identify the semantic meaning
> /// expected for a text-entry area. These include support for email
> /// addresses, location names, URLs, and telephone numbers to name
> /// just a few.
> @available(iOS 13.0, tvOS 13.0, *)
> @available(OSX, unavailable)
> @available(watchOS, unavailable)
> @inlinable public func textContentType(_ textContentType: UITextContentType?) -> some View
>
> }
>
> @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
> extension View {
>
> /// Hides the labels of any controls contained within this view.
> ///
> /// Use `labelsHidden()` when it would not be appropriate to show a
> /// label near controls in the context of your user interface.
> ///
> /// Although the labels are not visually laid out alongside the controls,
> /// the control's label text is still often required, because it is used
> /// for other purposes including accessibility. This example shows two
> /// controls where the first control’s label is hidden.
> ///
> /// In the example below, one of the toggles has its label hidden:
> ///
> /// VStack {
> /// Toggle(isOn: $toggle1) {
> /// Text("Toggle1")
> /// }
> /// .labelsHidden()
> ///
> /// Toggle(isOn: $toggle2) {
> /// Text("Toggle2")
> /// }
> /// }
19195c18044,18051
< @inlinable public func matchedGeometryEffect<ID>(id: ID, in namespace: Namespace.ID, properties: MatchedGeometryProperties = .frame, anchor: UnitPoint = .center, isSource: Bool = true) -> some View where ID : Hashable
---
> /// ![A screenshot showing a view with two toggle controls where one label
> /// is visible and the other label is hidden.](SwiftUI-Vew-labelsHidden.png)
> ///
> /// > Note: This modifier does not work for all labels. It applies to
> /// labels that are external/separate from the rest of the control's
> /// interface like `Toggle`, but not to controls like a bordered button
> /// where the label is inside the button's border.
> public func labelsHidden() -> some View
19240,19262c18096,18097
< @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
< extension View {
<
< /// Adds an action to perform when this view appears.
< ///
< /// - Parameter action: The action to perform. If `action` is `nil`, the
< /// call has no effect.
< ///
< /// - Returns: A view that triggers `action` when this view appears.
< @inlinable public func onAppear(perform action: (() -> Void)? = nil) -> some View
<
<
< /// Adds an action to perform when this view disappears.
< ///
< /// - Parameter action: The action to perform. If `action` is `nil`, the
< /// call has no effect.
< ///
< /// - Returns: A view that triggers `action` when this view disappears.
< @inlinable public func onDisappear(perform action: (() -> Void)? = nil) -> some View
<
< }
<
< @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
---
> @available(iOS 13.0, tvOS 13.0, watchOS 6.0, *)
> @available(OSX, unavailable)
19265,19273c18100
< /// Sets whether this view flips its contents horizontally when the layout
< /// direction is right-to-left.
< ///
< /// Use `flipsForRightToLeftLayoutDirection(_:)` when you need the system to
< /// horizontally flip the contents of the view to support right-to-left
< /// layout.
< ///
< /// In the example below, the text flips horizontally when the layout system
< /// is right-to-left:
---
> /// Hides the navigation bar for this view.
19275,19280c18102,18104
< /// Text("שָׁלוֹם")
< /// .flipsForRightToLeftLayoutDirection(true)
< ///
< /// - Parameter enabled: A Boolean value that indicates whether this view
< /// flips its content horizontally when the layout direction is
< /// right-to-left.
---
> /// Use `navigationBarHidden(_:)` to hide the navigation bar. This modifier
> /// only takes effect when this view is inside of and visible within a
> /// ``NavigationView``.
19282,19291c18106,18109
< /// - Returns: A view that conditionally flips its contents horizontally
< /// when the layout direction is right-to-left.
< @inlinable public func flipsForRightToLeftLayoutDirection(_ enabled: Bool) -> some View
<
< }
<
< @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
< extension View {
<
< @inlinable public func transformAnchorPreference<A, K>(key _: K.Type = K.self, value: Anchor<A>.Source, transform: @escaping (inout K.Value, Anchor<A>) -> Void) -> some View where K : PreferenceKey
---
> /// - Parameter hidden: A Boolean value that indicates whether to hide the
> /// navigation bar.
> @available(OSX, unavailable)
> public func navigationBarHidden(_ hidden: Bool) -> some View
19293,19306d18110
< }
<
< @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
< extension View {
<
< /// Adds an accessibility adjustable action to the view.
< public func accessibilityAdjustableAction(_ handler: @escaping (AccessibilityAdjustmentDirection) -> Void) -> ModifiedContent<Self, AccessibilityAttachmentModifier>
< }
<
< @available(OSX 10.15, *)
< @available(iOS, unavailable)
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
< extension View {
19308c18112
< /// Sets the behavior of the user-customized view.
---
> /// Sets the title in the navigation bar for this view.
19310,19311c18114,18116
< /// Use `touchBarItemPresence(_:)` to define the visibility requirements of
< /// a particular Touch Bar view during customization by the user.
---
> /// Use `navigationBarTitle(_:)` to set the title of the navigation bar.
> /// This modifier only takes effect when this view is inside of and visible
> /// within a ``NavigationView``.
19313c18118,18119
< /// Touch Bar views may be:
---
> /// The example below shows setting the title of the navigation bar using a
> /// ``Text`` view:
19315,19322c18121,18132
< /// - `.required`: not allowed to be removed by the user.
< /// - `.default`: shown by default prior to user customization, but
< /// removable.
< /// - `.optional`: not visible by default, but can be added through the
< /// customization palette.
< ///
< /// Each ``TouchBarItemPresence`` must be initialized with a string that is
< /// a globally unique identifier for this item.
---
> /// struct FlavorView: View {
> /// let items = ["Chocolate", "Vanilla", "Strawberry", "Mint Chip",
> /// "Pistachio"]
> /// var body: some View {
> /// NavigationView {
> /// List(items, id: \.self) {
> /// Text($0)
> /// }
> /// .navigationBarTitle(Text("Today's Flavors"))
> /// }
> /// }
> /// }
19324,19326c18134,18135
< /// In the example below, all of the Touch Bar items are visible in the
< /// Touch Bar by default, except for the "Clubs" item. It's set to
< /// `.optional` but is configurable by the user:
---
> /// ![A screenshot showing the title of a navigation bar configured using a
> /// text view.](SwiftUI-navigationBarTitle-Text.png)
19328,19339c18137,18171
< /// TextField("TouchBar Demo", text: $placeholder)
< /// .frame(maxWidth: .infinity, maxHeight: .infinity)
< /// .focusable()
< /// .touchBar {
< /// Button("♥️", action: selectHearts)
< /// .touchBarItemPresence(.required("heartsKey"))
< /// Button("♣️", action: selectClubs)
< /// .touchBarItemPresence(.optional("clubsKey"))
< /// Button("♠️", action: selectSpades)
< /// .touchBarItemPresence(.required("spadesKey"))
< /// Button("♦️", action: selectDiamonds)
< /// .touchBarItemPresence(.required("diamondsKey"))
---
> /// - Parameter title: A description of this view to display in the
> /// navigation bar.
> @available(iOS, introduced: 13.0, deprecated: 100000.0, renamed: "navigationTitle(_:)")
> @available(OSX, unavailable)
> @available(tvOS, introduced: 13.0, deprecated: 100000.0, renamed: "navigationTitle(_:)")
> @available(watchOS, introduced: 6.0, deprecated: 100000.0, renamed: "navigationTitle(_:)")
> public func navigationBarTitle(_ title: Text) -> some View
>
>
> /// Sets the title of this view's navigation bar with a localized string.
> ///
> /// Use `navigationBarTitle(_:)` to set the title of the navigation bar
> /// using a ``LocalizedStringKey`` that will be used to search for a
> /// matching localized string in the application's localizable strings
> /// assets.
> ///
> /// This modifier only takes effect when this view is inside of and visible
> /// within a ``NavigationView``.
> ///
> /// In the example below, a string constant is used to access a
> /// ``LocalizedStringKey`` that will be resolved at run time to provide a
> /// title for the navigation bar. If the localization key cannot be
> /// resolved, the text of the key name will be used as the title text.
> ///
> /// struct FlavorView: View {
> /// let items = ["Chocolate", "Vanilla", "Strawberry", "Mint Chip",
> /// "Pistachio"]
> /// var body: some View {
> /// NavigationView {
> /// List(items, id: \.self) {
> /// Text($0)
> /// }
> /// .navigationBarTitle("Today's Flavors")
> /// }
> /// }
19342,19343c18174,18204
< /// ![A view showing the configuration of the Touch Bar with required and
< /// optional elements.](SwiftUI-touchBarItemPresence.png)
---
> /// - Parameter titleKey: A key to a localized description of this view to
> /// display in the navigation bar.
> @available(iOS, introduced: 13.0, deprecated: 100000.0, renamed: "navigationTitle(_:)")
> @available(OSX, unavailable)
> @available(tvOS, introduced: 13.0, deprecated: 100000.0, renamed: "navigationTitle(_:)")
> @available(watchOS, introduced: 6.0, deprecated: 100000.0, renamed: "navigationTitle(_:)")
> public func navigationBarTitle(_ titleKey: LocalizedStringKey) -> some View
>
>
> /// Sets the title of this view's navigation bar with a string.
> ///
> /// Use `navigationBarTitle(_:)` to set the title of the navigation bar
> /// using a `String`. This modifier only takes effect when this view is
> /// inside of and visible within a ``NavigationView``.
> ///
> /// In the example below, text for the navigation bar title is provided
> /// using a string:
> ///
> /// struct FlavorView: View {
> /// let items = ["Chocolate", "Vanilla", "Strawberry", "Mint Chip",
> /// "Pistachio"]
> /// let text = "Today's Flavors"
> /// var body: some View {
> /// NavigationView {
> /// List(items, id: \.self) {
> /// Text($0)
> /// }
> /// .navigationBarTitle(text)
> /// }
> /// }
> /// }
19345,19346c18206,18239
< /// - Parameter presence: One of the allowed ``TouchBarItemPresence``
< /// descriptions.
---
> /// - Parameter title: A title for this view to display in the navigation
> /// bar.
> @available(iOS, introduced: 13.0, deprecated: 100000.0, renamed: "navigationTitle(_:)")
> @available(OSX, unavailable)
> @available(tvOS, introduced: 13.0, deprecated: 100000.0, renamed: "navigationTitle(_:)")
> @available(watchOS, introduced: 6.0, deprecated: 100000.0, renamed: "navigationTitle(_:)")
> public func navigationBarTitle<S>(_ title: S) -> some View where S : StringProtocol
>
>
> /// Sets the title and display mode in the navigation bar for this view.
> ///
> /// Use `navigationBarTitle(_:displayMode:)` to set the title of the
> /// navigation bar for this view and specify a display mode for the title
> /// from one of the ``NavigationBarItem/TitleDisplayMode`` styles. This
> /// modifier only takes effect when this view is inside of and visible
> /// within a ``NavigationView``.
> ///
> /// In the example below, text for the navigation bar title is provided
> /// using a ``Text`` view. The navigation bar title's
> /// ``NavigationBarItem/TitleDisplayMode`` is set to `.inline` which places
> /// the navigation bar title in the bounds of the navigation bar.
> ///
> /// struct FlavorView: View {
> /// let items = ["Chocolate", "Vanilla", "Strawberry", "Mint Chip",
> /// "Pistachio"]
> /// var body: some View {
> /// NavigationView {
> /// List(items, id: \.self) {
> /// Text($0)
> /// }
> /// .navigationBarTitle(Text("Today's Flavors", displayMode: .inline)
> /// }
> /// }
> /// }
19348,19350c18241,18245
< /// - Returns: A trait that describes the behavior for this Touch Bar
< /// view.
< @available(iOS, unavailable)
---
> /// - Parameters:
> /// - title: A title for this view to display in the navigation bar.
> /// - displayMode: The style to use for displaying the navigation bar title.
> @available(iOS, introduced: 13.0, deprecated: 100000.0, message: "Use navigationTitle(_:) with navigationBarTitleDisplayMode(_:)")
> @available(OSX, unavailable)
19353c18248
< @inlinable public func touchBarItemPresence(_ presence: TouchBarItemPresence) -> some View
---
> public func navigationBarTitle(_ title: Text, displayMode: NavigationBarItem.TitleDisplayMode) -> some View
19355,19361d18249
< }
<
< @available(OSX 10.15, *)
< @available(iOS, unavailable)
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
< extension View {
19363c18251
< /// Sets principal views that have special significance to this Touch Bar.
---
> /// Sets the title and display mode in the navigation bar for this view.
19365,19367c18253,18257
< /// Use `touchBarItemPrincipal(_:)` to designate a view as a significant
< /// view in the Touch Bar. Currently, that view will be placed in the center
< /// of the row.
---
> /// Use `navigationBarTitle(_:displayMode:)` to set the title of the
> /// navigation bar for this view and specify a display mode for the title
> /// from one of the ``NavigationBarItem/TitleDisplayMode`` styles. This
> /// modifier only takes effect when this view is inside of and visible
> /// within a ``NavigationView``.
19369,19370c18259,18262
< /// The example below sets the last button as the principal button for the
< /// Touch Bar view.
---
> /// In the example below, text for the navigation bar title is provided
> /// using a string. The navigation bar title's
> /// ``NavigationBarItem/TitleDisplayMode`` is set to `.inline` which places
> /// the navigation bar title in the bounds of the navigation bar.
19372,19377c18264,18274
< /// let touchBarItems = TouchBar(id: "myBarItems") {
< /// Button("♣️", action: {})
< /// Button("♥️", action: {})
< /// Button("♠️", action: {})
< /// Button("♦️", action: {})
< /// .touchBarItemPrincipal(true)
---
> /// struct FlavorView: View {
> /// let items = ["Chocolate", "Vanilla", "Strawberry", "Mint Chip",
> /// "Pistachio"]
> /// var body: some View {
> /// NavigationView {
> /// List(items, id: \.self) {
> /// Text($0)
> /// }
> /// .navigationBarTitle("Today's Flavors", displayMode: .inline)
> /// }
> /// }
19380,19383c18277,18278
< /// TextField("TouchBar Demo", text: $placeholder)
< /// .frame(maxWidth: .infinity, maxHeight: .infinity)
< /// .focusable()
< /// .touchBar(touchBarItems)
---
> /// If the `titleKey` can't be found, the title uses the text of the key
> /// name instead.
19385,19396c18280,18286
< /// > Note: Multiple visible bars may each specify a principal view, but
< /// the system only honors one of them.
< ///
< /// ![A Touch Bar view showing one element designated as the principal view
< /// of the Touch Bar content.](SwiftUI-touchBarItemPrincipal.png)
< ///
< /// - Parameter principal: A Boolean value that indicates whether to display
< /// this view prominently in the Touch Bar compared to other views.
< ///
< /// - Returns: A Touch Bar view with one element centered in the Touch Bar
< /// row.
< @available(iOS, unavailable)
---
> /// - Parameters:
> /// - titleKey: A key to a localized description of this view to display
> /// in the navigation bar.
> /// - displayMode: The style to use for displaying the navigation bar
> /// title.
> @available(iOS, introduced: 13.0, deprecated: 100000.0, message: "Use navigationTitle(_:) with navigationBarTitleDisplayMode(_:)")
> @available(OSX, unavailable)
19399c18289
< @inlinable public func touchBarItemPrincipal(_ principal: Bool = true) -> some View
---
> public func navigationBarTitle(_ titleKey: LocalizedStringKey, displayMode: NavigationBarItem.TitleDisplayMode) -> some View
19401,19407d18290
< }
<
< @available(OSX 10.15, *)
< @available(iOS, unavailable)
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
< extension View {
19409,19411c18292
< /// Sets a user-visible string that identifies the view's functionality.
< ///
< /// This string is visible during user customization.
---
> /// Sets the title and display mode in the navigation bar for this view.
19413,19424c18294,18320
< /// TextField("TouchBar Demo", text: $placeholder)
< /// .frame(maxWidth: .infinity, maxHeight: .infinity)
< /// .focusable()
< /// .touchBar {
< /// Button("♥️", action: selectHearts)
< /// .touchBarCustomizationLabel(Text("Hearts"))
< /// Button("♣️", action: selectClubs)
< /// .touchBarCustomizationLabel(Text("Clubs"))
< /// Button("♠️", action: selectSpades)
< /// .touchBarCustomizationLabel(Text("Spades"))
< /// Button("♦️", action: selectDiamonds)
< /// .touchBarCustomizationLabel(Text("Diamonds"))
---
> /// Use `navigationBarTitle(_:, displayMode)` to set the title of the
> /// navigation bar for this view and specify a display mode for the
> /// title from one of the `NavigationBarItem.Title.DisplayMode`
> /// styles. This modifier only takes effect when this view is inside of and
> /// visible within a `NavigationView`.
> ///
> /// In the example below, `navigationBarTitle(_:, displayMode)` uses a
> /// string to provide a title for the navigation bar. Setting the title's
> /// `displaymode` to `.inline` places the navigation bar title within the
> /// bounds of the navigation bar.
> ///
> /// In the example below, text for the navigation bar title is provided using
> /// a string. The navigation bar title's `displayMode` is set to
> /// `.inline` which places the navigation bar title in the bounds of the
> /// navigation bar.
> ///
> /// struct FlavorView: View {
> /// let items = ["Chocolate", "Vanilla", "Strawberry", "Mint Chip",
> /// "Pistachio"]
> /// let title = "Today's Flavors"
> /// var body: some View {
> /// NavigationView {
> /// List(items, id: \.self) {
> /// Text($0)
> /// }
> /// .navigationBarTitle(title, displayMode: .inline)
> /// }
19425a18322
> /// }
19427,19430c18324,18326
< /// ![A Touch Bar customization view showing labels assigned to the Touch
< /// Bar elements.](SwiftUI-touchBarCustomizationLabel.png)
< ///
< /// - Parameter label: A `Text` view containing the customization label.
---
> /// ![A screenshot of a navigation bar, showing the title within the bounds
> /// of the navigation bar]
> /// (SwiftUI-navigationBarTitle-stringProtocol.png)
19432,19433c18328,18332
< /// - Returns: A Touch Bar element with a set customization label.
< @available(iOS, unavailable)
---
> /// - Parameters:
> /// - title: A title for this view to display in the navigation bar.
> /// - displayMode: The way to display the title.
> @available(iOS, introduced: 13.0, deprecated: 100000.0, message: "Use navigationTitle(_:) with navigationBarTitleDisplayMode(_:)")
> @available(OSX, unavailable)
19436c18335
< public func touchBarCustomizationLabel(_ label: Text) -> some View
---
> public func navigationBarTitle<S>(_ title: S, displayMode: NavigationBarItem.TitleDisplayMode) -> some View where S : StringProtocol
19438,19441d18336
< }
<
< @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
< extension View {
19443,19451c18338
< /// Rotates this view's rendered output in three dimensions around the given
< /// axis of rotation.
< ///
< /// Use `rotation3DEffect(_:axis:anchor:anchorZ:perspective:)` to rotate the
< /// view in three dimensions around the given axis of rotation, and
< /// optionally, position the view at a custom display order and perspective.
< ///
< /// In the example below, the text is rotated 45˚ about the `y` axis,
< /// front-most (the default `zIndex`) and default `perspective` (`1`):
---
> /// Hides the navigation bar back button for the view.
19453,19455c18340,18341
< /// Text("Rotation by passing an angle in degrees")
< /// .rotation3DEffect(.degrees(45), axis: (x: 0.0, y: 1.0, z: 0.0))
< /// .border(Color.gray)
---
> /// Use `navigationBarBackButtonHidden(_:)` to hide the back button for this
> /// view.
19457,19458c18343,18344
< /// ![A screenshot showing the rotation of text 45 degrees about the
< /// y-axis.](SwiftUI-View-rotation3DEffect.png)
---
> /// This modifier only takes effect when this view is inside of and visible
> /// within a ``NavigationView``.
19460,19470c18346,18349
< /// - Parameters:
< /// - angle: The angle at which to rotate the view.
< /// - axis: The `x`, `y` and `z` elements that specify the axis of
< /// rotation.
< /// - anchor: The location with a default of ``UnitPoint/center`` that
< /// defines a point in 3D space about which the rotation is anchored.
< /// - anchorZ: The location with a default of `0` that defines a point in
< /// 3D space about which the rotation is anchored.
< /// - perspective: The relative vanishing point with a default of `1` for
< /// this rotation.
< @inlinable public func rotation3DEffect(_ angle: Angle, axis: (x: CGFloat, y: CGFloat, z: CGFloat), anchor: UnitPoint = .center, anchorZ: CGFloat = 0, perspective: CGFloat = 1) -> some View
---
> /// - Parameter hidesBackButton: A Boolean value that indicates whether to
> /// hide the back button.
> @available(OSX, unavailable)
> public func navigationBarBackButtonHidden(_ hidesBackButton: Bool) -> some View
19492,19493c18371,18480
< /// Specifies whether to hide this view from system accessibility features.
< public func accessibility(hidden: Bool) -> ModifiedContent<Self, AccessibilityAttachmentModifier>
---
> /// Sets the alignment of multiline text in this view.
> ///
> /// Use `multilineTextAlignment(_:)` to select an alignment for all of the
> /// text in this view or view hierarchy.
> ///
> /// In the example below, the contents of the ``Text`` view are center
> /// aligned. This also applies to the interpolated newline placed in the
> /// middle of the text since "multiple lines" refers to all of the text
> /// inside the view, regardless of any internal formatting or inclusion of
> /// interpolated text.
> ///
> /// Text("This is a block of text that will show up in a text element as multiple lines.\("\n") Here we have chosen to center this text.")
> /// .frame(width: 200, height: 200, alignment: .leading)
> /// .multilineTextAlignment(.center)
> ///
> /// ![A screenshot showing the effect of text alignment in a
> /// view.](SwiftUI-view-multilineTextAlignment.png)
> ///
> /// - Parameter alignment: A value that you use to left-, right-, or
> /// center-align the text within a view.
> ///
> /// - Returns: A view that aligns the lines of multiline ``Text`` instances
> /// it contains.
> @inlinable public func multilineTextAlignment(_ alignment: TextAlignment) -> some View
>
>
> /// Sets the truncation mode for lines of text that are too long to fit in
> /// the available space.
> ///
> /// Use the `truncationMode(_:)` modifier to determine whether text in a
> /// long line is truncated at the beginning, middle, or end. Truncation is
> /// indicated by adding an ellipsis (…) to the line when removing text to
> /// indicate to readers that text is missing.
> ///
> /// In the example below, the bounds of text view constrains the amount of
> /// text that the view displays and the `truncationMode(_:)` specifies from
> /// which direction and where to display the truncation indicator:
> ///
> /// Text("This is a block of text that will show up in a text element as multiple lines. The text will fill the available space, and then, eventually, be truncated.")
> /// .frame(width: 150, height: 150)
> /// .truncationMode(.tail)
> ///
> /// ![A screenshot showing the effect of truncation mode on text in a
> /// view.](SwiftUI-view-truncationMode.png)
> ///
> /// - Parameter mode: The truncation mode that specifies where to truncate
> /// the text within the text view, if needed. You can truncate at the
> /// beginning, middle, or end of the text view.
> ///
> /// - Returns: A view that truncates text at different points in a line
> /// depending on the mode you select.
> @inlinable public func truncationMode(_ mode: Text.TruncationMode) -> some View
>
>
> /// Sets the amount of space between lines of text in this view.
> ///
> /// Use `lineSpacing(_:)` to set the amount of spacing from the bottom of
> /// one line to the top of the next for text elements in the view.
> ///
> /// In the ``Text`` view in the example below, 10 points separate the bottom
> /// of one line to the top of the next as the text field wraps inside this
> /// view. Applying `lineSpacing(_:)` to a view hierarchy applies the line
> /// spacing to all text elements contained in the view.
> ///
> /// Text("This is a string in a TextField with 10 point spacing applied between the bottom of one line and the top of the next.")
> /// .frame(width: 200, height: 200, alignment: .leading)
> /// .lineSpacing(10)
> ///
> /// ![A screenshot showing the effects of setting line spacing on the text
> /// in a view.](SwiftUI-view-lineSpacing.png)
> ///
> /// - Parameter lineSpacing: The amount of space between the bottom of one
> /// line and the top of the next line in points.
> @inlinable public func lineSpacing(_ lineSpacing: CGFloat) -> some View
>
>
> /// Sets whether text in this view can compress the space between characters
> /// when necessary to fit text in a line.
> ///
> /// Use `allowsTightening(_:)` to enable the compression of inter-character
> /// spacing of text in a view to try to fit the text in the view's bounds.
> ///
> /// In the example below, two identically configured text views show the
> /// effects of `allowsTightening(_:)` on the compression of the spacing
> /// between characters:
> ///
> /// VStack {
> /// Text("This is a wide text element")
> /// .font(.body)
> /// .frame(width: 200, height: 50, alignment: .leading)
> /// .lineLimit(1)
> /// .allowsTightening(true)
> ///
> /// Text("This is a wide text element")
> /// .font(.body)
> /// .frame(width: 200, height: 50, alignment: .leading)
> /// .lineLimit(1)
> /// .allowsTightening(false)
> /// }
> ///
> /// ![A screenshot showing the effect of enabling text tightening in a
> /// view.](SwiftUI-view-allowsTightening.png)
> ///
> /// - Parameter flag: A Boolean value that indicates whether the space
> /// between characters compresses when necessary.
> ///
> /// - Returns: A view that can compress the space between characters when
> /// necessary to fit text in a line.
> @inlinable public func allowsTightening(_ flag: Bool) -> some View
>
19495c18482
< /// Adds a label to the view that describes its contents.
---
> /// Sets the maximum number of lines that text can occupy in this view.
19497,19503c18484,18485
< /// Use this method to provide an accessibility label for a view that doesn't display text, like an icon.
< /// For example, you could use this method to label a button that plays music with the text "Play".
< /// Don't include text in the label that repeats information that users already have. For example,
< /// don't use the label "Play button" because a button already has a trait that identifies it as a button.
< public func accessibility(label: Text) -> ModifiedContent<Self, AccessibilityAttachmentModifier>
<
< /// Adds a textual description of the value that the view contains.
---
> /// Use `lineLimit(_:)` to cap the number of lines that an individual text
> /// element can display.
19505,19511c18487,18490
< /// Use this method to describe the value represented by a view, but only if that's different than the
< /// view's label. For example, for a slider that you label as "Volume" using accessibility(label:),
< /// you can provide the current volume setting, like "60%", using accessibility(value:).
< public func accessibility(value: Text) -> ModifiedContent<Self, AccessibilityAttachmentModifier>
<
< /// Communicates to the user what happens after performing the view's
< /// action.
---
> /// The line limit applies to all ``Text`` instances within a hierarchy. For
> /// example, an ``HStack`` with multiple pieces of text longer than three
> /// lines caps each piece of text to three lines rather than capping the
> /// total number of lines across the ``HStack``.
19513,19517c18492,18494
< /// Provide a hint in the form of a brief phrase, like "Purchases the item" or
< /// "Downloads the attachment".
< public func accessibility(hint: Text) -> ModifiedContent<Self, AccessibilityAttachmentModifier>
<
< /// Sets alternate input labels with which users identify a view.
---
> /// In the example below, the `lineLimit(_:)` operator limits the very long
> /// line in the ``Text`` element to the 2 lines that fit within the view's
> /// bounds:
19519,19524c18496,18498
< /// Provide labels in descending order of importance. Voice Control
< /// and Full Keyboard Access use the input labels.
< ///
< /// > Note: If you don't specify any input labels, the user can still
< /// refer to the view using the accessibility label that you add with the
< /// ``accessibility(label:)`` modifier.
---
> /// Text("This is a long string that demonstrates the effect of SwuiftUI's lineLimit(:_) operator.")
> /// .frame(width: 200, height: 200, alignment: .leading)
> /// .lineLimit(2)
19526,19530c18500,18507
< /// - Parameter inputLabels: An array of Text elements to use as input labels.
< public func accessibility(inputLabels: [Text]) -> ModifiedContent<Self, AccessibilityAttachmentModifier>
<
< /// Adds the given traits to the view.
< public func accessibility(addTraits traits: AccessibilityTraits) -> ModifiedContent<Self, AccessibilityAttachmentModifier>
---
> /// ![A screenshot showing showing the effect of the line limit operator on
> /// a very long string in a view.](SwiftUI-view-lineLimit.png)
> ///
> /// - Parameter number: The line limit. If `nil`, no line limit applies.
> ///
> /// - Returns: A view that limits the number of lines that ``Text``
> /// instances display.
> @inlinable public func lineLimit(_ number: Int?) -> some View
19532,19533d18508
< /// Removes the given traits from this view.
< public func accessibility(removeTraits traits: AccessibilityTraits) -> ModifiedContent<Self, AccessibilityAttachmentModifier>
19535c18510,18511
< /// Uses the specified string to identify the view.
---
> /// Sets the minimum amount that text in this view scales down to fit in the
> /// available space.
19537,19540c18513,18516
< /// Use this value for testing. It isn't visible to the user.
< public func accessibility(identifier: String) -> ModifiedContent<Self, AccessibilityAttachmentModifier>
<
< /// Sets a selection identifier for this view's accessibility element.
---
> /// Use the `minimumScaleFactor(_:)` modifier if the text you place in a
> /// view doesn't fit and it's okay if the text shrinks to accommodate. For
> /// example, a label with a minimum scale factor of `0.5` draws its text in
> /// a font size as small as half of the actual font if needed.
19542,19548c18518,18521
< /// Picker uses the value to determine what node to use for the
< /// accessibility value.
< @available(*, deprecated)
< public func accessibility(selectionIdentifier: AnyHashable) -> ModifiedContent<Self, AccessibilityAttachmentModifier>
<
< /// Sets the sort priority order for this view's accessibility element,
< /// relative to other elements at the same level.
---
> /// In the example below, the ``HStack`` contains a ``Text`` label with a
> /// line limit of `1`, that is next to a ``TextField``. To allow the label
> /// to fit into the available space, the `minimumScaleFactor(_:)` modifier
> /// shrinks the text as needed to fit into the available space.
19550,19551c18523,18537
< /// Higher numbers are sorted first. The default sort priority is zero.
< public func accessibility(sortPriority: Double) -> ModifiedContent<Self, AccessibilityAttachmentModifier>
---
> /// HStack {
> /// Text("This is a long label that will be scaled to fit:")
> /// .lineLimit(1)
> /// .minimumScaleFactor(0.5)
> /// TextField("My Long Text Field", text: $myTextField)
> /// }
> ///
> /// ![A screenshot showing the effect of setting a minimumScaleFactor on
> /// text in a view.](SwiftUI-View-minimumScaleFactor.png)
> ///
> /// - Parameter factor: A fraction between 0 and 1 (inclusive) you use to
> /// specify the minimum amount of text scaling that this view permits.
> ///
> /// - Returns: A view that limits the amount of text downscaling.
> @inlinable public func minimumScaleFactor(_ factor: CGFloat) -> some View
19553,19554d18538
< /// Specifies the point where activations occur in the view.
< public func accessibility(activationPoint: CGPoint) -> ModifiedContent<Self, AccessibilityAttachmentModifier>
19556,19557c18540,18551
< /// Specifies the unit point where activations occur in the view.
< public func accessibility(activationPoint: UnitPoint) -> ModifiedContent<Self, AccessibilityAttachmentModifier>
---
> /// Sets a transform for the case of the text contained in this view when
> /// displayed.
> ///
> /// The default value is `nil`, displaying the `Text` without any case
> /// changes.
> ///
> /// - Parameter textCase: One of the ``Text.Case`` enumerations; the
> /// default is `nil`.
> /// - Returns: A view that transforms the case of `Text`.
> @available(iOS 14.0, OSX 10.16, tvOS 14.0, watchOS 7.0, *)
> @inlinable public func textCase(_ textCase: Text.Case?) -> some View
>
19560c18554,18555
< @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
---
> @available(iOS 13.0, OSX 10.15, watchOS 6.0, *)
> @available(tvOS, unavailable)
19563,19604c18558,18559
< /// Sets the accent color for this view and the views it contains.
< ///
< /// Use `accentColor(_:)` when you want to apply a broad theme color to
< /// your app's user interface. Some styles of controls use the accent color
< /// as a default tint color.
< ///
< /// On macOS, customization of the accent color is only applied if the
< /// "Multicolor" accent color is selected in System Preferences.
< ///
< /// In the example below, the outer ``VStack`` contains two child views, the
< /// first is a ``VStack`` containing a default accented button. The second
< /// ``VStack`` contains a button and a slider both of which adopt the purple
< /// accent color of their containing view. Note that the ``Text`` element
< /// used as a label alongside the `Slider` retains its default color.
< ///
< /// VStack {
< /// VStack {
< /// Button(action: {}) {
< /// Text("Regular Button")
< /// }
< /// }.padding()
< /// VStack {
< /// Button(action: {}) {
< /// Text("Accented Button")
< /// }
< /// HStack {
< /// Text("Accented Slider")
< /// Slider(value: $sliderValue, in: -100...100, step: 0.1)
< /// }
< /// }.accentColor(.purple)
< /// }
< ///
< /// ![A VStack showing two child views: one VStack containing a default
< /// accented button, and a second VStack where the VStack has a purple
< /// accent color applied. The accent color modifies the enclosed button and
< /// slider, but not the color of a Text item used as a label for the
< /// slider.](SwiftUI-View-accentColor.png)
< ///
< /// - Parameter accentColor: The color to use as an accent color. If `nil`,
< /// the accent color continues to be inherited
< @available(iOS 13.0, OSX 10.16, tvOS 13.0, watchOS 6.0, *)
< @inlinable public func accentColor(_ accentColor: Color?) -> some View
---
> /// Adds an action to perform when this view recognizes a tap gesture.
> public func onTapGesture(count: Int = 1, perform action: @escaping () -> Void) -> some View
19611c18566
< /// Places a custom background view behind a list row item.
---
> /// Applies an inset to the rows in a list.
19613,19614c18568,18569
< /// Use `listRowBackground(_:)` to place a custom background view behind a
< /// list row item.
---
> /// Use `listRowInsets(_:)` to change the default padding of the content of
> /// list items.
19620,19623c18575,18576
< /// finishes, the `listRowBackground(_:)` modifier places the view you
< /// supply behind each of the list row items.
< ///
< /// struct ListRowBackground: View {
---
> /// finishes, the `listRowInsets(_:)` modifier changes the edge insets of
> /// each row of the list according to the ``EdgeInsets`` values you provide.
19624a18578
> /// struct ListRowInsets: View {
19634c18588
< /// .listRowBackground(Image(systemName: "sparkles"))
---
> /// .listRowInsets(EdgeInsets(top: 0, leading: 75, bottom: 0, trailing: 0))
19638,19721c18592
< /// - Parameter view: The ``View`` to use as the background behind the list
< /// row view.
< ///
< /// - Returns: A list row view with `view` as its background view.
< @inlinable public func listRowBackground<V>(_ view: V?) -> some View where V : View
<
< }
<
< @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
< extension View {
<
< /// Associates a transition with the view.
< @inlinable public func transition(_ t: AnyTransition) -> some View
<
< }
<
< @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
< extension View {
<
< /// Controls the display order of overlapping views.
< ///
< /// Use `zIndex(_:)` when you want to control the front-to-back ordering of
< /// views.
< ///
< /// In this example there are two overlapping rotated rectangles. The
< /// frontmost is represented by the larger index value.
< ///
< /// VStack {
< /// Rectangle()
< /// .fill(Color.yellow)
< /// .frame(width: 100, height: 100, alignment: .center)
< /// .zIndex(1) // Top layer.
< ///
< /// Rectangle()
< /// .fill(Color.red)
< /// .frame(width: 100, height: 100, alignment: .center)
< /// .rotationEffect(.degrees(45))
< /// // Here a zIndex of 0 is the default making
< /// // this the bottom layer.
< /// }
< ///
< /// ![A screenshot showing two overlapping rectangles. The frontmost view is
< /// represented by the larger zIndex value.](SwiftUI-View-zIndex.png)
< ///
< /// - Parameter value: A relative front-to-back ordering for this view; the
< /// default is `0`.
< @inlinable public func zIndex(_ value: Double) -> some View
<
< }
<
< @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
< extension View {
<
< /// Changes the view's proposed area to extend outside the screen's safe
< /// areas.
< ///
< /// Use `edgesIgnoringSafeArea(_:)` to change the area proposed for this
< /// view so that — were the proposal accepted — this view could extend
< /// outside the safe area to the bounds of the screen for the specified
< /// edges.
< ///
< /// For example, you can propose that a text view ignore the safe area's top
< /// inset:
< ///
< /// VStack {
< /// Text("This text is outside of the top safe area.")
< /// .edgesIgnoringSafeArea([.top])
< /// .border(Color.purple)
< /// Text("This text is inside VStack.")
< /// .border(Color.yellow)
< /// }
< /// .border(Color.gray)
< ///
< /// ![A screenshot showing a view whose bounds exceed the safe area of the
< /// screen.](SwiftUI-View-edgesIgnoringSafeArea.png)
< ///
< /// Depending on the surrounding view hierarchy, SwiftUI may not honor an
< /// `edgesIgnoringSafeArea(_:)` request. This can happen, for example, if
< /// the view is inside a container that respects the screen's safe area. In
< /// that case you may need to apply `edgesIgnoringSafeArea(_:)` to the
< /// container instead.
< ///
< /// - Parameter edges: The set of the edges in which to expand the size
< /// requested for this view.
---
> /// - Parameter insets: ``EdgeInsets`` to apply to the edges of the view.
19723,19725c18594,18596
< /// - Returns: A view that may extend outside of the screen's safe area
< /// on the edges specified by `edges`.
< @inlinable public func edgesIgnoringSafeArea(_ edges: Edge.Set) -> some View
---
> /// - Returns: A view that uses the given edge insets when used as a list
> /// cell.
> @inlinable public func listRowInsets(_ insets: EdgeInsets?) -> some View
19729c18600
< @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
---
> @available(iOS 14.0, OSX 10.16, tvOS 14.0, watchOS 7.0, *)
19732,19733c18603,18607
< /// Sets a value for the given preference.
< @inlinable public func preference<K>(key: K.Type = K.self, value: K.Value) -> some View where K : PreferenceKey
---
> /// Populates the toolbar or navigation bar with items
> /// whose content is the specified views.
> ///
> /// - Parameter content: The views representing the content of the toolbar.
> public func toolbar<Content>(@ViewBuilder content: () -> Content) -> some View where Content : View
19735,19738d18608
< }
<
< @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
< extension View {
19740,19741c18610,18622
< /// Sets the style for pickers within this view.
< public func pickerStyle<S>(_ style: S) -> some View where S : PickerStyle
---
> /// Populates the toolbar or navigation bar with the specified items.
> ///
> /// - Parameter items: The items representing the content of the toolbar.
> public func toolbar<Items>(@ToolbarContentBuilder<Void> items: () -> ToolbarItemGroup<Void, Items>) -> some View
>
>
> /// Populates the toolbar or navigation bar with the specified items,
> /// allowing for user customization.
> ///
> /// - Parameters:
> /// - id: A unique identifier for this toolbar.
> /// - items: The items representing the content of the toolbar.
> public func toolbar<Items>(id: String, @ToolbarContentBuilder<String> items: () -> ToolbarItemGroup<String, Items>) -> some View
19748,19749c18629,18633
< /// Sets the style for lists within this view.
< public func listStyle<S>(_ style: S) -> some View where S : ListStyle
---
> /// Binds a view's identity to the given proxy value.
> ///
> /// When the proxy value specified by the `id` parameter changes, the
> /// identity of the view — for example, its state — is reset.
> @inlinable public func id<ID>(_ id: ID) -> some View where ID : Hashable
19756,19757c18640,18647
< /// Sets the style for text fields within this view.
< public func textFieldStyle<S>(_ style: S) -> some View where S : TextFieldStyle
---
> /// Uses the specified preference value from the view to produce another
> /// view as an overlay atop the first view.
> @inlinable public func overlayPreferenceValue<Key, T>(_ key: Key.Type = Key.self, @ViewBuilder _ transform: @escaping (Key.Value) -> T) -> some View where Key : PreferenceKey, T : View
>
>
> /// Uses the specified preference value from the view to produce another
> /// view as a background to the first view.
> @inlinable public func backgroundPreferenceValue<Key, T>(_ key: Key.Type = Key.self, @ViewBuilder _ transform: @escaping (Key.Value) -> T) -> some View where Key : PreferenceKey, T : View
19761,19764c18651
< @available(OSX 10.15, *)
< @available(iOS, unavailable)
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
---
> @available(iOS 14.0, OSX 10.16, tvOS 14.0, watchOS 7.0, *)
19767c18654,18667
< /// Sets the size for controls within this view.
---
> /// Adds a modifier for this view that fires an action when a specific
> /// value changes.
> ///
> /// You can use `onChange` to trigger a side effect as the result of a
> /// value changing, such as an `Environment` key or a `Binding`.
> ///
> /// `onChange` is called on the main thread. Avoid performing long-running
> /// tasks on the main thread. If you need to perform a long-running task in
> /// response to `value` changing, you should dispatch to a background queue.
> ///
> /// The new value is passed into the closure. The previous value may be
> /// captured by the closure to compare it to the new value. For example, in
> /// the following code example, `PlayerView` passes both the old and new
> /// values to the model.
19769,19771c18669,18671
< /// Use `controlSize(_:)` to override the system default size for controls
< /// in this view. In this example, a view displays several typical controls
< /// at `.mini`, `.small` and `.regular` sizes.
---
> /// struct PlayerView : View {
> /// var episode: Episode
> /// @State private var playState: PlayState
19773d18672
< /// struct ControlSize: View {
19776,19781c18675,18677
< /// MyControls(label: "Mini")
< /// .controlSize(.mini)
< /// MyControls(label: "Small")
< /// .controlSize(.small)
< /// MyControls(label: "Regular")
< /// .controlSize(.regular)
---
> /// Text(episode.title)
> /// Text(episode.showTitle)
> /// PlayButton(playState: $playState)
19783,19785d18678
< /// .padding()
< /// .frame(width: 450)
< /// .border(Color.gray)
19787,19803c18680,18681
< /// }
< ///
< /// struct MyControls: View {
< /// var label: String
< /// @State private var value = 3.0
< /// @State private var selected = 1
< /// var body: some View {
< /// HStack {
< /// Text(label + ":")
< /// Picker("Selection", selection: $selected) {
< /// Text("option 1").tag(1)
< /// Text("option 2").tag(2)
< /// Text("option 3").tag(3)
< /// }
< /// Slider(value: $value, in: 1...10)
< /// Button("OK") { }
< /// }
---
> /// .onChange(of: playState) { [playState] newState in
> /// model.playStateDidChange(from: playState, to: newState)
19807,19808c18685,18689
< /// ![A screenshot showing several controls of various
< /// sizes.](SwiftUI-View-controlSize.png)
---
> /// - Parameters:
> /// - value: The value to check against when determining whether
> /// to run the closure.
> /// - action: A closure to run when the value changes.
> /// - newValue: The new value that failed the comparison check.
19810,19815c18691,18708
< /// - Parameter controlSize: One of the control sizes specified in the
< /// ``ControlSize`` enumeration.
< @available(iOS, unavailable)
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
< @inlinable public func controlSize(_ controlSize: ControlSize) -> some View
---
> /// - Returns: A view that fires an action when the specified value changes.
> @inlinable public func onChange<V>(of value: V, perform action: @escaping (V) -> Void) -> some View where V : Equatable
>
> }
>
> @available(iOS 14.0, OSX 10.16, tvOS 14.0, watchOS 7.0, *)
> extension View {
>
> /// Sets the style for progress views in this view.
> ///
> /// For example, the following code creates a progress view that uses the
> /// "circular" style:
> ///
> /// ProgressView()
> /// .progressViewStyle(CircularProgressViewStyle())
> ///
> /// - Parameter style: The progress view style to use for this view.
> public func progressViewStyle<S>(_ style: S) -> some View where S : ProgressViewStyle
19822c18715,18718
< /// Sets a clipping shape for this view.
---
> /// Specifies whether to hide this view from system accessibility features.
> public func accessibility(hidden: Bool) -> ModifiedContent<Self, AccessibilityAttachmentModifier>
>
> /// Adds a label to the view that describes its contents.
19824,19827c18720,18726
< /// Use `clipShape(_:style:)` to clip the view to the provided shape. By
< /// applying a clipping shape to a view, you preserve the parts of the view
< /// covered by the shape, while eliminating other parts of the view. The
< /// clipping shape itself isn't visible.
---
> /// Use this method to provide an accessibility label for a view that doesn't display text, like an icon.
> /// For example, you could use this method to label a button that plays music with the text "Play".
> /// Don't include text in the label that repeats information that users already have. For example,
> /// don't use the label "Play button" because a button already has a trait that identifies it as a button.
> public func accessibility(label: Text) -> ModifiedContent<Self, AccessibilityAttachmentModifier>
>
> /// Adds a textual description of the value that the view contains.
19829,19830c18728,18734
< /// For example, this code applies a circular clipping shape to a `Text`
< /// view:
---
> /// Use this method to describe the value represented by a view, but only if that's different than the
> /// view's label. For example, for a slider that you label as "Volume" using accessibility(label:),
> /// you can provide the current volume setting, like "60%", using accessibility(value:).
> public func accessibility(value: Text) -> ModifiedContent<Self, AccessibilityAttachmentModifier>
>
> /// Communicates to the user what happens after performing the view's
> /// action.
19832,19836c18736,18740
< /// Text("Clipped text in a circle")
< /// .frame(width: 175, height: 100)
< /// .foregroundColor(Color.white)
< /// .background(Color.black)
< /// .clipShape(Circle())
---
> /// Provide a hint in the form of a brief phrase, like "Purchases the item" or
> /// "Downloads the attachment".
> public func accessibility(hint: Text) -> ModifiedContent<Self, AccessibilityAttachmentModifier>
>
> /// Sets alternate input labels with which users identify a view.
19838,19839c18742,18743
< /// The resulting view shows only the portion of the text that lies within
< /// the bounds of the circle.
---
> /// Provide labels in descending order of importance. Voice Control
> /// and Full Keyboard Access use the input labels.
19841,19842c18745,18747
< /// ![A screenshot of text clipped to the shape of a
< /// circle.](SwiftUI-View-clipShape.png)
---
> /// > Note: If you don't specify any input labels, the user can still
> /// refer to the view using the accessibility label that you add with the
> /// ``accessibility(label:)`` modifier.
19844,19847c18749,18758
< /// - Parameters:
< /// - shape: The clipping shape to use for this view. The `shape` fills
< /// the view's frame, while maintaining its aspect ratio.
< /// - style: The fill style to use when rasterizing `shape`.
---
> /// - Parameter inputLabels: An array of Text elements to use as input labels.
> public func accessibility(inputLabels: [Text]) -> ModifiedContent<Self, AccessibilityAttachmentModifier>
>
> /// Adds the given traits to the view.
> public func accessibility(addTraits traits: AccessibilityTraits) -> ModifiedContent<Self, AccessibilityAttachmentModifier>
>
> /// Removes the given traits from this view.
> public func accessibility(removeTraits traits: AccessibilityTraits) -> ModifiedContent<Self, AccessibilityAttachmentModifier>
>
> /// Uses the specified string to identify the view.
19849,19851c18760,18761
< /// - Returns: A view that clips this view to `shape`, using `style` to
< /// define the shape's rasterization.
< @inlinable public func clipShape<S>(_ shape: S, style: FillStyle = FillStyle()) -> some View where S : Shape
---
> /// Use this value for testing. It isn't visible to the user.
> public func accessibility(identifier: String) -> ModifiedContent<Self, AccessibilityAttachmentModifier>
19852a18763,18768
> /// Sets a selection identifier for this view's accessibility element.
> ///
> /// Picker uses the value to determine what node to use for the
> /// accessibility value.
> @available(*, deprecated)
> public func accessibility(selectionIdentifier: AnyHashable) -> ModifiedContent<Self, AccessibilityAttachmentModifier>
19854c18770,18771
< /// Clips this view to its bounding rectangular frame.
---
> /// Sets the sort priority order for this view's accessibility element,
> /// relative to other elements at the same level.
19856,19857c18773,18786
< /// Use the `clipped(antialiased:)` modifier to hide any content that
< /// extends beyond the layout bounds of the shape.
---
> /// Higher numbers are sorted first. The default sort priority is zero.
> public func accessibility(sortPriority: Double) -> ModifiedContent<Self, AccessibilityAttachmentModifier>
>
> /// Specifies the point where activations occur in the view.
> public func accessibility(activationPoint: CGPoint) -> ModifiedContent<Self, AccessibilityAttachmentModifier>
>
> /// Specifies the unit point where activations occur in the view.
> public func accessibility(activationPoint: UnitPoint) -> ModifiedContent<Self, AccessibilityAttachmentModifier>
> }
>
> @available(iOS 14.0, OSX 10.16, tvOS 14.0, watchOS 7.0, *)
> extension View {
>
> /// Sets the tint effect associated with specific content in a list.
19859,19860c18788,18791
< /// By default, a view's bounding frame is used only for layout, so any
< /// content that extends beyond the edges of the frame is still visible.
---
> /// The containing list's style will apply that tint as appropriate. watchOS
> /// uses the tint color for its background platter appearance. Sidebars on
> /// iOS and macOS apply the tint color to their `ItemLabel` icons, which
> /// otherwise use the accent color by default.
19862,19866c18793,18798
< /// Text("This long text string is clipped")
< /// .fixedSize()
< /// .frame(width: 175, height: 100)
< /// .clipped()
< /// .border(Color.gray)
---
> /// - Parameter tint: The tint effect to use, or nil to not override the
> /// inherited tint.
> @inlinable public func listItemTint(_ tint: ListItemTint?) -> some View
>
>
> /// Sets a fixed tint color associated with specific content in a list.
19868,19869c18800,18801
< /// ![Screenshot showing text clipped to its
< /// frame.](SwiftUI-View-clipped.png)
---
> /// This is equivalent to using a tint of `ListItemTint.fixed(_:)` with the
> /// provided `tint` color.
19871,19873c18803,18806
< /// - Parameter antialiased: A Boolean value that indicates whether the
< /// rendering system applies smoothing to the edges of the clipping
< /// rectangle.
---
> /// The containing list's style will apply that tint as appropriate. watchOS
> /// uses the tint color for its background platter appearance. Sidebars on
> /// iOS and macOS apply the tint color to their `ItemLabel` icons, which
> /// otherwise use the accent color by default.
19875,19876c18808,18810
< /// - Returns: A view that clips this view to its bounding frame.
< @inlinable public func clipped(antialiased: Bool = false) -> some View
---
> /// - Parameter color: The color to use to tint the content, or nil to not
> /// override the inherited tint.
> @inlinable public func listItemTint(_ tint: Color?) -> some View
19877a18812,18815
> }
>
> @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
> extension View {
19879,19884c18817,18818
< /// Clips this view to its bounding frame, with the specified corner radius.
< ///
< /// By default, a view's bounding frame only affects its layout, so any
< /// content that extends beyond the edges of the frame remains visible. Use
< /// `cornerRadius(_:antialiased:)` to hide any content that extends beyond
< /// these edges while applying a corner radius.
---
> /// Rotates this view's rendered output in three dimensions around the given
> /// axis of rotation.
19886c18820,18822
< /// The following code applies a corner radius of 25 to a text view:
---
> /// Use `rotation3DEffect(_:axis:anchor:anchorZ:perspective:)` to rotate the
> /// view in three dimensions around the given axis of rotation, and
> /// optionally, position the view at a custom display order and perspective.
19888,19892c18824,18825
< /// Text("Rounded Corners")
< /// .frame(width: 175, height: 75)
< /// .foregroundColor(Color.white)
< /// .background(Color.black)
< /// .cornerRadius(25)
---
> /// In the example below, the text is rotated 45˚ about the `y` axis,
> /// front-most (the default `zIndex`) and default `perspective` (`1`):
19894,19895c18827,18829
< /// ![A screenshot of a rectangle with rounded corners bounding a text
< /// view.](SwiftUI-View-cornerRadius.png)
---
> /// Text("Rotation by passing an angle in degrees")
> /// .rotation3DEffect(.degrees(45), axis: (x: 0.0, y: 1.0, z: 0.0))
> /// .border(Color.gray)
19897,19899c18831,18832
< /// - Parameter antialiased: A Boolean value that indicates whether the
< /// rendering system applies smoothing to the edges of the clipping
< /// rectangle.
---
> /// ![A screenshot showing the rotation of text 45 degrees about the
> /// y-axis.](SwiftUI-View-rotation3DEffect.png)
19901,19903c18834,18844
< /// - Returns: A view that clips this view to its bounding frame with the
< /// specified corner radius.
< @inlinable public func cornerRadius(_ radius: CGFloat, antialiased: Bool = true) -> some View
---
> /// - Parameters:
> /// - angle: The angle at which to rotate the view.
> /// - axis: The `x`, `y` and `z` elements that specify the axis of
> /// rotation.
> /// - anchor: The location with a default of ``UnitPoint/center`` that
> /// defines a point in 3D space about which the rotation is anchored.
> /// - anchorZ: The location with a default of `0` that defines a point in
> /// 3D space about which the rotation is anchored.
> /// - perspective: The relative vanishing point with a default of `1` for
> /// this rotation.
> @inlinable public func rotation3DEffect(_ angle: Angle, axis: (x: CGFloat, y: CGFloat, z: CGFloat), anchor: UnitPoint = .center, anchorZ: CGFloat = 0, perspective: CGFloat = 1) -> some View
19910c18851,18868
< /// Applies an inset to the rows in a list.
---
> /// Transforms the environment value of the specified key path with the
> /// given function.
> @inlinable public func transformEnvironment<V>(_ keyPath: WritableKeyPath<EnvironmentValues, V>, transform: @escaping (inout V) -> Void) -> some View
>
> }
>
> @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
> extension View {
>
> /// Adds an accessibility scroll action to the view.
> public func accessibilityScrollAction(_ handler: @escaping (Edge) -> Void) -> ModifiedContent<Self, AccessibilityAttachmentModifier>
> }
>
> @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
> extension View {
>
> /// Assigns a name to the view's coordinate space, so other code can operate
> /// on dimensions like points and sizes relative to the named space.
19912,19913c18870,18871
< /// Use `listRowInsets(_:)` to change the default padding of the content of
< /// list items.
---
> /// Use `coordinateSpace(name:)` to allow another function to find and
> /// operate on a view and operate on dimensions relative to that view.
19915,19920c18873,18874
< /// In the example below, the `Flavor` enumeration provides content for list
< /// items. The SwiftUI ``List`` builder iterates over the `Flavor`
< /// enumeration and extracts the raw value of each of its elements using the
< /// resulting text to create each list row item. After the list builder
< /// finishes, the `listRowInsets(_:)` modifier changes the edge insets of
< /// each row of the list according to the ``EdgeInsets`` values you provide.
---
> /// The example below demonstrates how a nested view can find and operate on
> /// its enclosing view's coordinate space:
19922,19926c18876,18877
< /// struct ListRowInsets: View {
< /// enum Flavor: String, CaseIterable, Identifiable {
< /// var id: String { self.rawValue }
< /// case vanilla, chocolate, strawberry
< /// }
---
> /// struct ContentView: View {
> /// @State var location = CGPoint.zero
19929,19930c18880,18883
< /// List(Flavor.allCases, id: \.self) {
< /// Text($0.rawValue)
---
> /// VStack {
> /// Color.red.frame(width: 100, height: 100)
> /// .overlay(circle)
> /// Text("Location: \(Int(location.x)), \(Int(location.y))")
19932c18885,18897
< /// .listRowInsets(EdgeInsets(top: 0, leading: 75, bottom: 0, trailing: 0))
---
> /// .coordinateSpace(name: "stack")
> /// }
> ///
> /// var circle: some View {
> /// Circle()
> /// .frame(width: 25, height: 25)
> /// .gesture(drag)
> /// .padding(5)
> /// }
> ///
> /// var drag: some Gesture {
> /// DragGesture(coordinateSpace: .named("stack"))
> /// .onChanged { info in location = info.location }
19936c18901,18903
< /// - Parameter insets: ``EdgeInsets`` to apply to the edges of the view.
---
> /// Here, the ``VStack`` in the `ContentView` named “stack” is composed of a
> /// red frame with a custom ``Circle`` view ``View/overlay(_:alignment:)``
> /// at its center.
19938,19940c18905,18915
< /// - Returns: A view that uses the given edge insets when used as a list
< /// cell.
< @inlinable public func listRowInsets(_ insets: EdgeInsets?) -> some View
---
> /// The `circle` view has an attached ``DragGesture`` that targets the
> /// enclosing VStack's coordinate space. As the gesture recognizer's closure
> /// registers events inside `circle` it stores them in the shared `location`
> /// state variable and the ``VStack`` displays the coordinates in a ``Text``
> /// view.
> ///
> /// ![A screenshot showing an example of finding a named view and tracking
> /// relative locations in that view.](SwiftUI-View-coordinateSpace.png)
> ///
> /// - Parameter name: A name used to identify this coordinate space.
> @inlinable public func coordinateSpace<T>(name: T) -> some View where T : Hashable
19947,19963c18922
< /// Sets the alignment of multiline text in this view.
< ///
< /// Use `multilineTextAlignment(_:)` to select an alignment for all of the
< /// text in this view or view hierarchy.
< ///
< /// In the example below, the contents of the ``Text`` view are center
< /// aligned. This also applies to the interpolated newline placed in the
< /// middle of the text since "multiple lines" refers to all of the text
< /// inside the view, regardless of any internal formatting or inclusion of
< /// interpolated text.
< ///
< /// Text("This is a block of text that will show up in a text element as multiple lines.\("\n") Here we have chosen to center this text.")
< /// .frame(width: 200, height: 200, alignment: .leading)
< /// .multilineTextAlignment(.center)
< ///
< /// ![A screenshot showing the effect of text alignment in a
< /// view.](SwiftUI-view-multilineTextAlignment.png)
---
> /// Defines the content shape for hit testing.
19965,19966c18924,18927
< /// - Parameter alignment: A value that you use to left-, right-, or
< /// center-align the text within a view.
---
> /// - Parameters:
> /// - shape: The hit testing shape for the view.
> /// - eoFill: A Boolean that indicates whether the shape is interpreted
> /// with the even-odd winding number rule.
19968,19970c18929,18930
< /// - Returns: A view that aligns the lines of multiline ``Text`` instances
< /// it contains.
< @inlinable public func multilineTextAlignment(_ alignment: TextAlignment) -> some View
---
> /// - Returns: A view that uses the given shape for hit testing.
> @inlinable public func contentShape<S>(_ shape: S, eoFill: Bool = false) -> some View where S : Shape
19971a18932,18935
> }
>
> @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
> extension View {
19973,19998c18937,18938
< /// Sets the truncation mode for lines of text that are too long to fit in
< /// the available space.
< ///
< /// Use the `truncationMode(_:)` modifier to determine whether text in a
< /// long line is truncated at the beginning, middle, or end. Truncation is
< /// indicated by adding an ellipsis (…) to the line when removing text to
< /// indicate to readers that text is missing.
< ///
< /// In the example below, the bounds of text view constrains the amount of
< /// text that the view displays and the `truncationMode(_:)` specifies from
< /// which direction and where to display the truncation indicator:
< ///
< /// Text("This is a block of text that will show up in a text element as multiple lines. The text will fill the available space, and then, eventually, be truncated.")
< /// .frame(width: 150, height: 150)
< /// .truncationMode(.tail)
< ///
< /// ![A screenshot showing the effect of truncation mode on text in a
< /// view.](SwiftUI-view-truncationMode.png)
< ///
< /// - Parameter mode: The truncation mode that specifies where to truncate
< /// the text within the text view, if needed. You can truncate at the
< /// beginning, middle, or end of the text view.
< ///
< /// - Returns: A view that truncates text at different points in a line
< /// depending on the mode you select.
< @inlinable public func truncationMode(_ mode: Text.TruncationMode) -> some View
---
> /// Sets a value for the given preference.
> @inlinable public func preference<K>(key: K.Type = K.self, value: K.Value) -> some View where K : PreferenceKey
19999a18940,18943
> }
>
> @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
> extension View {
20001,20009c18945,18946
< /// Sets the amount of space between lines of text in this view.
< ///
< /// Use `lineSpacing(_:)` to set the amount of spacing from the bottom of
< /// one line to the top of the next for text elements in the view.
< ///
< /// In the ``Text`` view in the example below, 10 points separate the bottom
< /// of one line to the top of the next as the text field wraps inside this
< /// view. Applying `lineSpacing(_:)` to a view hierarchy applies the line
< /// spacing to all text elements contained in the view.
---
> /// Applies the given transaction mutation function to all transactions used
> /// within the view.
20011,20013c18948,18950
< /// Text("This is a string in a TextField with 10 point spacing applied between the bottom of one line and the top of the next.")
< /// .frame(width: 200, height: 200, alignment: .leading)
< /// .lineSpacing(10)
---
> /// Use this modifier on leaf views rather than container views. The
> /// transformation applies to all child views within this view; calling
> /// `transaction(_:)` on a container view can lead to unbounded scope.
20015,20016c18952,18953
< /// ![A screenshot showing the effects of setting line spacing on the text
< /// in a view.](SwiftUI-view-lineSpacing.png)
---
> /// - Parameter transform: The transformation to apply to transactions
> /// within this view.
20018,20020c18955,18957
< /// - Parameter lineSpacing: The amount of space between the bottom of one
< /// line and the top of the next line in points.
< @inlinable public func lineSpacing(_ lineSpacing: CGFloat) -> some View
---
> /// - Returns: A view that wraps this view and applies `transformation` to
> /// all transactions used within the view.
> @inlinable public func transaction(_ transform: @escaping (inout Transaction) -> Void) -> some View
20023,20045c18960
< /// Sets whether text in this view can compress the space between characters
< /// when necessary to fit text in a line.
< ///
< /// Use `allowsTightening(_:)` to enable the compression of inter-character
< /// spacing of text in a view to try to fit the text in the view's bounds.
< ///
< /// In the example below, two identically configured text views show the
< /// effects of `allowsTightening(_:)` on the compression of the spacing
< /// between characters:
< ///
< /// VStack {
< /// Text("This is a wide text element")
< /// .font(.body)
< /// .frame(width: 200, height: 50, alignment: .leading)
< /// .lineLimit(1)
< /// .allowsTightening(true)
< ///
< /// Text("This is a wide text element")
< /// .font(.body)
< /// .frame(width: 200, height: 50, alignment: .leading)
< /// .lineLimit(1)
< /// .allowsTightening(false)
< /// }
---
> /// Applies the given animation to all animatable values within this view.
20047,20048c18962,18964
< /// ![A screenshot showing the effect of enabling text tightening in a
< /// view.](SwiftUI-view-allowsTightening.png)
---
> /// Use this modifier on leaf views rather than container views. The
> /// animation applies to all child views within this view; calling
> /// `animation(_:)` on a container view can lead to unbounded scope.
20050,20051c18966,18967
< /// - Parameter flag: A Boolean value that indicates whether the space
< /// between characters compresses when necessary.
---
> /// - Parameter animation: The animation to apply to animatable values
> /// within this view.
20053,20055c18969,18971
< /// - Returns: A view that can compress the space between characters when
< /// necessary to fit text in a line.
< @inlinable public func allowsTightening(_ flag: Bool) -> some View
---
> /// - Returns: A view that wraps this view and applies `animation` to all
> /// animatable values used within the view.
> @inlinable public func animation(_ animation: Animation?) -> some View
20056a18973,18976
> }
>
> @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
> extension View {
20058,20083c18978,18979
< /// Sets the maximum number of lines that text can occupy in this view.
< ///
< /// Use `lineLimit(_:)` to cap the number of lines that an individual text
< /// element can display.
< ///
< /// The line limit applies to all ``Text`` instances within a hierarchy. For
< /// example, an ``HStack`` with multiple pieces of text longer than three
< /// lines caps each piece of text to three lines rather than capping the
< /// total number of lines across the ``HStack``.
< ///
< /// In the example below, the `lineLimit(_:)` operator limits the very long
< /// line in the ``Text`` element to the 2 lines that fit within the view's
< /// bounds:
< ///
< /// Text("This is a long string that demonstrates the effect of SwuiftUI's lineLimit(:_) operator.")
< /// .frame(width: 200, height: 200, alignment: .leading)
< /// .lineLimit(2)
< ///
< /// ![A screenshot showing showing the effect of the line limit operator on
< /// a very long string in a view.](SwiftUI-view-lineLimit.png)
< ///
< /// - Parameter number: The line limit. If `nil`, no line limit applies.
< ///
< /// - Returns: A view that limits the number of lines that ``Text``
< /// instances display.
< @inlinable public func lineLimit(_ number: Int?) -> some View
---
> /// Wraps this view as a new accessibility element.
> public func accessibilityElement(children: AccessibilityChildBehavior = .ignore) -> some View
20084a18981,18984
> }
>
> @available(iOS 14.0, OSX 10.16, tvOS 14.0, watchOS 7.0, *)
> extension View {
20086,20104c18986
< /// Sets the minimum amount that text in this view scales down to fit in the
< /// available space.
< ///
< /// Use the `minimumScaleFactor(_:)` modifier if the text you place in a
< /// view doesn't fit and it's okay if the text shrinks to accommodate. For
< /// example, a label with a minimum scale factor of `0.5` draws its text in
< /// a font size as small as half of the actual font if needed.
< ///
< /// In the example below, the ``HStack`` contains a ``Text`` label with a
< /// line limit of `1`, that is next to a ``TextField``. To allow the label
< /// to fit into the available space, the `minimumScaleFactor(_:)` modifier
< /// shrinks the text as needed to fit into the available space.
< ///
< /// HStack {
< /// Text("This is a long label that will be scaled to fit:")
< /// .lineLimit(1)
< /// .minimumScaleFactor(0.5)
< /// TextField("My Long Text Field", text: $myTextField)
< /// }
---
> /// Advertises a user activity type.
20106,20107c18988,18989
< /// ![A screenshot showing the effect of setting a minimumScaleFactor on
< /// text in a view.](SwiftUI-View-minimumScaleFactor.png)
---
> /// You can use `userActivity(_:isActive:_:)` to start, stop, or modify the
> /// advertisement of a specific type of user activity.
20109,20110c18991,18992
< /// - Parameter factor: A fraction between 0 and 1 (inclusive) you use to
< /// specify the minimum amount of text scaling that this view permits.
---
> /// The scope of the activity applies only to the scene or window the
> /// view is in.
20112,20113c18994,19000
< /// - Returns: A view that limits the amount of text downscaling.
< @inlinable public func minimumScaleFactor(_ factor: CGFloat) -> some View
---
> /// - Parameters:
> /// - activityType: The type of activity to advertise.
> /// - isActive: When `false`, avoids advertising the activity. Defaults
> /// to `true`.
> /// - update: A function that modifies the passed-in activity for
> /// advertisement.
> public func userActivity(_ activityType: String, isActive: Bool = true, _ update: @escaping (NSUserActivity) -> ()) -> some View
20116,20117c19003
< /// Sets a transform for the case of the text contained in this view when
< /// displayed.
---
> /// Advertises a user activity type.
20119,20120c19005,19006
< /// The default value is `nil`, displaying the `Text` without any case
< /// changes.
---
> /// The scope of the activity applies only to the scene or window the
> /// view is in.
20122,20126c19008,19018
< /// - Parameter textCase: One of the ``Text.Case`` enumerations; the
< /// default is `nil`.
< /// - Returns: A view that transforms the case of `Text`.
< @available(iOS 14.0, OSX 10.16, tvOS 14.0, watchOS 7.0, *)
< @inlinable public func textCase(_ textCase: Text.Case?) -> some View
---
> /// - Parameters:
> /// - activityType: The type of activity to advertise.
> /// - element: If the element is `nil`, the handler will not be
> /// associated with the activity (and if there are no handlers, no
> /// activity is advertised). The method passes the non-`nil` element to
> /// the handler as a convenience so the handlers don't all need to
> /// implement an early exit with
> /// `guard element = element else { return }`.
> /// - update: A function that modifies the passed-in activity for
> /// advertisement.
> public func userActivity<P>(_ activityType: String, element: P?, _ update: @escaping (P, NSUserActivity) -> ()) -> some View
20130c19022
< @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
---
> @available(iOS 14.0, OSX 10.16, tvOS 14.0, watchOS 7.0, *)
20133,20134c19025,19034
< /// Applies a transformation to a preference value.
< @inlinable public func transformPreference<K>(_ key: K.Type = K.self, _ callback: @escaping (inout K.Value) -> Void) -> some View where K : PreferenceKey
---
> /// Registers a handler to invoke when the view receives the specified
> /// activity type for the scene or window the view is in.
> ///
> /// - Parameters:
> /// - activityType: The type of activity to handle.
> /// - action: A function to call that takes a
> /// <doc://com.apple.documentation/Foundation/NSUserActivity>
> /// object as its parameter
> /// when delivering the activity to the scene or window the view is in.
> public func onContinueUserActivity(_ activityType: String, perform action: @escaping (NSUserActivity) -> ()) -> some View
20138,20140c19038
< @available(iOS 14.0, OSX 10.16, *)
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
---
> @available(iOS 14.0, OSX 10.16, tvOS 14.0, watchOS 7.0, *)
20143c19041,19042
< /// Sets the style for group boxes within this view.
---
> /// Registers a handler to invoke when the view receives a url for the
> /// scene or window the view is in.
20145,20146c19044,19052
< /// - Parameter style: The style to apply to boxes within this view.
< public func groupBoxStyle<S>(_ style: S) -> some View where S : GroupBoxStyle
---
> /// > Note: This method handles the reception of Universal Links,
> /// rather than a
> /// <doc://com.apple.documentation/Foundation/NSUserActivity>.
> ///
> /// - Parameter action: A function that takes a
> /// <doc://com.apple.documentation/documentation/Foundation/URL>
> /// object as its parameter when delivering the URL to the scene or window
> /// the view is in.
> public func onOpenURL(perform action: @escaping (URL) -> ()) -> some View
20192,20195c19098
< @available(macCatalyst 14.0, OSX 10.16, *)
< @available(iOS, unavailable)
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
---
> @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
20198,20200c19101,19102
< /// Sets the style for the toolbar in windows created by
< /// interacting with this view.
< public func presentedWindowToolbarStyle<S>(_ style: S) -> some View where S : WindowToolbarStyle
---
> /// Sets the style for text fields within this view.
> public func textFieldStyle<S>(_ style: S) -> some View where S : TextFieldStyle
20207,20214c19109,19126
< /// Uses the specified preference value from the view to produce another
< /// view as an overlay atop the first view.
< @inlinable public func overlayPreferenceValue<Key, T>(_ key: Key.Type = Key.self, @ViewBuilder _ transform: @escaping (Key.Value) -> T) -> some View where Key : PreferenceKey, T : View
<
<
< /// Uses the specified preference value from the view to produce another
< /// view as a background to the first view.
< @inlinable public func backgroundPreferenceValue<Key, T>(_ key: Key.Type = Key.self, @ViewBuilder _ transform: @escaping (Key.Value) -> T) -> some View where Key : PreferenceKey, T : View
---
> /// Masks this view using the alpha channel of the given view.
> ///
> /// Use `mask(_:)` when you want to apply the alpha (opacity) value of
> /// another view to the current view.
> ///
> /// This example shows an image masked by rectangle with a 10% opacity:
> ///
> /// Image(systemName: "envelope.badge.fill")
> /// .foregroundColor(Color.blue)
> /// .font(.system(size: 128, weight: .regular))
> /// .mask(Rectangle().opacity(0.1))
> ///
> /// ![A screenshot of a view masked by a rectangle with 10%
> /// opacity.](SwiftUI-View-mask.png)
> ///
> /// - Parameter mask: The view whose alpha the rendering system applies to
> /// the specified view.
> @inlinable public func mask<Mask>(_ mask: Mask) -> some View where Mask : View
20218c19130
< @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
---
> @available(iOS 14.0, OSX 10.16, tvOS 14.0, watchOS 7.0, *)
20221,20225c19133
< /// Assigns a name to the view's coordinate space, so other code can operate
< /// on dimensions like points and sizes relative to the named space.
< ///
< /// Use `coordinateSpace(name:)` to allow another function to find and
< /// operate on a view and operate on dimensions relative to that view.
---
> /// Configures the view's title for purposes of navigation.
20227,20228c19135,19143
< /// The example below demonstrates how a nested view can find and operate on
< /// its enclosing view's coordinate space:
---
> /// A view's navigation title is used to visually display
> /// the current navigation state of an interface.
> /// On iOS and watchOS, when a view is navigated to inside
> /// of a navigation view, that view's title is displayed
> /// in the navigation bar. On iPadOS, the primary destination's
> /// navigation title is reflected as the window's title in the
> /// App Switcher. Similarly on macOS, the primary destination's title
> /// is used as the window title in the titlebar, Windows menu
> /// and Mission Control.
20230,20231c19145,19150
< /// struct ContentView: View {
< /// @State var location = CGPoint.zero
---
> /// - Parameter title: The title to display.
> public func navigationTitle(_ title: Text) -> some View
>
>
> /// Configures the view's title for purposes of navigation,
> /// using a localized string.
20233,20240c19152,19160
< /// var body: some View {
< /// VStack {
< /// Color.red.frame(width: 100, height: 100)
< /// .overlay(circle)
< /// Text("Location: \(Int(location.x)), \(Int(location.y))")
< /// }
< /// .coordinateSpace(name: "stack")
< /// }
---
> /// A view's navigation title is used to visually display
> /// the current navigation state of an interface.
> /// On iOS and watchOS, when a view is navigated to inside
> /// of a navigation view, that view's title is displayed
> /// in the navigation bar. On iPadOS, the primary destination's
> /// navigation title is reflected as the window's title in the
> /// App Switcher. Similarly on macOS, the primary destination's title
> /// is used as the window title in the titlebar, Windows menu
> /// and Mission Control.
20242,20247c19162,19166
< /// var circle: some View {
< /// Circle()
< /// .frame(width: 25, height: 25)
< /// .gesture(drag)
< /// .padding(5)
< /// }
---
> /// - Parameter titleKey: The key to a localized string to display.
> public func navigationTitle(_ titleKey: LocalizedStringKey) -> some View
>
>
> /// Configures the view's title for purposes of navigation, using a string.
20249,20253c19168,19176
< /// var drag: some Gesture {
< /// DragGesture(coordinateSpace: .named("stack"))
< /// .onChanged { info in location = info.location }
< /// }
< /// }
---
> /// A view's navigation title is used to visually display
> /// the current navigation state of an interface.
> /// On iOS and watchOS, when a view is navigated to inside
> /// of a navigation view, that view's title is displayed
> /// in the navigation bar. On iPadOS, the primary destination's
> /// navigation title is reflected as the window's title in the
> /// App Switcher. Similarly on macOS, the primary destination's title
> /// is used as the window title in the titlebar, Windows menu
> /// and Mission Control.
20255,20257c19178,19189
< /// Here, the ``VStack`` in the `ContentView` named “stack” is composed of a
< /// red frame with a custom ``Circle`` view ``View/overlay(_:alignment:)``
< /// at its center.
---
> /// - Parameter title: The string to display.
> public func navigationTitle<S>(_ title: S) -> some View where S : StringProtocol
>
> }
>
> @available(iOS 14.0, *)
> @available(OSX, unavailable)
> @available(tvOS, unavailable)
> @available(watchOS, unavailable)
> extension View {
>
> /// Configures the title display mode for this view.
20259,20263c19191,19206
< /// The `circle` view has an attached ``DragGesture`` that targets the
< /// enclosing VStack's coordinate space. As the gesture recognizer's closure
< /// registers events inside `circle` it stores them in the shared `location`
< /// state variable and the ``VStack`` displays the coordinates in a ``Text``
< /// view.
---
> /// - Parameter displayMode: The style to use for displaying the title.
> public func navigationBarTitleDisplayMode(_ displayMode: NavigationBarItem.TitleDisplayMode) -> some View
>
> }
>
> @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
> extension View {
>
> /// Adds an accessibility adjustable action to the view.
> public func accessibilityAdjustableAction(_ handler: @escaping (AccessibilityAdjustmentDirection) -> Void) -> ModifiedContent<Self, AccessibilityAttachmentModifier>
> }
>
> @available(iOS 14.0, OSX 10.16, tvOS 14.0, watchOS 7.0, *)
> extension View {
>
> /// The default store used by `AppStorage` contained within the view.
20265,20266c19208,19211
< /// ![A screenshot showing an example of finding a named view and tracking
< /// relative locations in that view.](SwiftUI-View-coordinateSpace.png)
---
> /// If unspecified, the default store for a view hierarchy is
> /// `UserDefaults.standard`, but can be set a to a custom one. For example,
> /// sharing defaults between an app and an extension can override the
> /// default store to one created with `UserDefaults.init(suiteName:_)`.
20268,20269c19213,19215
< /// - Parameter name: A name used to identify this coordinate space.
< @inlinable public func coordinateSpace<T>(name: T) -> some View where T : Hashable
---
> /// - Parameter store: The user defaults to use as the default
> /// store for `AppStorage`.
> public func defaultAppStorage(_ store: UserDefaults) -> some View
20273c19219,19221
< @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
---
> @available(iOS 14.0, OSX 10.16, *)
> @available(tvOS, unavailable)
> @available(watchOS, unavailable)
20276c19224,19225
< /// Supplies an `ObservableObject` to a view subhierachy.
---
> /// Defines the destination of a drag-and-drop operation that handles the
> /// dropped content with a closure that you specify.
20278c19227,19287
< /// The object can be read by any child by using `EnvironmentObject`.
---
> /// The drop destination is the same size and position as this view.
> ///
> /// - Parameters:
> /// - supportedContentTypes: The uniform type identifiers that describe the
> /// types of content this view can accept through drag and drop.
> /// If the drag and drop operation doesn't contain any of the supported
> /// types, then this drop destination doesn't activate and `isTargeted`
> /// doesn't update.
> /// - isTargeted: A binding that updates when a drag and drop operation
> /// enters or exits the drop target area. The binding's value is `true` when
> /// the cursor is inside the area, and `false` when the cursor is outside.
> /// - action: A closure that takes the dropped content and responds
> /// appropriately. The parameter to `action` contains the dropped
> /// items, with types specified by `supportedContentTypes`. Return `true`
> /// if the drop operation was successful; otherwise, return `false`.
> ///
> /// - Returns: A view that provides a drop destination for a drag
> /// operation of the specified types.
> public func onDrop(of supportedContentTypes: [UTType], isTargeted: Binding<Bool>?, perform action: @escaping ([NSItemProvider]) -> Bool) -> some View
>
>
> /// Defines the destination of a drag and drop operation that handles the
> /// dropped content with a closure that you specify.
> ///
> /// The drop destination is the same size and position as this view.
> ///
> /// - Parameters:
> /// - supportedContentTypes: The uniform type identifiers that describe
> /// the types of content this view can accept through drag and drop.
> /// If the drag and drop operation doesn't contain any of the supported
> /// types, then this drop destination doesn't activate and `isTargeted`
> /// doesn't update.
> /// - isTargeted: A binding that updates when a drag and drop operation
> /// enters or exits the drop target area. The binding's value is `true` when
> /// the cursor is inside the area, and `false` when the cursor is outside.
> /// - action: A closure that takes the dropped content and responds
> /// appropriately. The first parameter to `action` contains the dropped
> /// items, with types specified by `supportedContentTypes`. The second
> /// parameter contains the drop location in this view's coordinate
> /// space. Return `true` if the drop operation was successful;
> /// otherwise, return `false`.
> ///
> /// - Returns: A view that provides a drop destination for a drag
> /// operation of the specified types.
> public func onDrop(of supportedContentTypes: [UTType], isTargeted: Binding<Bool>?, perform action: @escaping ([NSItemProvider], CGPoint) -> Bool) -> some View
>
>
> /// Defines the destination of a drag and drop operation using behavior
> /// controlled by the delegate that you provide.
> ///
> /// The drop destination is the same size and position as this view.
> ///
> /// - Parameters:
> /// - supportedContentTypes: The uniform type identifiers that describe the
> /// types of content this view can accept through drag and drop.
> /// If the drag and drop operation doesn't contain any of the supported
> /// types, then this drop destination doesn't activate and `isTargeted`
> /// doesn't update.
> /// - delegate: A type that conforms to the ``DropDelegate`` protocol. You
> /// have comprehensive control over drop behavior when you use a
> /// delegate.
20280,20282c19289,19291
< /// - Parameter bindable: the object to store and make available to
< /// the view's subhiearchy.
< @inlinable public func environmentObject<B>(_ bindable: B) -> some View where B : ObservableObject
---
> /// - Returns: A view that provides a drop destination for a drag
> /// operation of the specified types.
> public func onDrop(of supportedContentTypes: [UTType], delegate: DropDelegate) -> some View
20286,20287c19295,19297
< @available(OSX 10.15, tvOS 13.0, *)
< @available(iOS, unavailable)
---
> @available(iOS, introduced: 13.4, deprecated: 100000.0, message: "Provide `UTType`s as the `supportedContentTypes` instead.")
> @available(OSX, introduced: 10.15, deprecated: 100000.0, message: "Provide `UTType`s as the `supportedContentTypes` instead.")
> @available(tvOS, unavailable)
20291,20294c19301,19321
< /// Adds an action to perform in response to a move command, like when the
< /// user presses an arrow key on a Mac keyboard, or taps the edge of the
< /// Siri Remote when controlling an Apple TV.
< @available(iOS, unavailable)
---
> /// Defines the destination for a drag and drop operation, using the same
> /// size and position as this view, handling dropped content with the given
> /// closure.
> ///
> /// - Parameters:
> /// - supportedTypes: The uniform type identifiers that describe the
> /// types of content this view can accept through drag and drop.
> /// If the drag and drop operation doesn't contain any of the supported
> /// types, then this drop destination doesn't activate and `isTargeted`
> /// doesn't update.
> /// - isTargeted: A binding that updates when a drag and drop operation
> /// enters or exits the drop target area. The binding's value is `true`
> /// when the cursor is inside the area, and `false` when the cursor is
> /// outside.
> /// - action: A closure that takes the dropped content and responds
> /// appropriately. The parameter to `action` contains the dropped
> /// items, with types specified by `supportedTypes`. Return `true`
> /// if the drop operation was successful; otherwise, return `false`.
> /// - Returns: A view that provides a drop destination for a drag
> /// operation of the specified types.
> @available(tvOS, unavailable)
20296c19323
< public func onMoveCommand(perform action: ((MoveCommandDirection) -> Void)?) -> some View
---
> public func onDrop(of supportedTypes: [String], isTargeted: Binding<Bool>?, perform action: @escaping ([NSItemProvider]) -> Bool) -> some View
20299,20300c19326,19328
< /// Sets up an action that triggers in response to receiving the exit
< /// command while the view has focus.
---
> /// Defines the destination for a drag and drop operation with the same size
> /// and position as this view, handling dropped content and the drop
> /// location with the given closure.
20302,20304c19330,19348
< /// The user generates an exit command by pressing the Menu button on tvOS,
< /// or the escape key on macOS.
< @available(iOS, unavailable)
---
> /// - Parameters:
> /// - supportedTypes: The uniform type identifiers that describe the
> /// types of content this view can accept through drag and drop.
> /// If the drag and drop operation doesn't contain any of the supported
> /// types, then this drop destination doesn't activate and `isTargeted`
> /// doesn't update.
> /// - isTargeted: A binding that updates when a drag and drop operation
> /// enters or exits the drop target area. The binding's value is `true`
> /// when the cursor is inside the area, and `false` when the cursor is
> /// outside.
> /// - action: A closure that takes the dropped content and responds
> /// appropriately. The first parameter to `action` contains the dropped
> /// items, with types specified by `supportedTypes`. The second
> /// parameter contains the drop location in this view's coordinate
> /// space. Return `true` if the drop operation was successful;
> /// otherwise, return `false`.
> /// - Returns: A view that provides a drop destination for a drag
> /// operation of the specified types.
> @available(tvOS, unavailable)
20306c19350
< public func onExitCommand(perform action: (() -> Void)?) -> some View
---
> public func onDrop(of supportedTypes: [String], isTargeted: Binding<Bool>?, perform action: @escaping ([NSItemProvider], CGPoint) -> Bool) -> some View
20309,20310c19353,19367
< /// Adds an action to perform in response to the system's Delete command.
< @available(iOS, unavailable)
---
> /// Defines the destination for a drag and drop operation with the same size
> /// and position as this view, with behavior controlled by the given
> /// delegate.
> ///
> /// - Parameters:
> /// - supportedTypes: The uniform type identifiers that describe the
> /// types of content this view can accept through drag and drop.
> /// If the drag and drop operation doesn't contain any of the supported
> /// types, then this drop destination doesn't activate and `isTargeted`
> /// doesn't update.
> /// - delegate: A type that conforms to the `DropDelegate` protocol. You
> /// have comprehensive control over drop behavior when you use a
> /// delegate.
> /// - Returns: A view that provides a drop destination for a drag
> /// operation of the specified types.
20313c19370
< public func onDeleteCommand(perform action: (() -> Void)?) -> some View
---
> public func onDrop(of supportedTypes: [String], delegate: DropDelegate) -> some View
20320,20323c19377
< /// Hides the labels of any controls contained within this view.
< ///
< /// Use `labelsHidden()` when it would not be appropriate to show a
< /// label near controls in the context of your user interface.
---
> /// Applies a projection transformation to this view's rendered output.
20325,20328c19379
< /// Although the labels are not visually laid out alongside the controls,
< /// the control's label text is still often required, because it is used
< /// for other purposes including accessibility. This example shows two
< /// controls where the first control’s label is hidden.
---
> /// Use `projectionEffect(_:)` to apply a 3D transformation to the view.
20330c19381,19382
< /// In the example below, one of the toggles has its label hidden:
---
> /// The example below rotates the text 30˚ around the `z` axis, which is the
> /// axis pointing out of the screen:
20332,20336c19384,19386
< /// VStack {
< /// Toggle(isOn: $toggle1) {
< /// Text("Toggle1")
< /// }
< /// .labelsHidden()
---
> /// // This transform represents a 30˚ rotation around the z axis.
> /// let transform = CATransform3DMakeRotation(
> /// -30 * (.pi / 180), 0.0, 0.0, 1.0)
20338,20341c19388,19390
< /// Toggle(isOn: $toggle2) {
< /// Text("Toggle2")
< /// }
< /// }
---
> /// Text("Projection effects using transforms")
> /// .projectionEffect(.init(transform))
> /// .border(Color.gray)
20343,20344c19392,19393
< /// ![A screenshot showing a view with two toggle controls where one label
< /// is visible and the other label is hidden.](SwiftUI-Vew-labelsHidden.png)
---
> /// ![A screenshot showing text rotated 30 degrees around the axis pointing
> /// out of the screen.](SwiftUI-View-projectionEffect.png)
20346,20350c19395,19396
< /// > Note: This modifier does not work for all labels. It applies to
< /// labels that are external/separate from the rest of the control's
< /// interface like `Toggle`, but not to controls like a bordered button
< /// where the label is inside the button's border.
< public func labelsHidden() -> some View
---
> /// - Parameter transform: A ``ProjectionTransform`` to apply to the view.
> @inlinable public func projectionEffect(_ transform: ProjectionTransform) -> some View
20357c19403
< /// Sets the tint effect associated with specific content in a list.
---
> /// Adds help text to a view using a localized string that you provide.
20359,20362c19405,19406
< /// The containing list's style will apply that tint as appropriate. watchOS
< /// uses the tint color for its background platter appearance. Sidebars on
< /// iOS and macOS apply the tint color to their `ItemLabel` icons, which
< /// otherwise use the accent color by default.
---
> /// Adding help to a view configures the view's accessibility hint and
> /// its tooltip ("help tag") on macOS.
20364,20366c19408,19418
< /// - Parameter tint: The tint effect to use, or nil to not override the
< /// inherited tint.
< @inlinable public func listItemTint(_ tint: ListItemTint?) -> some View
---
> /// For more information on using help tags, see [Help]
> /// (https://developer.apple.com/design/human-interface-guidelines/macos/user-interaction/help/)
> /// in the macOS Human Interface Guidelines.
> ///
> /// Button(action: composeMessage) {
> /// Image(systemName: "square.and.pencil")
> /// }
> /// .help("Compose a new message")
> ///
> /// - Parameter textKey: The key for the localized text to use as help.
> public func help(_ textKey: LocalizedStringKey) -> some View
20369c19421
< /// Sets a fixed tint color associated with specific content in a list.
---
> /// Adds help text to a view using a text view that you provide.
20371,20372c19423,19424
< /// This is equivalent to using a tint of `ListItemTint.fixed(_:)` with the
< /// provided `tint` color.
---
> /// Adding help to a view configures the view's accessibility hint and
> /// its tooltip ("help tag") on macOS.
20374,20377c19426,19428
< /// The containing list's style will apply that tint as appropriate. watchOS
< /// uses the tint color for its background platter appearance. Sidebars on
< /// iOS and macOS apply the tint color to their `ItemLabel` icons, which
< /// otherwise use the accent color by default.
---
> /// For more information on using help tags, see [Help]
> /// (https://developer.apple.com/design/human-interface-guidelines/macos/user-interaction/help/)
> /// in the macOS Human Interface Guidelines.
20379,20381c19430,19451
< /// - Parameter color: The color to use to tint the content, or nil to not
< /// override the inherited tint.
< @inlinable public func listItemTint(_ tint: Color?) -> some View
---
> /// Slider("Opacity", value: $selectedShape.opacity)
> /// .help(Text("Adjust the opacity of the selected \(selectedShape.name)"))
> ///
> /// - Parameter text: The Text view to use as help.
> public func help(_ text: Text) -> some View
>
>
> /// Adds help text to a view using a string that you provide.
> ///
> /// Adding help to a view configures the view's accessibility hint and
> /// its tooltip ("help tag") on macOS.
> ///
> /// For more information on using help tags, see [Help]
> /// (https://developer.apple.com/design/human-interface-guidelines/macos/user-interaction/help/)
> /// in the macOS Human Interface Guidelines.
> ///
> /// Image(systemName: "pin.circle")
> /// .foregroundColor(pointOfInterest.tintColor)
> /// .help(pointOfInterest.name)
> ///
> /// - Parameter text: The text to use as help.
> public func help<S>(_ text: S) -> some View where S : StringProtocol
20385,20386c19455,19457
< @available(iOS 14.0, OSX 10.16, tvOS 14.0, *)
< @available(watchOS, unavailable)
---
> @available(iOS 13.0, watchOS 6.0, *)
> @available(OSX, unavailable)
> @available(tvOS, unavailable)
20389,20390c19460
< /// Sets the style used for displaying the control
< /// (see `SignInWithAppleButton.Style`).
---
> /// Sets the visibility of the status bar.
20392,20393c19462,19469
< /// - Parameter style: The sign in style to apply to this button.
< public func signInWithAppleButtonStyle(_ style: SignInWithAppleButton.Style) -> some View
---
> /// Use `statusBar(hidden:)` to show or hide the status bar.
> ///
> /// - Parameter hidden: A Boolean value that indicates whether to hide the
> /// status bar.
> @available(OSX, unavailable)
> @available(tvOS, unavailable)
> @available(watchOS, unavailable)
> public func statusBar(hidden: Bool) -> some View
20397c19473
< @available(iOS 14.0, OSX 10.16, tvOS 14.0, watchOS 7.0, *)
---
> @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
20400,20401c19476
< /// Populates the toolbar or navigation bar with items
< /// whose content is the specified views.
---
> /// Supplies an `ObservableObject` to a view subhierachy.
20403,20404c19478,19482
< /// - Parameter content: The views representing the content of the toolbar.
< public func toolbar<Content>(@ViewBuilder content: () -> Content) -> some View where Content : View
---
> /// The object can be read by any child by using `EnvironmentObject`.
> ///
> /// - Parameter bindable: the object to store and make available to
> /// the view's subhiearchy.
> @inlinable public func environmentObject<B>(_ bindable: B) -> some View where B : ObservableObject
20405a19484,19487
> }
>
> @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
> extension View {
20407c19489
< /// Populates the toolbar or navigation bar with the specified items.
---
> /// Presents an alert to the user.
20409,20410c19491,19498
< /// - Parameter items: The items representing the content of the toolbar.
< public func toolbar<Items>(@ToolbarContentBuilder<Void> items: () -> ToolbarItemGroup<Void, Items>) -> some View
---
> /// - Parameters:
> /// - item: A binding to an optional source of truth for the alert.
> /// When representing a non-`nil` item, the system uses `content` to
> /// create an alert representation of the item.
> /// If the identity changes, the system dismisses a
> /// currently-presented alert and replace it by a new alert.
> /// - content: A closure returning the alert to present.
> public func alert<Item>(item: Binding<Item?>, content: (Item) -> Alert) -> some View where Item : Identifiable
20413,20414c19501
< /// Populates the toolbar or navigation bar with the specified items,
< /// allowing for user customization.
---
> /// Presents an alert to the user.
20417,20419c19504,19506
< /// - id: A unique identifier for this toolbar.
< /// - items: The items representing the content of the toolbar.
< public func toolbar<Items>(id: String, @ToolbarContentBuilder<String> items: () -> ToolbarItemGroup<String, Items>) -> some View
---
> /// - isPresented: A binding to whether the alert should be shown.
> /// - content: A closure returning the alert to present.
> public func alert(isPresented: Binding<Bool>, content: () -> Alert) -> some View
20423,20426c19510,19511
< @available(OSX 10.15, *)
< @available(iOS, unavailable)
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
---
> @available(iOS 13.0, tvOS 13.0, watchOS 6.0, *)
> @available(OSX, unavailable)
20429,20430c19514,19520
< /// Sets the style for radio group style pickers within this view to be
< /// horizontally positioned with the radio buttons inside the layout.
---
> /// Sets the navigation bar items for this view.
> ///
> /// Use `navigationBarItems(leading:trailing:)` to add navigation bar items
> /// to the leading and trailing edges of the navigation bar for this view.
> ///
> /// This modifier only takes effect when this view is inside of and visible
> /// within a ``NavigationView``.
20432,20434c19522,19524
< /// Use `horizontalRadioGroupLayout()` to configure the visual layout of
< /// radio buttons in a ``Picker`` so that the radio buttons are arranged
< /// horizontally in the view.
---
> /// On iOS 14 and later, the leading item supplements a visible back button,
> /// instead of replacing it, by default. To hide the back button, use
> /// ``View/navigationBarBackButtonHidden(_:)``.
20436,20439c19526,19527
< /// The example below shows two ``Picker`` controls configured as radio
< /// button groups; the first group shows the default vertical layout; the
< /// second group shows the effect of `horizontalRadioGroupLayout()` which
< /// renders the radio buttons horizontally.
---
> /// The example below adds buttons to the leading and trailing edges of
> /// the button area of the navigation view:
20441,20442c19529
< /// struct HorizontalRadioGroupLayout: View {
< /// @State private var selected = 1
---
> /// struct FlavorView: View {
20444,20449c19531,19535
< /// VStack(spacing: 20) {
< /// Picker(selection: $selected, label: Text("Favorite Color")) {
< /// Text("Red").tag(1)
< /// Text("Green").tag(2)
< /// Text("Blue").tag(3)
< /// Text("Other").tag(4)
---
> /// NavigationView {
> /// List {
> /// Text("Chocolate")
> /// Text("Vanilla")
> /// Text("Strawberry")
20451c19537,19576
< /// .pickerStyle(RadioGroupPickerStyle())
---
> /// .navigationBarTitle(Text("Today‘s Flavors"))
> /// .navigationBarItems(leading:
> /// HStack {
> /// Button("Hours") {
> /// print("Hours tapped!")
> /// }
> /// }, trailing:
> /// HStack {
> /// Button("Favorites") {
> /// print("Favorites tapped!")
> /// }
> ///
> /// Button("Specials") {
> /// print("Specials tapped!")
> /// }
> /// }
> /// )
> /// }
> /// }
> /// }
> ///
> /// - Parameters:
> /// - leading: A view that appears on the leading edge of the title.
> /// - trailing: A view that appears on the trailing edge of the title.
> @available(OSX, unavailable)
> @available(watchOS, unavailable)
> public func navigationBarItems<L, T>(leading: L, trailing: T) -> some View where L : View, T : View
>
>
> /// Sets the navigation bar items for this view.
> ///
> /// Use `navigationBarItems(leading:)` to add navigation bar items to the
> /// leading edge of the navigation bar for this view.
> ///
> /// This modifier only takes effect when this view is inside of and visible
> /// within a ``NavigationView``.
> ///
> /// On iOS 14 and later, the leading item supplements a visible back button,
> /// instead of replacing it, by default. To hide the back button, use
> /// ``View/navigationBarBackButtonHidden(_:)``.
20453,20457c19578,19587
< /// Picker(selection: $selected, label: Text("Favorite Color")) {
< /// Text("Red").tag(1)
< /// Text("Green").tag(2)
< /// Text("Blue").tag(3)
< /// Text("Other").tag(4)
---
> /// The example below adds buttons to the leading edge of the button area
> /// of the navigation view:
> ///
> /// struct FlavorView: View {
> /// var body: some View {
> /// NavigationView {
> /// List {
> /// Text("Chocolate")
> /// Text("Vanilla")
> /// Text("Strawberry")
20459,20460c19589,19600
< /// .pickerStyle(RadioGroupPickerStyle())
< /// .horizontalRadioGroupLayout()
---
> /// .navigationBarTitle(Text("Today's Flavors"))
> /// .navigationBarItems(leading:
> /// HStack {
> /// Button("Hours") {
> /// print("Hours tapped!")
> /// }
> ///
> /// Button("Help") {
> /// print("Help tapped!")
> /// }
> /// }
> /// )
20462,20463d19601
< /// .padding(20)
< /// .border(Color.gray)
20467,20470c19605,19607
< /// ![A screenshot showing radio button groups laid out horizontally and
< /// vertically.](SwiftUI-view-horizontalRadioGroupLayout.png)
< @available(iOS, unavailable)
< @available(tvOS, unavailable)
---
> /// - Parameter leading: A view that appears on the leading edge of the
> /// title.
> @available(OSX, unavailable)
20472c19609
< public func horizontalRadioGroupLayout() -> some View
---
> public func navigationBarItems<L>(leading: L) -> some View where L : View
20474,20477d19610
< }
<
< @available(iOS 14.0, OSX 10.16, tvOS 14.0, watchOS 7.0, *)
< extension View {
20479c19612
< /// Sets the style for progress views in this view.
---
> /// Configures the navigation bar items for this view.
20481,20482c19614,19617
< /// For example, the following code creates a progress view that uses the
< /// "circular" style:
---
> /// Use `navigationBarItems(trailing:)` to add navigation bar items to the
> /// trailing edge of the navigation bar for this view. This modifier only
> /// takes effect when this view is inside of and visible within a
> /// ``NavigationView``.
20484,20485c19619,19644
< /// ProgressView()
< /// .progressViewStyle(CircularProgressViewStyle())
---
> /// The example below adds buttons to the trailing edge of the button area
> /// of the navigation view:
> ///
> /// struct FlavorView: View {
> /// var body: some View {
> /// NavigationView {
> /// List {
> /// Text("Chocolate")
> /// Text("Vanilla")
> /// Text("Strawberry")
> /// }
> /// .navigationBarTitle(Text("Today‘s Flavors"))
> /// .navigationBarItems(trailing:
> /// HStack {
> /// Button("Hours") {
> /// print("Hours tapped!")
> /// }
> ///
> /// Button("Help") {
> /// print("Help tapped!")
> /// }
> /// }
> /// )
> /// }
> /// }
> /// }
20487,20488c19646,19649
< /// - Parameter style: The progress view style to use for this view.
< public func progressViewStyle<S>(_ style: S) -> some View where S : ProgressViewStyle
---
> /// - Parameter trailing: A view shown on the trailing edge of the title.
> @available(OSX, unavailable)
> @available(watchOS, unavailable)
> public func navigationBarItems<T>(trailing: T) -> some View where T : View
20655a19817,19834
> extension ViewModifier where Self.Body == Never {
>
> /// Gets the current body of the caller.
> ///
> /// `content` is a proxy for the view that will have the modifier
> /// represented by `Self` applied to it.
> public func body(content: Self.Content) -> Self.Body
> }
>
> @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
> extension ViewModifier {
>
> /// Returns a new modifier that is the result of concatenating
> /// `self` with `modifier`.
> @inlinable public func concat<T>(_ modifier: T) -> ModifiedContent<Self, T>
> }
>
> @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
20670,20671c19849,19855
< @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
< extension ViewModifier where Self.Body == Never {
---
> /// A system style of date picker that displays each component as columns
> /// in a scrollable wheel.
> @available(iOS 13.0, *)
> @available(OSX, unavailable)
> @available(tvOS, unavailable)
> @available(watchOS, unavailable)
> public struct WheelDatePickerStyle : DatePickerStyle {
20673,20677c19857
< /// Gets the current body of the caller.
< ///
< /// `content` is a proxy for the view that will have the modifier
< /// represented by `Self` applied to it.
< public func body(content: Self.Content) -> Self.Body
---
> public init()
20680,20681c19860,19869
< @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
< extension ViewModifier {
---
> /// A `PickerStyle` where the options are contained in a scrollable
> /// wheel, with the selected option and a few neighboring options are
> /// always visible.
> ///
> /// Because most options will not be visible, it's best to predictably
> /// order them, such as alphabetically.
> @available(iOS 13.0, watchOS 6.0, *)
> @available(OSX, unavailable)
> @available(tvOS, unavailable)
> public struct WheelPickerStyle : PickerStyle {
20683,20685c19871
< /// Returns a new modifier that is the result of concatenating
< /// `self` with `modifier`.
< @inlinable public func concat<T>(_ modifier: T) -> ModifiedContent<Self, T>
---
> public init()
21058,21073d20243
< /// A specification for the appearance and interaction of a window.
< @available(macCatalyst 14.0, OSX 10.16, *)
< @available(iOS, unavailable)
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
< public protocol WindowStyle {
< }
<
< /// A specification for the appearance and behavior of a window's toolbar.
< @available(macCatalyst 14.0, OSX 10.16, *)
< @available(iOS, unavailable)
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
< public protocol WindowToolbarStyle {
< }
<
21112a20283,20290
> extension NSDirectionalEdgeInsets {
>
> /// Create edge insets from the equivalent EdgeInsets.
> @available(iOS 14.0, OSX 10.16, tvOS 14.0, *)
> @available(watchOS, unavailable)
> public init(_ edgeInsets: EdgeInsets)
> }
>
21114c20292
< extension Optional : View where Wrapped : View {
---
> extension Never {
21121,21123d20298
< }
<
< extension NSDirectionalEdgeInsets {
21125,21128c20300,20301
< /// Create edge insets from the equivalent EdgeInsets.
< @available(iOS 14.0, OSX 10.16, tvOS 14.0, *)
< @available(watchOS, unavailable)
< public init(_ edgeInsets: EdgeInsets)
---
> /// The content and behavior of the view.
> public var body: Never { get }
21132c20305
< extension Float : VectorArithmetic {
---
> extension CGPoint {
21134,21135c20307,20313
< /// Multiplies each component of this value by the given value.
< public mutating func scale(by rhs: Double)
---
> public func applying(_ m: ProjectionTransform) -> CGPoint
> }
>
> @available(iOS 14.0, OSX 10.16, *)
> @available(tvOS, unavailable)
> @available(watchOS, unavailable)
> extension Never {
21137,21138c20315,20319
< /// Returns the dot-product of this vector arithmetic instance with itself.
< public var magnitudeSquared: Double { get }
---
> /// The type of widget representing the body of this widget.
> ///
> /// When you create a custom view, Swift infers this type from your
> /// implementation of the required `body` property.
> public typealias WidgetBody = Never
21142,21145c20323
< extension Double : VectorArithmetic {
<
< /// Multiplies each component of this value by the given value.
< public mutating func scale(by rhs: Double)
---
> extension Never : Gesture {
21147,21148c20325,20326
< /// Returns the dot-product of this vector arithmetic instance with itself.
< public var magnitudeSquared: Double { get }
---
> /// The type representing the gesture's value.
> public typealias Value = Never
21150a20329,20331
> /// Extends `T?` to conform to `Gesture` type if `T` also conforms to
> /// `Gesture`. A nil value is mapped to an empty (i.e. failing)
> /// gesture.
21152c20333
< extension CGFloat : VectorArithmetic {
---
> extension Optional : Gesture where Wrapped : Gesture {
21154,21155c20335,20340
< /// Multiplies each component of this value by the given value.
< public mutating func scale(by rhs: Double)
---
> /// The type representing the gesture's value.
> public typealias Value = Wrapped.Value
> }
>
> @available(iOS 14.0, OSX 10.16, tvOS 14.0, watchOS 7.0, *)
> extension NSUserActivity {
21157,21158c20342,20407
< /// Returns the dot-product of this vector arithmetic instance with itself.
< public var magnitudeSquared: Double { get }
---
> /// Error types when getting/setting typed payload
> @available(iOS 14.0, OSX 10.16, tvOS 14.0, watchOS 7.0, *)
> public enum TypedPayloadError : Error {
>
> /// UserInfo is empty or invalid
> case invalidContent
>
> /// Content failed to encode into a valid Dictionary
> case encodingError
>
> /// Returns a Boolean value indicating whether two values are equal.
> ///
> /// Equality is the inverse of inequality. For any values `a` and `b`,
> /// `a == b` implies that `a != b` is `false`.
> ///
> /// - Parameters:
> /// - lhs: A value to compare.
> /// - rhs: Another value to compare.
> public static func == (a: NSUserActivity.TypedPayloadError, b: NSUserActivity.TypedPayloadError) -> Bool
>
> /// The hash value.
> ///
> /// Hash values are not guaranteed to be equal across different executions of
> /// your program. Do not save hash values to use during a future execution.
> ///
> /// - Important: `hashValue` is deprecated as a `Hashable` requirement. To
> /// conform to `Hashable`, implement the `hash(into:)` requirement instead.
> public var hashValue: Int { get }
>
> /// Hashes the essential components of this value by feeding them into the
> /// given hasher.
> ///
> /// Implement this method to conform to the `Hashable` protocol. The
> /// components used for hashing must be the same as the components compared
> /// in your type's `==` operator implementation. Call `hasher.combine(_:)`
> /// with each of these components.
> ///
> /// - Important: Never call `finalize()` on `hasher`. Doing so may become a
> /// compile-time error in the future.
> ///
> /// - Parameter hasher: The hasher to use when combining the components
> /// of this instance.
> public func hash(into hasher: inout Hasher)
> }
>
> /// Given a Codable Swift type, return an instance decoded from the
> /// NSUserActivity's userInfo dictionary
> ///
> /// - Parameter type: the instance type to be decoded from userInfo
> /// - Returns: the type safe instance or raises if it can't be decoded
> public func typedPayload<T>(_ type: T.Type) throws -> T where T : Decodable, T : Encodable
>
> /// Given an instance of a Codable Swift type, encode it into the
> /// NSUserActivity's userInfo dictionary
> ///
> /// - Parameter payload: the instance to be converted to userInfo
> public func setTypedPayload<T>(_ payload: T) throws where T : Decodable, T : Encodable
> }
>
> extension Never : Scene {
> }
>
> @available(iOS 14.0, OSX 10.16, *)
> @available(tvOS, unavailable)
> @available(watchOS, unavailable)
> extension Never : WidgetConfiguration {
21161c20410,20411
< extension NSColor {
---
> @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
> extension Optional : View where Wrapped : View {
21163,21167c20413,20418
< @available(OSX 10.16, *)
< @available(iOS, unavailable)
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
< public convenience init(_ color: Color)
---
> /// The type of gesture representing the body of `Self`.
> public typealias Body = Never
> }
>
> @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
> extension Never : View {
21187,21190c20438
< @available(iOS 14.0, OSX 10.16, *)
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
< extension Never {
---
> extension UIColor {
21192,21196c20440,20442
< /// The type of widget representing the body of this widget.
< ///
< /// When you create a custom view, Swift infers this type from your
< /// implementation of the required `body` property.
< public typealias WidgetBody = Never
---
> @available(iOS 14.0, tvOS 14.0, watchOS 7.0, *)
> @available(OSX, unavailable)
> public convenience init(_ color: Color)
21199,21200c20445
< @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
< extension CGPoint {
---
> extension UIUserInterfaceStyle {
21202c20447,20451
< public func applying(_ m: ProjectionTransform) -> CGPoint
---
> /// Creates a user interface style from its ColorScheme equivalent.
> @available(iOS 14.0, tvOS 14.0, *)
> @available(OSX, unavailable)
> @available(watchOS, unavailable)
> public init(_ colorScheme: ColorScheme?)
21205,21206c20454
< @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
< extension Never : Gesture {
---
> extension UIAccessibilityContrast {
21208,21215c20456,20460
< /// The type representing the gesture's value.
< public typealias Value = Never
< }
<
< @available(iOS 14.0, OSX 10.16, *)
< @available(tvOS, unavailable)
< @available(watchOS, unavailable)
< extension Never : WidgetConfiguration {
---
> /// Create a contrast from its ColorSchemeContrast equivalent.
> @available(iOS 14.0, tvOS 14.0, *)
> @available(OSX, unavailable)
> @available(watchOS, unavailable)
> public init(_ colorSchemeContrast: ColorSchemeContrast?)
21218,21219c20463
< @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
< extension Never {
---
> extension UIContentSizeCategory {
21221,21228c20465,20469
< /// The type of view representing the body of this view.
< ///
< /// When you create a custom view, Swift infers this type from your
< /// implementation of the required `body` property.
< public typealias Body = Never
<
< /// The content and behavior of the view.
< public var body: Never { get }
---
> /// Create a size category from its ContentSizeCategory equivalent.
> @available(iOS 14.0, tvOS 14.0, *)
> @available(OSX, unavailable)
> @available(watchOS, unavailable)
> public init(_ sizeCategory: ContentSizeCategory?)
21231,21235c20472
< /// Extends `T?` to conform to `Gesture` type if `T` also conforms to
< /// `Gesture`. A nil value is mapped to an empty (i.e. failing)
< /// gesture.
< @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
< extension Optional : Gesture where Wrapped : Gesture {
---
> extension UITraitEnvironmentLayoutDirection {
21237,21238c20474,20478
< /// The type representing the gesture's value.
< public typealias Value = Wrapped.Value
---
> /// Create a direction from its LayoutDirection equivalent.
> @available(iOS 14.0, tvOS 14.0, *)
> @available(OSX, unavailable)
> @available(watchOS, unavailable)
> public init(_ layoutDirection: LayoutDirection)
21241c20481,20487
< extension Never : Scene {
---
> extension UILegibilityWeight {
>
> /// Creates a legibility weight from its LegibilityWeight equivalent.
> @available(iOS 14.0, tvOS 14.0, *)
> @available(OSX, unavailable)
> @available(watchOS, unavailable)
> public init(_ legibilityWeight: LegibilityWeight?)
21244,21245c20490,20497
< @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
< extension Never : View {
---
> extension UIUserInterfaceSizeClass {
>
> /// Create a size class from its UserInterfaceSizeClass equivalent.
> @available(iOS 14.0, *)
> @available(OSX, unavailable)
> @available(tvOS, unavailable)
> @available(watchOS, unavailable)
> public init(_ sizeClass: UserInterfaceSizeClass?)
21277a20530,20559
> @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
> extension Float : VectorArithmetic {
>
> /// Multiplies each component of this value by the given value.
> public mutating func scale(by rhs: Double)
>
> /// Returns the dot-product of this vector arithmetic instance with itself.
> public var magnitudeSquared: Double { get }
> }
>
> @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
> extension Double : VectorArithmetic {
>
> /// Multiplies each component of this value by the given value.
> public mutating func scale(by rhs: Double)
>
> /// Returns the dot-product of this vector arithmetic instance with itself.
> public var magnitudeSquared: Double { get }
> }
>
> @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
> extension CGFloat : VectorArithmetic {
>
> /// Multiplies each component of this value by the given value.
> public mutating func scale(by rhs: Double)
>
> /// Returns the dot-product of this vector arithmetic instance with itself.
> public var magnitudeSquared: Double { get }
> }
>
21283a20566
>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment