Skip to content

Instantly share code, notes, and snippets.

@rudrankriyam
Last active May 12, 2020 21:15
Show Gist options
  • Save rudrankriyam/51652b688f2e4391bcb92573637ae8aa to your computer and use it in GitHub Desktop.
Save rudrankriyam/51652b688f2e4391bcb92573637ae8aa to your computer and use it in GitHub Desktop.
Creating an Apple like Splash Screen in SwiftUI Extensions + Modifiers
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