View

public protocol View : TypeErasedView

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 body computed property to provide the content for your custom view.

  • The type of the body property defining the subtree of Views of this View.

    Declaration

    Swift

    associatedtype Body : View
  • body Default implementation

    The body property is used to delegate the generation of html for a specific node to another view. It should be set for all view which enclose other views in order to allow the layout system to propagate properties properly through the tree.

    Default Implementation

    Declaration

    Swift

    var body: Body { get }
  • font(_:) Extension method

    Undocumented

    Declaration

    Swift

    public func font(_ font: Font) -> some View
  • layoutAxis Extension method

    Declaration

    Swift

    var layoutAxis: LayoutAxis { get }
  • html(forHTMLOfSubnodes:) Extension method

    Declaration

    Swift

    func html(forHTMLOfSubnodes htmlOfSubnodes: [HTMLNode]) -> HTMLNode
  • mapBody(_:) Extension method

    Declaration

    Swift

    public func mapBody<T>(_ transform: (TypeErasedView) -> T) -> [T]
  • map(_:) Extension method

    Declaration

    Swift

    public func map<T>(_ transform: (TypeErasedView) -> T) -> [T]

View modifiers

  • cornerRadius(_:) Extension method

    Undocumented

    Declaration

    Swift

    func cornerRadius(_ radius: Double) -> some View
  • shadow(color:radius:x:y:) Extension method

    Undocumented

    Declaration

    Swift

    func shadow(color: Color = Color(white: 0.0).opacity(0.20),
                radius: Double = 40.0,
                x: Double = 0.0,
                y: Double = 2.0
    ) -> some View
  • padding(_:_:) Extension method

    Undocumented

    Declaration

    Swift

    func padding(_ edges: Edge.Set = .all, _ length: Double? = nil) -> some View
  • padding(_:) Extension method

    Undocumented

    Declaration

    Swift

    func padding(_ length: Double? = nil) -> some View
  • border(_:width:) Extension method

    Undocumented

    Declaration

    Swift

    func border(_ color: Color, width: Double = 1) -> some View
  • disabled(_:) Extension method

    Undocumented

    Declaration

    Swift

    func disabled(_ disabled: Bool) -> some View
  • foregroundColor(_:) Extension method

    Undocumented

    Declaration

    Swift

    func foregroundColor(_ color: Color?) -> some View
  • Undocumented

    Declaration

    Swift

    func frame(width: Double? = nil,
               height: Double? = nil,
               minWidth: Double? = nil,
               minHeight: Double? = nil) -> some View
  • globalOverlay(_:) Extension method

    Undocumented

    Declaration

    Swift

    func globalOverlay<Overlay>(@ViewBuilder _ overlay: () -> Overlay) -> some View where Overlay : View
  • Undocumented

    Declaration

    Swift

    func navigationBarTitle(_ title: String,
                            displayMode: NavigationBarItem.TitleDisplayMode = .automatic) -> some View
  • Undocumented

    Declaration

    Swift

    func navigationBarItems<T>(trailing: T) -> some View where T : View
  • Undocumented

    Declaration

    Swift

    func onPreferenceChange<K>(_ key: K.Type = K.self,
                               perform action: @escaping (K.Value) -> Void)
        -> some View where K : PreferenceKey
  • preference(key:value:) Extension method

    Undocumented

    Declaration

    Swift

    func preference<K>(key _: K.Type = K.self, value: K.Value)
        -> some View where K : PreferenceKey
  • sheet(isPresented:content:) Extension method

    Undocumented

    Declaration

    Swift

    func sheet<Content>(isPresented: Binding<Bool>, @ViewBuilder content: () -> Content) -> some View where Content : View
  • tabItem(_:) Extension method

    Undocumented

    Declaration

    Swift

    func tabItem<V>(@ViewBuilder _ label: () -> V) -> some View where V : View
  • tag(_:) Extension method

    Undocumented

    Declaration

    Swift

    func tag<V>(_ tag: V) -> some View where V : Hashable
  • onTapGesture(perform:) Extension method

    Undocumented

    Declaration

    Swift

    func onTapGesture(perform action: @escaping () -> Void) -> some View
  • keyboardType(_:) Extension method

    Undocumented

    Declaration

    Swift

    func keyboardType(_ type: UIKeyboardType) -> some View
  • background(_:) Extension method

    Undocumented

    Declaration

    Swift

    func background<Background>(_ background: Background) -> some View where Background : View