orbit-swiftui
orbit-swiftui copied to clipboard
Use native SwiftUI environment keys
Some components might use existing environment keys or modifiers in favour of parameters.
Available related environment keys
- #401
- #404
-
lineLimit
,lineSpacing
,multilineTextAlignment
,textCase
,truncationMode
: could be used in Text/Heading to be able to inject text-based modifiers inside. - A
font
override could be supported as well.
-
-
defaultMinListRowHeight
- can be used to support ListChoice
-
accessibilityReduceMotion
- should be respected whenever we do animations
- ~~can be also used in snapshot test code to force non-animated version~~ - This environment key is read-only 🤷
-
tint
- can be used to override the accent color of some elements (
button
,checkbox
,switch
)
- can be used to override the accent color of some elements (
iOS14+ modifiers
-
isFocused
(iOS14+)- could be used whenever we have similar flag or enum
- works correctly on
InputField
when used from iOS14+ client
-
controlSize
(iOS15+)- could be used for sizing Badges or Buttons (whenever we have size enum)
Related modifiers
-
foregroundColor()
andtint()
(iOS15+):- write-only modifier 🤷 Can be partially accessed by:
-
ForegroundShapeStyle()
-
TintShapeStyle()
- But we cannot access the underlying UIKit color that we need for the TextLink overlay or other formatting implementation
-
- write-only modifier 🤷 Can be partially accessed by:
https://www.fivestars.blog/articles/swiftui-environment-values/
https://developer.apple.com/documentation/swiftui/environmentvalues