Protocols
The following protocols are available globally.
-
A type that can be uniquely identified.
See moreDeclaration
Swift
public protocol Identifiable
-
Views conforming to this protocol won’t depend on the
See morebody
to render. Instead, the view will depend oncreateView
andupdateView
. For internal use in the AltSwiftUI library.Declaration
Swift
public protocol Renderable
-
A type that represents a view.
See moreDeclaration
Swift
public protocol View
-
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
See moreEditor -> 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.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 andObservedObject
property wrappers for observing the object from a view.Declaration
Swift
public protocol ObservableObject : AnyObject
-
Declaration
Swift
public protocol UIViewControllerRepresentable : Renderable, View
-
Declaration
Swift
public protocol UIViewRepresentable : Renderable, View
-
This protocol represents a stream of actions that will be performed based on the implemented gesture.
See moreDeclaration
Swift
public protocol Gesture
-
A type that specifies how the style of a button is changed.
See moreDeclaration
Swift
public protocol ButtonStyle
-
A type that can create a modified version of a view.
See moreDeclaration
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