This repository has been archived by the owner on Jun 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 147
Add What's new in SwiftUI [WWDC22] #231
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
--- | ||
contributors: Jeehut | ||
--- | ||
|
||
- New SwiftUI app structure!? | ||
- Apple is using SwiftUI more internally now | ||
|
||
## Swift Charts | ||
|
||
- `Chart` view that takes data, `BarMark`, `LineMark` and other views inside | ||
- `.foregroundStyle(by: ...)` helps declaratively specify details | ||
- `.symbol(by: ...)` to declaratively specify details in chart | ||
- `.annotation` supported, e.g. for marks | ||
- supports dark mode automatically (like any SwiftUI view) | ||
- Smart defaults for legends etc. | ||
|
||
## Navigation and windows | ||
|
||
### Stacks | ||
|
||
- `NavigationStack` a new container view for push/pop style navigation | ||
- wraps a root content view | ||
- works with `NavigationLink` and `.navigationTitle` | ||
- New data-driven APIs: `.navigationDestination(for: ...)` | ||
- `NavigationLink` can now take a value that represents a destination | ||
- now also supported on macOS | ||
|
||
### Split Views | ||
|
||
- `NavigationSplitView` for multi-column navigation | ||
- can declare 2- or 3-column layouts | ||
- accepts a `detail` view | ||
- Split view adapts on resize automatically | ||
- works with stack together for complex navigation structures | ||
|
||
### Scene | ||
|
||
- `Window` added for single unique windows of an app (not a group) | ||
- appears automatically in `Windows` menu bar | ||
- `.keyboardShortcut` to open the window easily | ||
- new @Environment action openWindow available to call for navigation | ||
- `.defaultPosition` and `defaultSize` for default positions of windows | ||
- `.presentationDetents` modifier allows resizable sheets, e.g. with two different sizes | ||
- Menu bar extras now entirely in SwiftUI via `MenuBarExtra` | ||
- always shown in Menu Bar while app is running | ||
- also possible to just provide a `MenuBarExtra` in an app as root scene | ||
|
||
## Advanced controls | ||
|
||
### Forms | ||
|
||
- new settings app design in macOS uses new navigation SwiftUI views | ||
- New `.formStyle(.grouped)` for forms to improve forms on macOS | ||
- `LabeledContent` used to build new controls or just read-only information | ||
- allows selection for simple data | ||
|
||
- SwiftUI is now smarter in formatting text in Forms | ||
- New popup menu pickers in iOS (macOS inspired dropdowns) | ||
|
||
### Controls | ||
|
||
- `TextField` can now have an expanding `axis` specified (e.g. `.vertical` | ||
- `.lineLimit(5...10)` range helps expanding with min lines | ||
- `MultiDatePicker` available now, too | ||
- `DisclosureGroup` to combine multiple toggles in one toggle | ||
- `Picker` also mixable with toggles … (didn’t understand) | ||
- New button style | ||
- `Stepper` with `format` parameter, now also available on watchOS | ||
- `.accessibilityQuickAction` with button for easy accessibility | ||
|
||
### Tables | ||
|
||
- `Table` now supported on iPadOS | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yay! Can close that feedback 💯 |
||
- Will render also on iPhone with a primary column | ||
- new `.contextMenu` modifier with multiple selections possible | ||
- allows to define advanced context menus | ||
- new `.toolbar` in iPadOS, customizable by specifying explicit `id` | ||
- placement: `.secondaryAction` to be used for toolbar items | ||
- `.searchable` modifier now accepts `tokens:` for tokenized inputs | ||
- it also supports `scope:` for search scopes (filters) | ||
|
||
## Sharing | ||
|
||
### Photos Picker | ||
|
||
- `PhotosPicker` view anywhere in app, presents picker UI | ||
- takes a binding to a selected `PhotosPickerItem` | ||
- filtering type of content and more customizable | ||
|
||
### Sharing | ||
|
||
- watchOS supports `ShareLink` view, provide content and preview | ||
- adapt to the `.contextMenu` they’re applied to | ||
|
||
### Transferable | ||
|
||
- Makes drag & drop easy | ||
- `.dropDestination` with `payloadType`, comes with closure for received data | ||
- many standard types conform to `Transferable` | ||
- Implement in custom types by conforming to `representation: some TransferRepresentation` | ||
|
||
## Graphics and layout | ||
|
||
### Shape Styles | ||
|
||
- new `.gradient` property on color | ||
- new `.shadow` property on color, too | ||
- Combined with SFSymbols, easy to make great custom icons | ||
- soft glow via `.ellipticalGradient` for example | ||
- Text and Image animatoins are taken to “the next level”, just use `withAnimation` | ||
|
||
### Layout | ||
|
||
- new `Grid` container view that arranges views in 2D grid | ||
- enables automatic alignments across rows and colunns | ||
- `Grid`, `GridRow` and `.gridCellColumns` APIs to specify | ||
- new `Layout` protocol for even more customization | ||
- new `AnyLayout` type to switch between layouts easily |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! This probably closes johnpatrickmorgan/FlowStacks#8 @johnpatrickmorgan