Core
The foundation layer of the Youll platform. Contains infrastructure (settings, feature flags, theming, deeplinking, services, storage) and screens for all core product modules (Home, Explore, Search, Library, Journeys, Events, Activity, Meals, Quiz).
Why Core
Core is the largest module in the Youll platform (~672 Swift files). It serves a dual purpose: it provides the infrastructure that every other Bricks module depends on, and it is the home of screens for 11 content-based product modules. Every Bricks module except YoullNetwork and TimerShared depends on Core.
Core provides:
- Settings actor with 57 persistent properties controlling app behavior
- Feature flags with 23 remotely configurable flags
- Deeplink routing with 34 destination types
- 19 API services for fetching and mutating backend data
- Screen implementations for Home, Explore, Search, Library, Journeys, Events, Activity, Meals, Quiz, and more
- Theming system with ~180 design token constants and 20 cell theme configurations
- Storage property wrappers for UserDefaults and file-based persistence
- Reusable UI components in both UIKit and SwiftUI
- Module interface protocols that optional modules (Timer, Tuya, Biometrics, Community) implement
Many of these subsystems are explained at the pattern level in the Architecture section. This page provides the Core-specific details: complete enumerations, file paths, and implementation details that the architecture docs summarize.
Cross-Reference with Architecture Docs
| Core Subsystem | Architecture Page | What This Page Adds |
|---|---|---|
| Coordinator protocol | Coordinator Pattern | File paths, base view controller details |
| Module interfaces | Module Interfaces | File paths per protocol |
| Settings actor | Bootstrap Sequence, Communication Patterns | Complete property table (57 properties) |
| Feature flags | (brief mentions) | Complete flag enum (23 cases), FlaggingManager internals |
| Design tokens / theming | Design Token System | ThemeTokens paths, cell config types list |
| Deeplink routing | Coordinator Pattern | Complete DeeplinkDestination enum (34 cases), URL parsing |
| Bootstrap (Core.setup) | Bootstrap Sequence | CoreKeysType / ClientKeysType protocol details |
Package Definition
Swift tools version: 5.9, Platform: iOS 15+
Dependencies:
| Dependency | Type | Purpose |
|---|---|---|
YoullNetwork | Local package | GraphQL + REST networking, API response types |
LNPopupController | Remote (v4.0.0+) | Mini player popup UI |
SDWebImage | Binary xcframework | Image downloading and caching |
SDWebImageSwiftUI | Binary xcframework | SwiftUI image loading |
SDWebImageWebPCoder | Binary xcframework | WebP format support |
SnapKit | Binary xcframework | Auto Layout DSL |
Lottie | Binary xcframework | Animation rendering |
libwebp | Binary xcframework | WebP codec |
File: Bricks/modules/Core/Package.swift
Directory Structure
Core/Core/
├── App/ # Application singletons, keys, module interface protocols
│ ├── Module Interface/ # TimerModuleInterface, TuyaModuleInterface,
│ │ # BiometricsModuleInterface, CommunityModuleInterface
│ ├── Settings.swift # Settings actor (57 @UserDefault properties)
│ ├── Keys.swift # CoreKeysType, ClientKeysType protocols + setup()
│ ├── DownloaderManager # Background URLSession download manager
│ ├── LocationManager # CLLocationManager wrapper
│ ├── AppleHealthDelegate # Health authorization protocol
│ ├── CustomSubscriptionsManager # Custom subscription presentation protocol
│ └── AppLogger # Logging utility
│
├── Content/ # Infrastructure layer (not about "content items")
│ ├── Coordinator/ # Base Coordinator protocol
│ ├── Data/ # ContentToConsume, ContentDetailsJourney (player handoff)
│ ├── Deeplinking/ # DeeplinkManager, DeeplinkDestination (34 cases)
│ ├── Flagging/ # Flag enum (23 cases), FlaggingManager, FlagProvider
│ ├── Internal Classes/ # Form components: InputField, YoullTextField, etc.
│ ├── Public Interface/ # UIConfig, ButtonConfig, TextLabelConfig, Toast, etc.
│ ├── Theming/ # ThemeTokens, CellThemeConfigs, CellsThemingLayoutManager
│ └── Views/ # Content-specific views (collection view cells)
│
├── Data/ # Data layer
│ ├── API Service/ # 19 API services
│ ├── BNModel/ # 28 mapper extensions (API response -> domain type)
│ ├── CoreModel/ # Domain types (ContentSession, Playlist, etc.)
│ ├── ProfileModel/ # Badge, AppProduct, StoreProduct, SuperPaywall types
│ ├── YNModel/ # Profile utility extensions
│ ├── PlayerPublic/ # Types shared with Player (Asset, PlayerAnalytics)
│ ├── Store/ # StoreKit integration (StoreManager, Subscription)
│ ├── Reminders Service/ # Local notifications, reminders infrastructure
│ ├── Tuya/ # TuyaControllerProtocol, device protocols
│ ├── Onboarding/ # AuthError, AuthProvider, AuthUserData
│ └── Protocols/ # TabSelectionProtocol, RemoteBackgroundImageListenerProtocol
│
├── Screens/ # 30 directories, organized by product module
│ ├── Home/ # Feed, Cells, DataProvider, DataSource, TagFeed
│ ├── Explore/ # Category Details, Facilitators, Feed, Subcategory Details
│ ├── Search/ # Search + Search Filter (filter subdirectories)
│ ├── Library/ # (+ 7 related directories below)
│ ├── Journeys Feed/ # Regular journeys listing
│ ├── Journey Details/ # Regular journey detail screen
│ ├── Linear Journeys Feed/ # Timeline-based journeys
│ ├── Linear Journey Details/ # Timeline journey detail screen
│ ├── Events/ # EventsList, EventsDetails
│ ├── Activity/ # Workouts, session stats
│ ├── MealPlan/ # MealsPage, MealDetails
│ ├── Quiz/ # Intro, Quiz View, Results
│ ├── Showcase/ # Home screen v2 (SwiftUI + GraphQL)
│ └── ... # Shared screens (Welcome, DailyQuote, SkeletonView, etc.)
│
├── Utils/ # Extensions and support utilities
│ ├── Categories/ # 38 extension files (UIColor+hex, Date+Utils, etc.)
│ ├── Support/ # Property wrappers, Device, HapticFeedback, etc.
│ ├── Popups/ # LottieView, PopupView, PopupViewConfig
│ └── OptionPicker/ # Generic option picker UI
│
└── View/ # Standalone reusable UI components
├── UIKit/ # ActivityIndicator, YoullTextButton, etc.
├── SwiftUI/ # BottomSheet, ProgressBar, NavigationBar, etc.
├── SwiftUI Styles/ # YoullButtonStyles, YoullTextFieldStyles
└── Review Widget/ # Star rating/review UI (9 files)Naming Clarifications
Content/ is not about content items. Despite its name, this directory contains infrastructure: the coordinator protocol, deeplinking, flagging, theming, and public interface types. The name is historical.
Two Data/ directories exist. Content/Data/ holds just two types (ContentToConsume and ContentDetailsJourney) used for player handoff. The top-level Data/ directory is the full data layer with services, models, and storage.
Three reusable UI component directories serve different purposes:
Content/Internal Classes/: Form input components (text fields, pickers, validators, gradient views)Content/Views/: Content-specific views (collection view cells used in feeds)View/: Standalone reusable components usable anywhere (navigation bars, buttons, empty states, bottom sheets)
Settings
The Settings actor provides 57 static properties persisted via the @UserDefault property wrapper. All properties are public static and thread-safe through actor isolation.
File: Bricks/modules/Core/Core/App/Settings.swift
App Identity
| Property | Type | Default | Purpose |
|---|---|---|---|
appId | String? | nil | Application identifier |
appName | String? | nil | Application display name |
deeplinkPrefix | String? | nil | Primary deeplink URL scheme |
uniqueDeviceIdentifier | String | "" | Unique device ID |
Auth State
| Property | Type | Default | Purpose |
|---|---|---|---|
cachedIDTokenKey | String? | nil | Cached authentication token |
loginType | String? | nil | Login method used (email, Apple, Google, anonymous) |
Onboarding
| Property | Type | Default | Purpose |
|---|---|---|---|
appFirstTimeOpened | Bool | true | Whether app has been opened before |
onboardingVideoDisplayed | Bool | false | Video onboarding shown |
onboardingSliderDisplayed | Bool | false | Slider onboarding shown |
onboardingContentDisplayed | Bool | false | Content onboarding shown |
onboardingType | OnboardingType | .regular | Onboarding flow variant (.regular, .dissmissable, .none) |
ignoreQuizInOnboarding | Bool | false | Skip quiz during onboarding |
showWelcomeSessionScreen | Bool | false | Show welcome session after onboarding |
displayedWelcomeMessage | Bool | false | Whether welcome message has been shown |
Subscription
| Property | Type | Default | Purpose |
|---|---|---|---|
presentSubscriptionScreenAfterLogin | Bool | false | Show paywall after login |
presentSubscriptionScreenAlwaysOnAppStart | Bool | false | Show paywall every app launch |
enablePromoOffers | Bool | false | Enable promotional offer codes |
offerIdsToHide | [String] | [] | Offer IDs to exclude from display |
Content Behavior
| Property | Type | Default | Purpose |
|---|---|---|---|
contentItemOptions | ContentItemOptions | .defaultOptions | Available actions on content items |
contentHasLockedState | Bool | true | Whether content can be locked/gated |
contentPlayedCount | Int | 0 | Number of content items played |
contentItemLongPressGestureEnabled | Bool | false | Enable long press on content items |
useDefaultSubcategoryTitleFieldInSubcategoryDetails | Bool | true | Subcategory title field behavior |
Feature Toggles
| Property | Type | Default | Purpose |
|---|---|---|---|
isSearchEnabled | Bool | true | Enable search functionality |
isSearchInTabBar | Bool | false | Show search as a tab bar item |
isLibraryInProfile | Bool | false | Nest library inside profile instead of its own tab |
settingsInProfile | Bool | false | Show settings within profile screen |
enableVectorSearch | Bool | false | Use vector-based search |
enableTimerLiveActivity | Bool | false | Enable iOS Live Activities for timer |
fetchTimerSessions | Bool | false | Fetch timer session data from API |
hapticksEnabled | Bool | false | Enable haptic feedback |
UI
| Property | Type | Default | Purpose |
|---|---|---|---|
displayHomeScreenGreetings | Bool | true | Show greeting messages on home |
displaySessionComplete | Bool | true | Show session completion screen |
showMarketingMediaController | Bool | false | Show marketing media content |
useDynamicFontSizes | Bool | false | Support Dynamic Type |
isLiquidGlassEnabled | Bool | false | Enable iOS 26 Liquid Glass styling |
Downloads / Offline
| Property | Type | Default | Purpose |
|---|---|---|---|
downloadedContent | [String] | [] | IDs of downloaded content items |
offlineMediaProgress | [String: BNMediaProgress] | [:] | Offline playback progress per content |
offlineQuizAnswers | [BNQuizAnswer] | [] | Quiz answers saved while offline |
Player
| Property | Type | Default | Purpose |
|---|---|---|---|
playerDuckOthers | Bool | false | Duck other audio when player is active |
resumePlayerOnAppStart | Bool | true | Resume last session on app launch |
Misc
| Property | Type | Default | Purpose |
|---|---|---|---|
appStarts | Int | 1 | Number of app launches |
minimumAppVersion | String | "" | Minimum required app version |
exploreTags | [Tag] | [] | Cached explore tags |
whatsNewPopupHashValue | String? | nil | Hash of last shown "what's new" |
waitForRemoteConfigValuesRefreshOnFirstAppStart | Bool | false | Block launch until Remote Config refreshes |
lastSentFCMToken | String? | nil | Last Firebase Cloud Messaging token sent |
pendingCohortIds | [String] | [] | Cohort IDs pending assignment |
pendingAppsFlyerDeeplinks | [String] | [] | AppsFlyer deeplinks pending processing |
eventsNotificationIds | [String] | [] | Event notification IDs scheduled |
presentedCompletedScreenIDs | [String] | [] | Journey completion screens already shown |
presentedQuizesIDs | [String] | [] | Quizzes already presented |
receivedBadgesIDs | [String] | [] | Badge IDs already received |
allowTraking | Bool | false | User tracking consent |
facebookAppID | String? | nil | Facebook App ID for Meta SDK |
customTimer | String? | nil | Custom timer configuration |
didSendFreeTrialEventToMeta | Bool | false | Whether free trial event was sent to Meta |
Reset
Settings.resetForLogout() clears session-specific properties on logout: appStarts, contentPlayedCount, presentedQuizesIDs, offerIdsToHide.
Feature Flags
Core defines 23 feature flags via the Flag enum. Flags are backed by a remote config service (typically Firebase Remote Config) through the FlagProvider protocol. Customer apps implement FlagProvider and inject it into YouFlaggingManager.
Flag Enum
| Case | Raw Value (Remote Config Key) | Purpose |
|---|---|---|
reminders | reminders_enabled | Enable reminders feature |
anonymous | anonymous_mode_enabled | Allow anonymous authentication |
health | health_enabled | Enable Apple Health integration |
contentReview | content_review_enabled | Enable content review/rating |
envoy | envoy_enabled | Enable content sharing via envoy links |
libraryEnabled | library_enabled | Show Library tab/section |
journeysEnabled | journeys_enabled | Show Journeys tab/section |
superPaywallEnabled | superpaywall_enabled | Enable SuperPaywall feature |
downloadsEnabled | downloads_enabled | Allow content downloads |
isLightVersion | is_light | Light/free version mode |
favouritesEnabled | favourites_enabled | Enable favorites |
exploreEnabled | explore_enabled | Show Explore tab |
miniplayerEnabled | miniplayer_enabled | Enable mini player |
quizEnabled | quiz_enabled | Enable quiz feature |
advancedSearchEnabled | advancedsearch_enabled | Enable advanced search filters |
eventsEnabled | events_enabled | Enable events feature |
mealsEnabled | meals_enabled | Enable meals feature |
activityEnabled | activity_enabled | Enable activity tracking |
paywallConfigId | paywall_config_id | Paywall configuration identifier (string value) |
userProfile | user_profile | Enable user profile features |
poweredBy | powered_by | Show "powered by" attribution |
abOnboardingType | ab_onboarding_type | A/B test onboarding variants (string value) |
multilanguageEnabled | multilanguage_enabled | Enable multi-language support |
FlaggingManager Protocol
public protocol FlaggingManager {
var didInitialRefresh: Bool { get }
func isActive(flag: Flag) -> Bool
func getStringValue(forFlag flag: Flag) -> String?
func getStringValue(forKey key: String) -> String?
func refreshFromProvider()
var flagRefreshCompletedPublisher: AnyPublisher<Void, Never> { get }
}YouFlaggingManager is the concrete implementation. It wraps any FlagProvider and forwards flag refresh events via a Combine publisher. Customer apps create a FlagProvider (wrapping Firebase Remote Config), pass it to YouFlaggingManager(provider:), and inject the result into Config.
FlagProvider Protocol
public protocol FlagProvider {
var didInitialRefresh: Bool { get }
func getState(forFlag flag: Flag) -> Bool
func getStringValue(forFlag flag: Flag) -> String?
func getStringValue(forKey key: String) -> String?
func refreshAllFlags(completion: (() -> Void)?)
var flagRefreshCompletedPublisher: AnyPublisher<Void, Never> { get }
}Core never imports Firebase directly. The FlagProvider protocol abstracts away the remote config backend.
Files: Core/Content/Flagging/Flag.swift, Core/Content/Flagging/FlaggingManager.swift, Core/Content/Flagging/FlagProvider.swift, Core/Content/Flagging/YouFlaggingManager.swift
Deeplink System
Core defines 34 deeplink destinations and a singleton DeeplinkManager that parses URLs and publishes navigation events.
DeeplinkDestination Enum
| Area | Cases |
|---|---|
| Auth | login, subscription |
| Home | homescreen |
| Explore | explore(tagId:), category(id:), subcategory(id:), tag(id:, sortInfo:) |
| Journeys | journeys, journey(id:), timelineJourney(id:) |
| Player | player(contentId:) |
| Profile | profile, changePassword, editProfile, badge(id:) |
| Quiz | quiz(skipIntro:, quizID:) |
| Events | events, event(id:) |
| Activity | activities, activityNext, activityCompleted, activityId(id:) |
| Meals | meals, meal(id:) |
| Library | library, favorites, downloads, history, playlist(id:) |
| Reminders | reminders, remindersPopup |
| External | externalUrl(url:), joinCohorts(ids:, shouldRedirectHome:) |
| Tuya | tuyaMaintenance(type:) |
DeeplinkManager
DeeplinkManager.shared is a @MainActor singleton that parses deeplink URLs and publishes DeeplinkDestination events via a PassthroughSubject.
URL format: {scheme}://{destination}?param1=value1¶m2=value2
Alternative format: {scheme}://rp?path={destination}¶m1=value1 (the rp host triggers path-based routing).
The manager supports multiple URL scheme prefixes per app (configured via CoreKeysType.deeplinkPrefixes). For external URLs, it recursively checks whether the URL uses a recognized scheme before treating it as external.
Key methods:
handleDeeplink(stringUrl:prefixes:): Parse a URL string and publish the matching destinationhandleCohortDeeplinks(stringUrls:prefixes:shouldRedirectHome:): Parse cohort-specific URLs and publishjoinCohortsrun(deeplink:): Directly publish a destination without parsing
Files: Core/Content/Deeplinking/DeeplinkDestination.swift, Core/Content/Deeplinking/DeeplinkManager.swift
Data Layer
API Services
Core provides 19 API services in Data/API Service/. Most services take a BricksNetwork parameter for making network calls. UserService is special: it is created by Config during bootstrap and shared as a singleton.
| Service | Purpose |
|---|---|
ContentService | Content CRUD, likes, playlists, journey content, media progress, tracking, vector search, envoy sharing, downloads |
HomeFeedService | Home feed sections and data |
ExploreService | Explore feed categories |
JourneyService | Journey listings and details |
LinearJourneyManager | Linear (timeline) journey state management |
SearchService | Search queries |
SearchFiltersService | Search filter configuration |
LibraryContentService | Library content (favorites, downloads, history, playlists) |
FavoriteContentService | Favorites-specific operations |
DownloadedSessionsService | Downloaded sessions management |
EventsContentService | Events listing and details |
ActivitiesContentService | Activity and workout content |
MealsContentService | Meal plans and details |
QuizService | Quiz data fetching and answer submission |
TagService | Tag-based content queries |
UserService | User data operations (created by Config, shared singleton) |
NavigationContentService | Navigation content data |
PaymentService | Payment and subscription API calls |
SettingsService | Settings-related API calls |
Relationship to YoullNetwork: Services use BricksNetwork.shared (from YoullNetwork) to make GraphQL queries and REST calls. The service layer abstracts this, so screens and view models never call BricksNetwork directly.
Data Model Architecture
Data flows through three tiers:
YoullNetwork API Response (generated GraphQL types, BN*/YN* prefixed)
│
▼ BNModel mapper extensions
Core Domain Types (CoreModel, ProfileModel)
│
▼ Used by ViewModels
Screen DisplayBNModel (Data/BNModel/, 28 files): Extensions on YoullNetwork response types that convert API data to Core domain types. Naming pattern: BNContent+ContentItem.swift, BNJourney+JourneyItem.swift. These are the translation layer between network responses and the types screens actually use.
CoreModel (Data/CoreModel/): Pure domain types used by screens:
ContentSession: A playable content itemContentQuiz: Quiz data and questionsJourneyContent: Content within a journeyPlaylist: User-created playlistHomeNavBarConfig: Home navigation bar configurationLiveUsersInfoConfig: Live user count displayOnboardingPage: Onboarding screen configurationSocialProofReview: Social proof review display
ProfileModel (Data/ProfileModel/): Profile-related types: Badge, AppProduct, StoreProduct, UserStats, and SuperPaywall/ types for paywall configuration.
PlayerPublic (Data/PlayerPublic/): Types shared with the Player module: Asset, AssetSource, AssetType, Colors, LabelConfig, PlayerAnalytics.
Content/Data (Content/Data/): Two types for player handoff: ContentToConsume (the struct passed to the player when starting playback) and ContentDetailsJourney.
StoreKit Integration
Data/Store/ contains the StoreKit integration layer:
| Type | Purpose |
|---|---|
StoreManager | Manages product fetching and purchase flows |
Subscription | Subscription state and entitlement checking |
TransactionObserver | Observes StoreKit transaction updates |
AppStoreProductStorage | Caches fetched App Store product data |
StoreManager handles the device-side purchase flow, while PaymentService (in API Services) handles the server-side verification and subscription status. They work together: StoreManager completes the purchase, then PaymentService validates the receipt with the backend.
Reminders Service
Data/Reminders Service/ provides local notification and reminder infrastructure:
| Type | Purpose |
|---|---|
LocalNotificationsManager | Schedule and manage local notifications |
NotificationsManager | Higher-level notification coordination |
NotificationsPermissionManager | Request and check notification permissions |
RemindersProvider | Protocol for reminder data source |
RemindersRepository | Reminder persistence |
TuyaMaintenanceRemindersService | Tuya device maintenance reminders |
UserDefaultsRepository | UserDefaults-backed persistence for reminders |
This subsystem handles local notifications only. Push notification handling lives in the Client module.
Screen Architecture
Screen Pattern
Screens in Core follow a consistent pattern with these file types:
| File Suffix | Purpose | Example |
|---|---|---|
*ScreenConfig | Frozen struct with all UI configuration (colors, fonts, spacing, strings). Created by the customer app's ScreenConfigFactory. | HomeScreenConfig |
*ViewController | UIViewController (typically subclassing AppearanceCoordinatedViewController). Owns the view and wires up the view model. | HomeViewController |
*ViewModel | ObservableObject or class with Combine publishers. Fetches data via services and transforms for display. | HomeViewModel |
*View | SwiftUI view or UIKit view. Receives data from the view model and renders UI. | HomeView |
*DataProvider / *DataSource | Data fetching and transformation layer. Provides data to the view model. | HomeDataProvider |
Not every screen has all five file types. Simpler screens may combine the view and view controller, or omit the data provider.
Screen Directory Catalog
| Directory | Product Module | Contents |
|---|---|---|
Home/ | Home | Feed, Cells, DataProvider, DataSource, TagFeed, LiveUsersInfoView |
Explore/ | Explore | Category Details, Facilitators, Feed, Subcategory Details |
Search/, Search Filter/ | Search | Search screen + filter subdirectories for each filter type |
Library/ | Library | Library main screen |
FavoritesViewController/ | Library | Favorites list |
HistoryViewController/ | Library | Playback history |
PlaylistsViewController/ | Library | Playlists list |
PlaylistDetails/ | Library | Single playlist detail |
CreatePlaylistViewController/ | Library | Playlist creation |
Profile Playlists/ | Library | Playlists shown in profile |
Downloaded Sessions/ | Library | Downloaded content management |
Journeys Feed/ | Journeys (regular) | Standard journey listing |
Journey Details/ | Journeys (regular) | Standard journey detail |
Linear Journeys Feed/ | Journeys (linear) | Timeline-based journey listing |
Linear Journey Details/ | Journeys (linear) | Timeline journey detail |
Events/ | Events | EventsList, EventsDetails, Data, Subviews |
Activity/ | Activity | ActivityPage, WorkoutDetails, WorkoutsSeeAll |
MealPlan/ | Meals | MealsPage, MealDetails |
Quiz/ | Quiz | Intro, Quiz View, Results, Answer creation |
Showcase/ | Showcase | Alternative home screen for hardware-focused apps |
Shared screens (not tied to a single product module):
| Directory | Purpose |
|---|---|
Welcome/ | Welcome/onboarding screen |
WhatsNewPopup/ | "What's new" modal |
DailyQuoteModal/ | Daily quote display |
InfoBanner/ | Information banners |
SkeletonView/ | Loading placeholder screens (skeleton UI) |
SuggestedContent/ | Content suggestion displays |
TimerSessionsHistory/ | Timer session history list |
Lifetime Access Product/ | Lifetime access subscription offer |
LibraryConfirmationBannerViewController/ | Library action confirmation banner |
SettingsReminderItem/ | Reminder settings item view |
Dual Journey Systems
Core contains two separate journey implementations:
Regular Journeys (Journeys Feed/, Journey Details/): Structured multi-session programs where users can complete sessions in a flexible order. This is the original implementation.
Linear Journeys (Linear Journeys Feed/, Linear Journey Details/): Timeline-based programs with sequential progression. Sessions unlock in order. This is a newer implementation.
Which system is used depends on the .journeys tab item configuration. The useSwiftUIView property on the tab item controls which journey implementation is rendered.
Home Screen Versions
The platform has three home screen implementations, all fully functional and used across different customer apps:
Home v1 (Home/) is the original UIKit-based home screen built on UICollectionView with compositional layout. Uses Hasura/GraphQL for its backend. Supports 27 feed section types. Activated via the .home tab item. Deprecated: existing customers only, new apps should use Showcase v2 or Slices v3.
Showcase v2 (Showcase/) is a SwiftUI rewrite of the home screen. Also uses Hasura/GraphQL for its backend. Originally designed with a device-centric layout for hardware-focused apps but works for any content-on-demand app. Activated via the .showcase or .exploreShowcase tab item.
Slices v3 is the newest SwiftUI home screen. The key difference from Showcase is that it uses REST APIs instead of Hasura/GraphQL. Activated via the .slices tab item.
Keys Protocols
Customer apps implement CoreKeysType (which extends ClientKeysType and WidgetKeysType) to provide app identity and configuration URLs.
public protocol ClientKeysType: WidgetKeysType {
var appGroupSuiteName: String { get }
var deeplinkPrefixes: [String] { get }
var appStoreAppId: String { get }
var infoEmail: String { get }
var termsUrl: URL { get }
var privacyUrl: URL { get }
var faqUrl: URL { get }
var aboutUrl: URL { get }
var yourPageURL: URL { get }
var appstoreURL: URL { get }
var shareContentURLFormat: String? { get } // optional, defaults to nil
var subscriptionManagementUrl: URL { get }
var offlineDownloads: String { get }
var tryAgainOfflineBannerButton: String { get }
var didMakeVisibleMainCoordinator: String { get }
var didUpdateRemoteBackgroundImageNotificationName: String { get }
}
public protocol CoreKeysType: ClientKeysType {
var deeplinkPrefixes: [String] { get }
}After calling setup(with: CoreKeysType), the keys are accessible globally via the Keys constant. Calling any Core functionality before setup() triggers a fatal error.
File: Bricks/modules/Core/Core/App/Keys.swift
Theming System
For the full design token pipeline (Figma export to runtime), see Design Token System. This section covers Core-specific theming internals.
ThemeTokens
ThemeTokens is a struct with ~180 static string constants representing design token paths. These constants are used by screens and cell configurations to look up colors, sizes, and styles from the parsed design token JSON.
Two formats are used:
Palette references use curly braces: "{Main.main-300}", "{Accent.accent-400}". These reference the color palette directly.
Semantic token paths use slashes: "theme/general/on-background", "theme/buttons/primary/active/surface". These map to semantic UI concepts.
Token areas covered: general, buttons (primary/secondary/tertiary/circled/small/text), navigation (top/bottom/collapsing toolbar), cards, pills, sheets, inputs (search/text/form/dropdown/select), controls (player-progress/interval-selector/switches/quiz-progress), banners (error/warning/success/info), lists, modals, skeleton, player, miniplayer, paywall, onboarding, profile, settings, quiz, showcase, session-end, hardware, biometrics, community, Apple Health.
File: Core/Content/Theming/Tokens/ThemeTokens.swift
Cell Theme Configurations
20 cell theme config types define theming for different cell layouts:
BannerCellThemeConfig, ClassicCardCellThemeConfig, CustomTimerCellThemeConfig, DailyQuoteCellThemeConfig, FeaturedCellThemeConfig, LargeHorizontalCellThemeConfig, LargeVerticalCellThemeConfig, ProgramCardThemeConfig, ProgressCellThemeConfig, SmallCenteredCellThemeConfig, SmallHorizontalCellThemeConfig, SmallHorizontalContentCellConfig, SmallSquareCellThemeConfig, SmallVerticalCellThemeConfig, TagCellThemeConfig, TextCellThemeConfig, TimerSessionCellThemeConfig, TuyaHardwareConfig
The CellsThemingLayoutManagerProtocol is a factory that produces themed cell views for 18+ cell style types (.smallVertical, .smallCentered, .largeVertical, .featured, .facilitator, .events, .timer, .tuyaHardware, etc.). Both UIKit and SwiftUI layout implementations exist.
Directory: Core/Content/Theming/CollectionViewCellsThemingConfigs/, Core/Content/Theming/CellsThemingLayoutManager/
Public Interface Protocols
The Content/Public Interface/ directory (16 files) defines the contract between Core and customer apps/other modules:
| Protocol / Type | Purpose |
|---|---|
UIConfig | Button styles, auth buttons, gradients, navigation/tab bar styling, popup bar styling. Has cellsThemingLayoutManager property. |
ButtonStyleProtocol | Full button theming contract (background, text, border, shadow, corner radius per state) |
TypographyTypeProtocol | Font, kern, paragraph style for text rendering |
FormValidator / ValidatorType | Input validation types and rules |
ToastController / ToastMessage / ToastDelegate | Toast notification system contracts |
AppToast | Toast singleton (AppToast.shared) |
UIManager | UI utility manager |
TextLabelConfig | Label configuration (font, color, alignment) |
ButtonConfig | Button configuration |
AuthOption / AuthButtonConfig | Authentication button configuration for login/signup screens |
TermsPrivacyConfig | Terms of service and privacy policy URL configuration |
TextFieldConfig / YoullTextFieldConfig | Text field appearance and behavior configuration |
UI Infrastructure
Toast System
AppToast.shared provides app-wide toast notifications with five styles:
| Style | Use Case |
|---|---|
.error | Error messages |
.info | Informational messages |
.warning | Warning messages |
.success | Success confirmations |
.noConnection | Network connectivity issues |
Components: AppToast (singleton), ToastController (presentation), ToastView (rendering), ToastMessage (protocol), ToastDelegate (action/dismiss callbacks).
Popups
Utils/Popups/ provides Lottie-based animated popup modals: LottieView (animation rendering), PopupView (popup container), PopupViewConfig (configuration).
Base View Controllers
AppearanceCoordinatedViewController is the base UIViewController subclass used across Core screens. It provides:
willAppearHandler/willDisappearHandler/didAppearHandlerclosures for coordinator lifecycle- Custom back button support via
addCustomBackButton/addBackButton - Theme-aware appearance management
AppNavigationController is a custom UINavigationController subclass.
Reusable UIKit Components (View/UIKit/)
ActivityIndicator, BackgroundImageView, ContentGenericCollectionViewCell, FeedEmptyViewCell, NavigationBarCell, PointerUIControl, ReusableView, ScreenEmptyView, SharedScreenHeaderView, SwipeableCollectionViewCell, TimerUserSpentOnScreen, UIKitNavigationBar, UIKitNegativeView, YoullTextButton
Reusable SwiftUI Components (View/SwiftUI/)
AlwaysPopover, BackgroundSwiftUIImageView, BottomSheetSwiftUIView, ContentBottomSheetTitleImageDescription, ContentSessionsListView, GenericEmptyStateView, ProgressBarView, SUIBasicNavigationBar, SUINavigationBar, SUIViewControllerBaseView
SwiftUI Styles (View/SwiftUI Styles/)
HighlightedButtonStyle, YoullButtonStyles, YoullTextFieldStyles, TextLabelStyles, AccessibilityModifier
Form Components (Content/Internal Classes/)
InputField, YoullTextField, YoullTextFieldViewModel, DateTextField, PickerTextField, Validator, GradientLayerView, GradientOverlayView, HighlightedButton, ImageButton, AppNavigationController
Storage Property Wrappers
Core provides two property wrappers for persistent storage in Utils/Support/:
@UserDefault
@propertyWrapper
public struct UserDefault<T: Codable> {
let key: String
let defaultValue: T
let suiteName: String? // optional, for App Groups
}Used by all Settings properties. Stores data in UserDefaults.standard (or a named suite for App Groups). Uses JSON encoding/decoding via Codable for complex types. Falls back to direct casting for primitives. Calls synchronize() after writes.
File: Core/Utils/Support/UserDefaults.swift
@FileManagerDataStorage
@propertyWrapper
public struct FileManagerDataStorage<T: Codable> {
let key: String
let defaultValue: T
let suiteName: String? // optional, for App Groups
}Persists data as JSON files in the documents directory (or app group container). Uses atomic writes for safety. Appropriate for larger data that would be inappropriate for UserDefaults.
File: Core/Utils/Support/FileManagerDataStorage.swift
Utilities and Extensions
Extension Library (Utils/Categories/, 38 files)
| Extension | Purpose |
|---|---|
UIColor+hex | Initialize UIColor from hex integers |
UIView+RoundCorners | Corner radius helpers |
UIView+Shadow | Drop shadow configuration |
UIView+Shimming | Shimmer/skeleton loading effect |
UIImage+Crop | Image cropping utilities |
UIImage+Template | Template rendering helpers |
UIImageView+Remote | Remote image loading via SDWebImage |
Date+Utils | Date formatting and comparison |
String+Crypto | Hashing utilities (SHA, MD5) |
String+Utils | String manipulation helpers |
Double+Extensions | Number formatting |
URL+Extensions | URL construction helpers |
FileManager+Dir | Documents directory path helpers |
Bundle+Extensions | Bundle info utilities |
ProcessInfo+Testing | Test environment detection |
Text+LabelConfig | SwiftUI Text styled with LabelConfig theming |
Support Utilities (Utils/Support/)
| Utility | Purpose |
|---|---|
Device | Device model and capability detection |
HapticFeedback | Haptic feedback generation |
SoundPlayer | Sound effect playback |
AppReviewRequest | App Store review prompt |
AppVersionManager | Version comparison and forced update checks |
LocalizedString | Localization helpers |
AlertView | Alert presentation utilities |
ClientNavigationBar | Navigation bar customization |
Module Interface Protocols
Core defines the interface protocols that optional modules implement. For the full pattern explanation, see Module Interfaces.
| Protocol | File |
|---|---|
TimerModuleInterface | Core/App/Module Interface/TimerModuleInterface.swift |
TuyaModuleInterface | Core/App/Module Interface/TuyaModuleInterface.swift |
BiometricsModuleInterface | Core/App/Module Interface/BiometricsModuleInterface.swift |
CommunityModuleInterface | Core/App/Module Interface/CommunityModuleInterface.swift |
Other App-Level Types
| Type | File | Purpose |
|---|---|---|
DownloaderManager | Core/App/DownloaderManager.swift | Background URLSession download manager for offline content. Singleton via .instance. |
LocationManager | Core/App/LocationManager.swift | CLLocationManager wrapper. Singleton via .shared. |
AppleHealthDelegate | Core/App/AppleHealthDelegate.swift | Protocol for HealthKit authorization and data saving. |
CustomSubscriptionsManager | Core/App/CustomSubscriptionsManager.swift | Protocol for custom subscription presentation logic. |
AppLogger | Core/App/AppLogger.swift | Logging utility. Also: DLog() functions throughout Core for debug logging. |
Initialization
Core is initialized by calling setup(with: CoreKeysType) in AppDelegate. This stores the keys globally, making them available via the Keys constant to all Core subsystems. Calling Core functionality before setup triggers a fatal error.
For the full initialization sequence, see Bootstrap Sequence.
For Agents
Reading Order
To understand Core, read in this order:
Core/App/Keys.swift- How Core is configuredCore/App/Settings.swift- All persistent app settingsCore/Content/Flagging/Flag.swift- All feature flagsCore/Content/Coordinator/Coordinator.swift- Base navigation protocolCore/Content/Deeplinking/DeeplinkDestination.swift- All deeplink targetsCore/Content/Public Interface/UIConfig.swift- The theming contractCore/Content/Theming/Tokens/ThemeTokens.swift- All design token pathsCore/App/Module Interface/- All four module interface protocols- One screen directory (e.g.,
Core/Screens/Home/) to understand the screen pattern
Finding a Screen
To find the screen files for a product module:
- Check the screen directory catalog above to find the directory name
- Look in
Core/Screens/{directory}/ - The ScreenConfig struct is defined in the screen directory but created in the customer app's
ScreenConfigFactory - The coordinator that presents the screen is in the Client module
Adding a New Setting
- Add a new
@UserDefaultproperty toSettings.swift - Choose an appropriate
keystring (prefix withk) - Set a sensible
defaultValue - If the setting should be cleared on logout, add it to
resetForLogout() - Set the value from the customer app's configuration (typically in
AppDelegateor the factory)
Adding a New Feature Flag
- Add a new case to the
Flagenum inFlag.swift - Set the raw value to the Remote Config key string (convention:
snake_case_enabled) - Add the flag to the customer app's Firebase Remote Config
- Check the flag via
Config.flaggingManager.isActive(flag: .yourNewFlag)
Adding a New Deeplink Destination
- Add a new case to
DeeplinkDestinationinDeeplinkDestination.swift - Add a matching case to
DestinationScreeninDeeplinkManager.swift - Add the routing logic in
DeeplinkManager.redirect(to:with:url:) - Handle the destination in the appropriate coordinator in Client
Adding a New API Service
- Create a new file in
Data/API Service/ - Follow the naming pattern:
{Feature}Service.swift - Take
BricksNetworkas a dependency (or useBricksNetwork.shared) - Use GraphQL via
ApolloMissionfor complex queries, REST for simple operations - Return domain types (from
CoreModel/or create new ones)