Skip to content

Latest commit

 

History

History
281 lines (201 loc) · 5.91 KB

File metadata and controls

281 lines (201 loc) · 5.91 KB

OpenMind Development Guide

This guide provides a comprehensive overview of the development environment, tools, and workflows for the OpenMind iOS application.

Quick Start

# Clone and setup
git clone https://github.com/openmind/openmind-ios.git
cd openmind-ios
make setup

# Daily development
make dev        # Format, lint, and build
make test       # Run tests
make run        # Run in simulator

Development Environment

Required Tools

Tool Version Purpose Installation
Xcode 15.0+ IDE & Compiler App Store
SwiftLint Latest Code linting brew install swiftlint
SwiftFormat Latest Code formatting brew install swiftformat
Fastlane Latest Automation brew install fastlane
XcodeGen Latest Project generation brew install xcodegen

Project Structure

OpenMind/
├── App/                    # Application lifecycle
├── Core/                   # Business logic & models
├── Features/              # Feature modules
├── UI/                    # Shared UI components
├── Platform/              # Platform-specific code
├── Resources/             # Assets and resources
├── Tests/                 # Unit and UI tests
├── Scripts/               # Automation scripts
└── docs/                  # Documentation

Development Workflow

1. Feature Development

# Create feature branch
git checkout -b feature/node-grouping

# Make changes and test
make dev
make test

# Commit with conventional commits
git commit -m "feat: add node grouping functionality"

2. Testing

# Run all tests
make test

# Specific test types
./Scripts/run-tests.sh --unit-only
./Scripts/run-tests.sh --ui-only

# Performance testing
RUN_PERF=true ./Scripts/run-tests.sh

# Snapshot testing
SNAPSHOT_RECORD=true make test  # Record
make test                        # Verify

3. Code Quality

# Lint code
make lint

# Format code
make format

# Find dead code
make deadcode

# Security scan
./Scripts/security-scan.sh

4. Performance Profiling

# Profile with Instruments
./Scripts/instruments-profile.sh all

# Monitor memory
./Scripts/memory-monitor.sh 60

# Stress test
STRESS_TEST=true ./Scripts/memory-monitor.sh

Key Development Areas

1. Data Models (Core/Models/)

SwiftData models for persistence:

  • MindMapNode - Node representation
  • MindMapDocument - Document container
  • MindMapStyle - Visual styling

2. Layout Engine (Core/Services/LayoutEngine.swift)

Layout algorithms:

  • Radial layout
  • Tree layout (vertical/horizontal)
  • Organic/force-directed layout

3. Rendering (Features/Canvas/)

Dual rendering system:

  • Metal renderer for performance
  • Core Graphics fallback
  • Automatic switching based on node count

4. Platform Features (Platform/)

Platform-specific implementations:

  • iOS: Touch and pencil support
  • iPadOS: Multitasking and drag-drop
  • macOS: Menu bar and keyboard shortcuts

Testing Strategy

Test Types

  1. Unit Tests - Business logic validation
  2. UI Tests - User interface testing
  3. Performance Tests - Speed and memory benchmarks
  4. Snapshot Tests - Visual regression testing

Coverage Requirements

  • Overall: 70% minimum
  • Critical paths: 90% minimum
  • New code: 80% minimum

Performance Guidelines

Target Metrics

  • Frame Rate: 60fps with 10,000+ nodes
  • Memory: <200MB for typical documents
  • Launch Time: <1 second
  • Render Time: <16ms per frame

Optimization Techniques

  1. Culling - Only render visible nodes
  2. Batching - Group draw calls
  3. Caching - Store layout calculations
  4. LOD - Reduce detail for distant nodes

Security Best Practices

Code Security

// ❌ Never hardcode secrets
let apiKey = "sk_live_abc123"

// ✅ Use environment variables
let apiKey = ProcessInfo.processInfo.environment["API_KEY"]

Data Protection

  • Encrypt sensitive data at rest
  • Use HTTPS for all network requests
  • Implement certificate pinning
  • Follow least privilege principle

Debugging

Common Issues

  1. Performance Issues

    # Profile the specific area
    ./Scripts/instruments-profile.sh performance
  2. Memory Leaks

    # Check for leaks
    ./Scripts/memory-monitor.sh
  3. Layout Problems

    # Enable layout debugging
    defaults write com.openmind.app ShowLayoutBounds YES

Debug Tools

  • Xcode Memory Graph
  • View Hierarchy Debugger
  • Network Link Conditioner
  • Console.app for logs

Release Process

Pre-release Checklist

  • All tests passing
  • No security vulnerabilities
  • Performance benchmarks met
  • Documentation updated
  • Version number incremented

Release Commands

# Beta release
fastlane beta

# Production release
fastlane release

Contributing

Code Style

  • Follow SwiftLint rules
  • Use SwiftFormat for consistency
  • Write self-documenting code
  • Add comments for complex logic

Pull Request Process

  1. Create feature branch
  2. Make changes with tests
  3. Ensure CI passes
  4. Request code review
  5. Merge after approval

Resources

Documentation

External Resources

Getting Help

  • GitHub Issues for bugs
  • GitHub Discussions for questions
  • Slack #openmind-dev for team chat
  • Stack Overflow for general Swift/iOS help

For detailed information on any topic, refer to the specific documentation in the docs/ directory.