-
Notifications
You must be signed in to change notification settings - Fork 0
iOS Development
In ContentView.swift, you can show the logo like this example:
struct HeaderView: View {
var body: some View {
Image("logo")
.resizable()
.aspectRatio(contentMode: .fit)
.frame(height: 200)
}
}The logo is copied to Assets.xcassets/SolaraArtifacts/logo.imageasset during the switching process. If you change the
logo for different brands, it will automatically display the appropriate image.
To apply the brand theme, write something like this example:
struct ContentView: View {
var body: some View {
NavigationView {
MyHomePage(title: "Infinite")
}
.accentColor(BrandTheme.Colors.primary)
.background(BrandTheme.Colors.background)
}
}Each color is referenced from BrandTheme.Colors, which is generated by Solara during the switching process.
Solara simplifies accessing app configurations by generating them for you. You can retrieve this data from
BrandConfig.swift as shown below:
var body: some View {
VStack(alignment: .leading, spacing: 8) {
InfoText(title: "Bundle Identifier:", value: brandConfig.bundleIdentifier)
InfoText(title: "Version Name:", value: brandConfig.marketingVersion)
InfoText(title: "Build Number:", value: String(brandConfig.bundleVersion))
}
}To add custom configurations for each brand, place the configuration in YOUR_BRAND/shared/brand_config. For example,
you might have:
- Brand 1 (
brand_config.json)
{
"showSplashScreen": true,
"baseUrl": "https://www.google.com"
}- Brand 2 (
brand_config.json)
{
"showSplashScreen": false,
"baseUrl": "https://www.facebook.com"
}To access these configurations, we call BrandConfig.instance:
var body: some View {
VStack(alignment: .leading, spacing: 8) {
InfoText(title: "baseUrl:", value: brandConfig.baseUrl)
InfoText(title: "showSplashScreen:", value: String(brandConfig.showSplashScreen))
}
}For the full project, check the Infinite iOS Project.
Achieve excellence! Don't just avoid errors!