Advertisement
Guest User

Untitled

a guest
Jun 25th, 2019
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. import SwiftUI
  2.  
  3. /// AvatarView
  4. /// View protocol - implemented by the custom views.
  5. struct AvatarView: View {
  6.  
  7. /// image
  8. let image: String
  9.  
  10. /// size
  11. let size: Length
  12.  
  13. /// body - default property for the view.
  14. var body: some View {
  15.  
  16. Image(image) // creates an imageview with specified image
  17. .resizable() // makes image resizable
  18. .frame(width: size, height: size) // frame for the image (width, height)
  19. // creates border around the image with 0.5 thikness, and radius size/2 - this will create rounded view outside the image.
  20. .border(Color.gray.opacity(0.5), width: 0.5, cornerRadius: size/2)
  21. .cornerRadius(size/2) // This will hide the cutting portion outside the rounded view border - this is required as per the documentation.
  22. }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement