Go to file
2026-01-19 09:00:11 -06:00
SecureStorageSample Watch App Add ContentView, UserProfile, SecureStorageSample_Watch_AppApp, WatchConnectivityService (+13 more); Remove Value 2026-01-19 09:00:11 -06:00
SecureStorageSample Watch AppTests Add ContentView, UserProfile, SecureStorageSample_Watch_AppApp, WatchConnectivityService (+13 more); Remove Value 2026-01-19 09:00:11 -06:00
SecureStorageSample Watch AppUITests Add ContentView, UserProfile, SecureStorageSample_Watch_AppApp, WatchConnectivityService (+13 more); Remove Value 2026-01-19 09:00:11 -06:00
SecureStorgageSample Add ContentView, UserProfile, SecureStorageSample_Watch_AppApp, WatchConnectivityService (+13 more); Remove Value 2026-01-19 09:00:11 -06:00
SecureStorgageSample.xcodeproj Add ContentView, UserProfile, SecureStorageSample_Watch_AppApp, WatchConnectivityService (+13 more); Remove Value 2026-01-19 09:00:11 -06:00
SecureStorgageSampleTests Add ContentView, SecureStorgageSampleApp, SecureStorgageSampleTests, SecureStorgageSampleUITests (+4 more) 2026-01-19 09:00:11 -06:00
SecureStorgageSampleUITests Add ContentView, SecureStorgageSampleApp, SecureStorgageSampleTests, SecureStorgageSampleUITests (+4 more) 2026-01-19 09:00:11 -06:00
.gitignore Add SampleLocationData, StorageKeys, AppVersionKey, Value (+10 more) 2026-01-19 09:00:11 -06:00
README.md Add ContentView, UserProfile, SecureStorageSample_Watch_AppApp, WatchConnectivityService (+13 more); Remove Value 2026-01-19 09:00:11 -06:00

SecureStorgageSample

A sample iOS app demonstrating the LocalData package capabilities for secure, typed storage across multiple domains.

Features

This app provides interactive demos for all LocalData storage options:

Tab Demo Storage Domain
Defaults Save/load/remove values UserDefaults
Keychain Secure credentials with biometrics Keychain
Files User profiles with AnyCodable File System
Encrypted Encrypted logs (AES or ChaCha20) Encrypted File System
Sync Platform availability & sync policies Multiple

The project also includes a watchOS companion app target for watch-specific demos.

Requirements

  • iOS 17.0+
  • watchOS 10.0+ (companion app target)
  • Xcode 15+

Getting Started

  1. Open SecureStorgageSample.xcodeproj
  2. Select an iOS simulator or device
  3. Build and run (⌘R)

Project Structure

SecureStorgageSample/
├── ContentView.swift        # Tabbed navigation
├── StorageKeys.swift        # 12 example key definitions
├── WatchOptimized.swift     # Watch data models
└── Views/
    ├── UserDefaultsDemo.swift
    ├── KeychainDemo.swift
    ├── FileSystemDemo.swift
    ├── EncryptedStorageDemo.swift
    └── PlatformSyncDemo.swift
SecureStorageSample Watch App/
├── SecureStorageSampleApp.swift
├── ContentView.swift
└── Services/
    └── WatchConnectivityService.swift

Storage Key Examples

The app demonstrates various storage configurations:

UserDefaults

  • Simple string storage with automatic sync
  • Custom suite support

Keychain

  • 7 accessibility options (whenUnlocked, afterFirstUnlock, etc.)
  • 6 access control options (biometry, passcode, etc.)

File System

  • Documents directory (persisted, backed up)
  • Caches directory (can be purged)
  • JSON and PropertyList serializers

Encrypted Storage

  • AES-256-GCM or ChaCha20-Poly1305 encryption
  • PBKDF2 or HKDF key derivation
  • Complete file protection

Platform & Sync

  • Platform availability (phoneOnly, watchOnly, all)
  • Sync policies (never, manual, automaticSmall)

Dependencies

  • LocalData - Local package for typed secure storage

License

This sample is provided for demonstration purposes.