When learning to use SwiftUI, there are often some questions like:

  • Silently eating apple English document, writing is not so clear… Give up halfway…
  • Want to achieve a function, I do not know whether SwiftUI provides, online search is basically UIKit tutorial.
  • I’m not sure how many pages I have on stackOverflow, but I’m not sure how many pages I have on stackOverflow.
  • Some blog posts contain this function, but it is tightly embedded in a project, can only be their own buckle out, buckle the kind tired…

In order to solve this problem, I combined with SwiftUI preview function, SwiftUI has published 25 control examples, with Chinese annotations, put here (SwiftUIViews). For example, to learn SwiftUI’s ColorPicker function, if you look directly at the documentation, it looks like this:

At least I still don’t know what function this UI control has and whether it can meet my needs. I really wish Apple would put an illustration under the code example… It is better to ask for others than to ask for yourself, so I put the official examples and variants are implemented, through the preview, we can clearly see the control looks and functions. So now, the experience of learning ColorPicker looks like this:

In the figure above (which works better due to GIF compression), you can clearly see where supportsOpacity controls the transparency selection.

In addition, for some common controls, the document is completely not introduced… For example, a common List document would look like this:

. Comrade document, I don’t want you to translate the word List for me.

To help you memorize and learn, IN this SwiftUIViews summary, I’ve added common and less common uses of these missing documentation controls. In this case, the List specification looks like this:

This summary has greatly helped me understand how to use the SwiftUI view and I’m sure it will help you too

At present, this project has completed all the control views (Text, Button), and should gradually fill up the layout view and other views, but also welcome everyone to correct and supplement, also welcome everyone to point star ah ~