What's with Constraints in SwiftUI?

前端 未结 3 1232
醉话见心
醉话见心 2021-01-01 09:22

What is happening now with constraints in SwiftUI? Do View types adapt automatically for bigger devices etc. or what should we have to do

3条回答
  •  伪装坚强ぢ
    2021-01-01 09:54

    It still has constraint, in WWDC examples we saw HStack and VStack, which seems like UIStackView, so my guess it just clips to edges. You can still add padding to views so if you want constraint a UILabel (Text) 10pt to left you do something like this:

    Text("Hello World").padding(EdgeInsets(top: 0, leading: 10, bottom: 0, trailing: 0))
    

提交回复
热议问题