Installation and Setup
Project Structure
Overview
The ShipThatApp
SwiftUI boilerplate is structured to provide a clear separation between views related to the onboarding process, authentication (logged out), and the main content portion of the app (logged in). Understanding this structure will assist developers in navigating through the project and integrating their custom functionality effectively.
Below is the outline of the project structure with explanations of each component:
ShipThatApp SwiftUI Boilerplate
Onboarding Flow
Path: Views/Onboarding
The onboarding flow is presented to the user upon the first launch of the app. It introduces the app's features and benefits.
Components:
OnboardingView.swift
: The root view for the onboarding sequence where users swipe through different features.Feature.swift
: A model that represents individual features shown in the onboarding.
Authentication Flow
Path: Views/Authentication
Handles the logic and UI for user authentication, directing users between sign-in, sign-up, and password recovery. It is presented after onboarding or when a logged-out user starts the app.
Components:
SignInView.swift
: The main sign-in view with options for email/password login, magic link, and Sign in with Apple.SignInOptions.swift
: Presents other sign-in methods if the user chooses not to use Sign in with Apple.RegistrationView.swift
: Facilitates the sign-up process for new users.SignInViewModel.swift
: Controls the form validation and interaction logic for sign-in operations.
Main Content Flow
Path: Views/Main
Once authenticated, the user is directed to the main content area of the app. Here, developers can place the core functionality of their application.
Components:
ContentView.swift
: Acts as a navigator between the onboarding, authentication, and the main views based on user state.HomeView.swift
: The primary view container post-authentication that houses the main navigation of the app.SettingsView.swift
: Allows users to modify their profile settings and manage their subscription status.
Common Components
Path: Views/Common
Reusable components that are used throughout the app to provide a consistent look and feel.
Components:
SplashScreenView.swift
: A welcoming view with animations presented when the app is launched.WelcomeScreen.swift
: Displays personalized greetings to the user after successful login.AppleButton.swift
: Custom implementation of Sign in with Apple that can be used across various views for authentication.LoadingIndicator.swift
: A utility view that shows a loading animation during asynchronous operations.
Extensions
Additional functionalities that extend the basic behavior of certain Swift/SwiftUI elements across the app.
Extensions:
String+Extensions.swift
: Adds email validation methods to theString
type.View+Extensions.swift
: Custom modifiers for text fields to maintain a consistent styling throughout all form inputs.