Mercurial > public > lazybear
view LazyBear/Views/Onboarding/Helpers/Avatar.swift @ 320:e828c2b0764c
Minor update SignUpView
author | Dennis Concepción Martín <66180929+denniscm190@users.noreply.github.com> |
---|---|
date | Sat, 27 Mar 2021 20:32:45 +0100 |
parents | 62d278295bb7 |
children |
line wrap: on
line source
// // Avatar.swift // LazyBear // // Created by Dennis Concepción Martín on 26/3/21. // import SwiftUI struct Avatar: View { @EnvironmentObject var firstAvatar: FirstAvatar var body: some View { VStack { Image("head") .componentModifier() .overlay( ZStack { Image(firstAvatar.body) .componentModifier() .colorMultiply(Color(firstAvatar.bodyColor)) Image(firstAvatar.hair) .componentModifier() .colorMultiply(Color(firstAvatar.hairColor)) Image(firstAvatar.eyes) .componentModifier() Image(firstAvatar.nose) .componentModifier() Image(firstAvatar.mouth) .componentModifier() } ) } .padding() } } extension Image { func componentModifier() -> some View { self .resizable() .aspectRatio(contentMode: .fit) } } struct Avatar_Previews: PreviewProvider { static var previews: some View { Avatar() .environmentObject(FirstAvatar()) } }