File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -19,7 +19,9 @@ struct AddUserDefaultEditor: View {
1919 . foregroundStyle ( . secondary)
2020 TextField ( " " , text: $key)
2121 . labelsHidden ( )
22+ #if !os(macOS)
2223 . keyboardType( . numbersAndPunctuation)
24+ #endif
2325 . padding( 4 )
2426 . background ( Color ( white: 0 , opacity: 0.05 ) )
2527 . cornerRadius ( 4 )
@@ -76,9 +78,11 @@ struct AddUserDefaultEditor: View {
7678 Spacer ( )
7779 }
7880 . navigationTitle ( " Add User Default " )
81+ #if !os(macOS)
7982 . navigationBarTitleDisplayMode( . inline)
83+ #endif
8084 . toolbar {
81- ToolbarItem ( placement: . navigationBarTrailing ) {
85+ ToolbarItem ( placement: toolbarItemPlacement ) {
8286 Button {
8387 dismiss ( )
8488 } label: {
@@ -88,6 +92,14 @@ struct AddUserDefaultEditor: View {
8892 }
8993 }
9094 }
95+
96+ private var toolbarItemPlacement : ToolbarItemPlacement {
97+ #if os(macOS)
98+ return . automatic
99+ #else
100+ return . navigationBarTrailing
101+ #endif
102+ }
91103}
92104
93105private struct AddBoolEditor : View {
Original file line number Diff line number Diff line change @@ -17,7 +17,11 @@ struct DateValueEditor: View {
1717 VStack {
1818 Text ( date. ISO8601Format ( . iso8601) )
1919 . frame ( maxWidth: . infinity)
20+ #if os(macOS)
21+ . border( Color ( NSColor . labelColor) , width: 0.5 )
22+ #else
2023 . border( Color ( UIColor . label) , width: 0.5 )
24+ #endif
2125 DatePicker ( selection: $date) {
2226 Text ( " New date " )
2327 }
Original file line number Diff line number Diff line change @@ -19,7 +19,9 @@ struct DoubleValueEditor: View {
1919 VStack {
2020 TextField ( " " , text: $text)
2121 . labelsHidden ( )
22+ #if !os(macOS)
2223 . keyboardType( . numbersAndPunctuation)
24+ #endif
2325 . focused( $isFocused)
2426 . padding ( . vertical, 4 )
2527 . padding ( . horizontal, 8 )
Original file line number Diff line number Diff line change @@ -19,7 +19,9 @@ struct FloatValueEditor: View {
1919 VStack {
2020 TextField ( " " , text: $text)
2121 . labelsHidden ( )
22+ #if !os(macOS)
2223 . keyboardType( . numbersAndPunctuation)
24+ #endif
2325 . focused( $isFocused)
2426 . padding ( . vertical, 4 )
2527 . padding ( . horizontal, 8 )
Original file line number Diff line number Diff line change @@ -19,7 +19,9 @@ struct IntValueEditor: View {
1919 VStack {
2020 TextField ( " " , text: $text)
2121 . labelsHidden ( )
22+ #if !os(macOS)
2223 . keyboardType( . numbersAndPunctuation)
24+ #endif
2325 . focused( $isFocused)
2426 . padding ( . vertical, 4 )
2527 . padding ( . horizontal, 8 )
Original file line number Diff line number Diff line change @@ -21,9 +21,11 @@ public struct UserDefaultsBrowser: View {
2121 AddUserDefaultEditor ( value: value, model: model)
2222 }
2323 . navigationTitle ( " User Defaults " )
24+ #if !os(macOS)
2425 . navigationBarTitleDisplayMode( . inline)
26+ #endif
2527 . toolbar {
26- ToolbarItem ( placement: . navigationBarTrailing ) {
28+ ToolbarItem ( placement: toolbarItemPlacement ) {
2729 Menu {
2830 Button ( " Bool " ) {
2931 valueToAdd = . boolean( false )
@@ -50,6 +52,14 @@ public struct UserDefaultsBrowser: View {
5052 }
5153 }
5254
55+ private var toolbarItemPlacement : ToolbarItemPlacement {
56+ #if !os(macOS)
57+ return . navigationBarTrailing
58+ #else
59+ return . automatic
60+ #endif
61+ }
62+
5363 // MARK: List of Entries
5464
5565 @ViewBuilder func listOfEntries( ) -> some View {
You can’t perform that action at this time.
0 commit comments