@@ -143,7 +143,7 @@ Example:
143
143
144
144
``` swift
145
145
Text (" SwiftUI" )
146
- .color (.orange )
146
+ .foregroundColor (.orange )
147
147
.bold ()
148
148
.font (.system (.largeTitle ))
149
149
.fontWeight (.medium )
@@ -177,7 +177,7 @@ TextField(self.$name, placeholder: self.nameText, onEditingChanged: { changed in
177
177
}}
178
178
.padding (10 )
179
179
.frame (height : 50 )
180
- .textFieldStyle (. roundedBorder )
180
+ .textFieldStyle (RoundedBorderTextFieldStyle () )
181
181
.padding (EdgeInsets (top : 0 , leading : 20 , bottom : 0 , trailing : 20 ))
182
182
183
183
```
@@ -201,8 +201,8 @@ The `Image` control is used to display images, example:
201
201
``` swift
202
202
Image (" icon" )
203
203
.resizable ()
204
- .frame (width : Length ( 100 ) ,
205
- height : Length ( 100 ) ,
204
+ .frame (width : 100 ,
205
+ height : 100 ,
206
206
alignment : .center )
207
207
```
208
208
@@ -224,10 +224,10 @@ var body: some View {
224
224
Image (uiImage : self .uiImage ?? placeholderImage)
225
225
.resizable ()
226
226
.onAppear (perform : downloadWebImage)
227
- .frame (width : Length ( 80 ) ,
228
- height : Length ( 80 ) ,
227
+ .frame (width : 80 ,
228
+ height : 80 ,
229
229
alignment : .center )
230
- .tapAction {
230
+ .onTapGesture {
231
231
print (" Tap " )
232
232
}
233
233
}
@@ -276,9 +276,12 @@ Waiting for release.
276
276
Example:
277
277
278
278
``` swift
279
- NavigationButton (destination : NavigationButtonPage ()) {
280
- Text (" NavigationButton" ).bold ().color (.orange ).font (.largeTitle )
281
- }.navigationBarItem (title : Text (" Page" ))
279
+ NavigationLink (destination : NavigationButtonPage ()) {
280
+ Text (" NavigationButton" ).bold ()
281
+ .foregroundColor (.orange )
282
+ .font (.largeTitle )
283
+ }
284
+ .navigationBarTitle (Text (" Page" ))
282
285
```
283
286
284
287
<details close >
@@ -288,23 +291,10 @@ NavigationButton(destination: NavigationButtonPage()) {
288
291
289
292
[ 🔝] ( #Button_D )
290
293
291
- <h4 id =" PresentationButton " > PresentationButton </h4 >
294
+ <h4 id =" PresentationButton " style = ' color : red ' > PresentationButton is deprecated </h4 >
292
295
293
- ` PresentationButton ` is used to pop up a page.
296
+ ` PresentationButton ` ~~ is used to pop up a page.~~ has deprecated, please use ` NavigationLink `
294
297
295
- Example:
296
-
297
- ``` swift
298
- PresentationButton (PageRow (title : " PresentationButton" , subTitle : " pop up a page" ),
299
- destination : Text (" I'm Text" )) {
300
- print (" Present 🦄" )
301
- }
302
- ```
303
-
304
- <details close >
305
- <summary >View running results</summary >
306
- <img width =" 40% " src =" images/example/PresentationButton.png " />
307
- </details >
308
298
309
299
[ 🔝] ( #Button_D )
310
300
@@ -358,16 +348,12 @@ Picker(selection: $leftIndex, label: Text("Picker")) {
358
348
Example:
359
349
360
350
``` swift
361
- DatePicker (
362
- $server.date ,
363
- minimumDate : Calendar.current .date (byAdding : .year ,
364
- value : -1 ,
365
- to : server.date ),
366
- maximumDate : Calendar.current .date (byAdding : .year ,
367
- value : 1 ,
368
- to : server.date ),
369
- displayedComponents : .date
370
- )
351
+
352
+ DatePicker (selection : $server.date ,
353
+ in : server.spaceDate ,
354
+ displayedComponents : .date , label : {
355
+ Text (" " )
356
+ })
371
357
```
372
358
373
359
<details close >
@@ -428,7 +414,7 @@ Stepper(value: $value, step: 2, onEditingChanged: { c in
428
414
429
415
[ 🔝] ( #Picker_D )
430
416
431
- <h4 id =" SegmentedControl " > SegmentedControl </h4 >
417
+ <h4 id =" SegmentedControl " style = " color : red " > SegmentedControl is deprecated </h4 >
432
418
433
419
` SegmentedControl ` is used for segmentation condition selection, example:
434
420
@@ -615,9 +601,10 @@ ScrollView {
615
601
Divider ()
616
602
Text (" Views and ... user interface." )
617
603
}
618
- .border (style, width : 1 ,cornerRadius : 10 )
619
- .padding (10 )
620
- .navigationBarTitle (Text (" ScrollView" ))
604
+ .border (Color.gray .gradient , width : 1 )
605
+ .cornerRadius (10 )
606
+ .padding (10 )
607
+ .navigationBarTitle (Text (" ScrollView" ))
621
608
```
622
609
623
610
<details close >
@@ -634,7 +621,7 @@ ScrollView {
634
621
Example:
635
622
636
623
``` swift
637
- let data = (0 ..< 5 ). map { $0 }
624
+ let data = (0 ..< 5 )
638
625
var body: some View {
639
626
ForEach (data) { e in
640
627
Text (" Hello \( e ) " )
@@ -705,9 +692,13 @@ Example:
705
692
706
693
```swift
707
694
NavigationView {
708
- Text (" 🧚♂️🧚♀️🧜♂️🧜♀️🧞♂️🧞♀️" ).blur (radius : 5 )
709
- Text (" Swifter Swifter" ).bold ().color (.orange ).font (.largeTitle )
710
- }.navigationBarTitle (Text (" NavigationView" ))
695
+ Text (" 🧚♂️🧚♀️🧜♂️🧜♀️🧞♂️🧞♀️" ).blur (radius : 5 )
696
+ Text (" Swifter Swifter" )
697
+ .bold ()
698
+ .foregroundColor (.orange )
699
+ .font (.largeTitle )
700
+ }
701
+ .navigationBarTitle (Text (" NavigationView" ))
711
702
```
712
703
713
704
< details close>
@@ -757,14 +748,17 @@ Waiting for release.
757
748
Example:
758
749
759
750
```swift
760
- presentation ($showsAlert, alert : {
761
- Alert (title : Text (" Hello" ))
762
- })
751
+ alert (isPresented : $showAlert, content : {
752
+ Alert (title : Text (" 确定要支付这100000000美元吗?" ),
753
+ message : Text (" 请谨慎操作\n 一旦确认,钱款将立即转入对方账户" ),
754
+ primaryButton : .destructive (Text (" 确认" )) { print (" 转出中..." ) },
755
+ secondaryButton : .cancel ())
756
+ }).navigationBarTitle (Text (" Alert" ))
763
757
```
764
758
765
759
< details close>
766
760
< summary> View running results</ summary>
767
- < img width= " 80%" src= " images/example/Alert.png " />
761
+ < img width= " 80%" src= " images/example/AlertPage.jpg " />
768
762
</ details>
769
763
770
764
[🔝](#Alert_D )
@@ -792,6 +786,10 @@ ActionSheet(title: Text("Title"),
792
786
})])
793
787
```
794
788
789
+ usage:
790
+ ```swift
791
+ .actionSheet (isPresented : $showSheet, content : {sheet})
792
+ ```
795
793
< details close>
796
794
< summary> View running results</ summary>
797
795
< img width= " 80%" src= " images/example/ActionSheet.png" />
@@ -827,9 +825,9 @@ Modal(Text("Modal View"),onDismiss: {
827
825
Example:
828
826
829
827
```swift
830
- Popover ( content : Text ( " Popover View " )) {
831
- print ( " Popover Dismiss ! " )
832
- }
828
+ . popover ( isPresented : $showPop, content : {
829
+ ImagePage ( )
830
+ })
833
831
```
834
832
835
833
< details close>
0 commit comments