Last active
May 12, 2020 21:15
-
-
Save rudrankriyam/51652b688f2e4391bcb92573637ae8aa to your computer and use it in GitHub Desktop.
Creating an Apple like Splash Screen in SwiftUI Extensions + Modifiers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
struct ButtonModifier: ViewModifier { | |
func body(content: Content) -> some View { | |
content | |
.foregroundColor(.white) | |
.font(.headline) | |
.padding() | |
.frame(minWidth: 0, maxWidth: .infinity, alignment: .center) | |
.background(RoundedRectangle(cornerRadius: 15, style: .continuous) | |
.fill(Color.mainColor)) | |
.padding(.bottom) | |
} | |
} | |
extension View { | |
func customButton() -> ModifiedContent<Self, ButtonModifier> { | |
return modifier(ButtonModifier()) | |
} | |
} | |
extension Text { | |
func customTitleText() -> Text { | |
self | |
.fontWeight(.black) | |
.font(.system(size: 36)) | |
} | |
} | |
extension Color { | |
static var mainColor = Color(UIColor.systemIndigo) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment