Use different WelcomeScreen layouts
mainThe library provides three distinct layout styles via WelcomeScreen factory methods:
.apple(...): An Apple-style hero layout featuring a list of features and continue controls. RequiresappIcon,appDisplayName, andfeatures..modern(...): A card-based feature layout with inline links for Terms of Service and Privacy Policy. RequiresappIcon,appDisplayName,features,termsOfServiceURL, andprivacyPolicyURL..hero(...): A hero-focused layout designed for product previews. It includes a language picker, custom hero content, a Call to Action (CTA), and a sign-in action. Requirestitle,languageOptions, andheroContent.
// Modern Layout Example
let modern = WelcomeScreen.modern(
accentColor: .mint,
appDisplayName: "My Amazing App",
appIcon: Image("AppIcon"),
features: [
FeatureInfo(image: Image(systemName: "bolt.fill"), title: "Fast", content: "Optimized for speed.")
],
termsOfServiceURL: URL(string: "https://example.com/terms")!,
privacyPolicyURL: URL(string: "https://example.com/privacy")!
)
// Hero Layout Example
let hero = WelcomeScreen.hero(
accentColor: .mint,
title: "Track every meal with AI",
languageOptions: [
OnboardingLanguageOption(identifier: "en", displayName: "English", flag: "🇺🇸", shortName: "EN")
],
signInAction: { /* Sign in flow */ },
languageSelectionAction: { language in /* Handle language change */ }
) {
Image("WelcomeHero").resizable().scaledToFit()
}