New chat
TODO: collapasable, copyable, download, etc
Can you make a list of all of the UI elements available when you are designing a SwiftUI project?When designing a SwiftUI project, you have access to a wide range of UI elements, also known as views, to create your user interface. Below is a comprehensive list of common SwiftUI views and controls available up to my last update in April 2023. Keep in mind that SwiftUI is continually evolving, so it's a good idea to check the latest documentation for any new additions or changes.
Basic Views
- Text: Display one or more lines of text.
- Image: Display an image.
- Shape: Draw vector-based shapes (Rectangle, Circle, Ellipse, Capsule, etc.).
Containers
- VStack: Arrange views vertically.
- HStack: Arrange views horizontally.
- ZStack: Overlay views on top of each other.
- ScrollView: Scrollable container for views.
- LazyVStack: Lazily loads vertical views as needed.
- LazyHStack: Lazily loads horizontal views as needed.
- List: Display a list of items in a single column.
- Form: Group controls used for data entry, like in settings.
- NavigationView: Manage a navigation-based view hierarchy.
- TabView: Display multiple tabs for content switching.
- Group: Group multiple views without affecting the layout.
- GroupBox: A stylized view with an optional label for grouping content.
- Section: Group content within a List, Form, or other container views.
- Grid: Flexible grid layouts are introduced in newer versions of SwiftUI, including LazyVGrid and LazyHGrid for creating grid-based layouts.
Controls and Buttons
- Button: Trigger an action.
- EditButton: Automatically toggles an edit mode.
- Link: Open a URL in the browser.
- Menu: Display a menu of actions.
- ContextMenu: Contextual menu appearing upon a long press.
- Picker: Select from multiple options.
- DatePicker: Select a date and time.
- TimePicker: Specifically for picking time (introduced in later versions).
- Toggle: A switch to toggle between on/off states.
- Slider: Select from a range of values.
- Stepper: Increment or decrement a value.
- SegmentedControl: Segmented control for selecting between options (using
Picker
with a specific style).
Text and Labels
- TextField: Editable text input.
- TextEditor: Multiline, scrollable text editing.
- Label: Text paired with an icon.
- SecureField: Editable text input for secure text (passwords).
Value Indicators
- ProgressView: Display progress.
- ActivityIndicator: Show a loading state (using
ProgressView
in SwiftUI).
Layout and Alignment
- Spacer: Flexible space that expands along the major axis of its containing stack.
- Divider: A visual divider line.
- Alignment: Align views relative to each other or to the container.
- GeometryReader: Read the geometry of the parent view for more complex layouts.
Animation and Transition
- Animation: Animate changes in views.
- Transition: Animate the insertion and removal of views.
Miscellaneous
- ColorPicker: Pick a color.
- Canvas: Draw custom graphics using immediate mode drawing.
- Popover: Present content in a floating popover.
- Sheet: Present content modally over the current view.
Accessibility
- Accessibility modifiers: Customize how your UI is presented to and interacted with by assistive technologies.
This list covers the most commonly used SwiftUI elements and views. For the most accurate and up-to-date information, refer to Apple's official SwiftUI documentation or the latest SwiftUI tutorials and guides.
New chat created at Tue Jan 20 1970 18:11:07 GMT+0000 (Coordinated Universal Time)Related Chats
Reusable SwiftUI custom view. 0.692
Shared ViewModel Across Views 0.621
Handling App Exit 0.601
SwiftUI RealityKit Integration 0.591
SwiftUI iOS App: Features 0.564
Draw Rects & Ovals 0.552
MultipeerManager Error Fix 0.552
Immersive View Phases 0.549