Last active
April 7, 2020 18:59
-
-
Save SwiftyAlex/b7f38bb2ee05e0ecebca4cd559da863e to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// 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