Skip to content

Instantly share code, notes, and snippets.

@SwiftyAlex
Last active April 7, 2020 18:59
Show Gist options
  • Save SwiftyAlex/b7f38bb2ee05e0ecebca4cd559da863e to your computer and use it in GitHub Desktop.
Save SwiftyAlex/b7f38bb2ee05e0ecebca4cd559da863e to your computer and use it in GitHub Desktop.
// Container View
struct SomeView: View {
var body: some View {
VStack {
Text("Welcome to our SwiftUI app")
.font(.custom("Montserrat-Bold", size: 16))
.foregroundColor(.textBlack)
.padding()
FeaturedContentView()
ArticlesScrollView()
FooterView()
}
}
}
// New Custom View
struct CompanyHeader: View {
var text: String
var body: some View {
Text(text)
.font(.custom("Montserrat-Bold", size: 16))
.foregroundColor(.textBlack)
.padding()
}
}
// Result
struct SomeView: View {
var body: some View {
VStack {
CompanyHeader(text: "Welcome to our SwiftUI app")
FeaturedContentView()
ArticlesScrollView()
FooterView()
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment