GregLeck

View Composition

Oct 17th, 2019
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Swift 0.40 KB | None | 0 0
  1. // VIEW COMPOSITION
  2. struct CapsuleText: View {
  3.    
  4.     var text: String
  5.    
  6.     var body: some View {
  7.         Text(text)
  8.             .font(.largeTitle)
  9.             .padding()
  10.             .foregroundColor(.white)
  11.             .background(Color.blue)
  12.             .clipShape(Capsule())
  13.     }
  14. }
  15.  
  16. struct ViewComposition: View {
  17.     var body: some View {
  18.         CapsuleText(text: "Greg")
  19.     }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment