Skip to content

Latest commit

 

History

History
242 lines (182 loc) · 5.01 KB

File metadata and controls

242 lines (182 loc) · 5.01 KB

Xcode Project Setup

Opening the Project

  1. Open in Xcode

    open OpenMind.xcodeproj
    # or
    xed .
  2. Select Development Team

    • Open project settings (click on "OpenMind" in navigator)
    • Select "OpenMind" target
    • Go to "Signing & Capabilities"
    • Select your development team

Project Configuration

Build Settings

The project is configured with optimized build settings:

  • Swift 5.9 with strict concurrency checking
  • iOS 17.0 minimum deployment target
  • Universal app (iPhone, iPad, Mac Catalyst)
  • Optimized build times with incremental compilation

Schemes

OpenMind - Main app scheme

  • Debug configuration for development
  • Release configuration for App Store
  • Test action includes unit and UI tests
  • Profile action for Instruments

Build Phases

  1. Dependencies - Swift Package Manager
  2. Sources - Compile Swift files
  3. Resources - Copy bundle resources
  4. SwiftLint - Code style checking
  5. Embed Frameworks - Include dependencies

Capabilities

Enabled capabilities:

  • ☁️ CloudKit
  • 📍 Background Modes
  • 🔐 Keychain Sharing
  • 📱 Associated Domains
  • 🎯 Push Notifications

Development Workflow

1. Building

Simulator:

  • Select target device from scheme selector
  • Press Cmd+B to build
  • Press Cmd+R to run

Device:

  • Connect iOS device
  • Select device from scheme selector
  • Ensure provisioning profile is valid
  • Press Cmd+R to run

2. Testing

Run all tests:

Cmd+U

Run specific test:

  • Click on diamond next to test method
  • Or use Test Navigator (Cmd+6)

View coverage:

  • Enable coverage in scheme
  • View in Report Navigator after test run

3. Debugging

Breakpoints:

  • Click line number to add breakpoint
  • Right-click for conditional breakpoints
  • Use breakpoint navigator (Cmd+8)

LLDB Commands:

# Print object
po variable

# Print view hierarchy
pviews

# Measure execution time
measure { expensive_operation() }

View Debugging:

  • Debug menu → View Debugging → Capture View Hierarchy
  • Inspect 3D view hierarchy
  • Check constraint issues

4. Profiling

Instruments:

  • Product → Profile (Cmd+I)
  • Select template:
    • Time Profiler for CPU
    • Allocations for memory
    • Core Animation for UI

Memory Graph:

  • Debug menu → Capture Memory Graph
  • Find retain cycles
  • Analyze object relationships

Xcode Tips

Keyboard Shortcuts

Action Shortcut
Build Cmd+B
Run Cmd+R
Test Cmd+U
Clean Cmd+Shift+K
Find in Project Cmd+Shift+F
Quick Open Cmd+Shift+O
Jump to Definition Cmd+Click
Refactor Cmd+Click → Refactor
Documentation Option+Click

Navigation

  • Navigator (Cmd+1-9):

    • Project (Cmd+1)
    • Source Control (Cmd+2)
    • Symbol (Cmd+3)
    • Find (Cmd+4)
    • Issue (Cmd+5)
    • Test (Cmd+6)
    • Debug (Cmd+7)
    • Breakpoint (Cmd+8)
    • Report (Cmd+9)
  • Editor Options:

    • Assistant Editor (Cmd+Option+Return)
    • Version Editor (Cmd+Option+Shift+Return)
    • Authors View (blame)
    • Comparison View

Code Completion

  • Basic: Start typing and press Escape
  • Fuzzy: Type capitals of method (e.g., vDL for viewDidLoad)
  • Snippets: Type shortcut and press Return

Custom Snippets

Create reusable code snippets:

  1. Select code
  2. Editor → Create Code Snippet
  3. Set title and shortcut
  4. Use <#placeholder#> for variables

Troubleshooting

Common Issues

"No such module" error:

# Clean build folder
Cmd+Shift+K

# Reset packages
File → Packages → Reset Package Caches

Provisioning profile issues:

# Refresh profiles
Xcode → Preferences → Accounts → Download Manual Profiles

Simulator issues:

# Reset simulator
Device → Erase All Content and Settings

# Or from terminal
xcrun simctl erase all

Build performance:

  • Enable build timing: Product → Build With Timing Summary
  • Check for slow compiling files
  • Consider splitting large files

Build Settings

Debug vs Release:

  • Debug: No optimization, assertions enabled
  • Release: Full optimization, stripped symbols

Custom flags:

  • DEVELOPMENT - Development builds
  • TESTFLIGHT - TestFlight builds
  • APP_STORE - App Store builds

Advanced Features

Build Configurations

Additional configurations available:

  • Staging - For testing with staging servers
  • AdHoc - For enterprise distribution

Environment Variables

Set in scheme editor:

  • LOG_LEVEL - Control logging verbosity
  • API_ENDPOINT - Override API URL
  • ENABLE_MOCKS - Use mock data

Xcode Cloud

Integrated CI/CD:

  1. Product → Xcode Cloud → Create Workflow
  2. Configure triggers and actions
  3. Set up post-actions for deployment

Resources