Protocols

The following protocols are available globally.

Data

  • A type that can be uniquely identified.

    See more

    Declaration

    Swift

    public protocol Identifiable
  • Views conforming to this protocol won’t depend on the body to render. Instead, the view will depend on createView and updateView. For internal use in the AltSwiftUI library.

    See more

    Declaration

    Swift

    public protocol Renderable
  • A type that represents a view.

    See more

    Declaration

    Swift

    public protocol View

Public Types

  • A type that produces AltSwiftUI view previews in Xcode.

    Xcode statically discovers types that conform to the AltPreviewProvider protocol in your app, and generates previews for each provider it discovers.

    Note: In case you can’t get the preview window to show, make sure Editor -> Canvas is enabled. Additionally, you can access another file whose canvas is properly showing, and then pin it so that it is visible in all files.

    See more

    Declaration

    Swift

    @available(iOS 13.0.0, *)
    public protocol AltPreviewProvider : PreviewProvider
  • An object that can be observed. Use this in conjunction with Published property wrappers inside the object and ObservedObject property wrappers for observing the object from a view.

    Declaration

    Swift

    public protocol ObservableObject : AnyObject

UIViewControllerRepresentable

UIViewRepresentable

Public Types

  • This protocol represents a stream of actions that will be performed based on the implemented gesture.

    See more

    Declaration

    Swift

    public protocol Gesture
  • A type that specifies how the style of a button is changed.

    See more

    Declaration

    Swift

    public protocol ButtonStyle
  • A type that can create a modified version of a view.

    See more

    Declaration

    Swift

    public protocol ViewModifier
  • A protocol that describes the behavior and appearance of a list.

    Declaration

    Swift

    public protocol ListStyle
  • Type that represents the appearance and functionality of a Picker.

    Declaration

    Swift

    public protocol PickerStyle
  • Declaration

    Swift

    public protocol Shape : Renderable, View