Thanks to visit codestin.com
Credit goes to github.com

Skip to content

An intelligent iOS skincare analysis and recommendation app powered by AI, offering personalized skincare routines through advanced computer vision and machine learning capabilities.

Notifications You must be signed in to change notification settings

aryansk/SkinCare.ai

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🧴 SkinCare.ai

An intelligent iOS skincare analysis and recommendation app powered by AI, offering personalized skincare routines through advanced computer vision and machine learning capabilities, with 250+ ingredients indexed.

Swift Platform License SwiftUI Maintenance

SkinCare ai Presentation

πŸ“– Table of Contents

🌟 Core Features

πŸ€– AI-Powered Skin Analysis

  • Computer Vision Engine
    • Real-time skin condition detection
    • Multi-point facial analysis
    • Texture and pigmentation assessment
    • Age estimation and skin health scoring
  • Smart Recommendations
    • Personalized ingredient suggestions
    • Custom routine generation
    • Progress tracking and adjustments
    • Seasonal adaptations
  • Condition Recognition
    • Acne and blemish detection
    • Hyperpigmentation analysis
    • Fine lines and wrinkle assessment
    • Pore size evaluation

πŸ“Š Progress Tracking System

  • Visual Analytics
    • Before/after comparisons
    • Progress charts and trends
    • Skin health metrics
    • Goal achievement tracking
  • Smart Insights
    • Weekly progress reports
    • Improvement predictions
    • Routine effectiveness analysis
    • Personalized tips and alerts
  • Data Synchronization
    • Cloud backup
    • Multi-device sync
    • Export capabilities
    • Privacy-first storage

πŸ§ͺ Comprehensive Ingredients Database

  • Extensive Catalog
    • 250+ skincare ingredients
    • Scientific descriptions
    • Compatibility matrix
    • Evidence-based ratings
  • Smart Search
    • Ingredient lookup
    • Concern-based filtering
    • Brand and product matching
    • Allergy and sensitivity alerts
  • Educational Content
    • Detailed explanations
    • Usage guidelines
    • Interaction warnings
    • Research references

πŸ”§ Technical Overview

System Requirements

  • iOS Requirements
    • iOS 17.0 or later
    • 64-bit devices only
    • Minimum 3GB RAM
    • 200MB free space
    • Camera access required
  • Development Requirements
    • Xcode 15.0+
    • Swift 5.9+
    • macOS Sonoma 14.0+
    • Git 2.3.0+

Dependencies

# Podfile
pod 'CoreML', '~> 3.0'
pod 'Vision', '~> 3.0'
pod 'Charts', '~> 4.1.0'
pod 'Alamofire', '~> 5.8.0'
pod 'SwiftyJSON', '~> 5.0.0'
pod 'Realm', '~> 10.45.0'
pod 'Lottie', '~> 4.3.0'
pod 'SwiftLint', '~> 0.52.0'

Environment Variables

GEMINI_API_KEY=your_gemini_api_key
ENVIRONMENT=development|staging|production
DEBUG_LEVEL=verbose|info|warning|error
FEATURE_FLAGS={"aiAnalysis":true,"progressTracking":true,"ingredients":true}
ANALYTICS_KEY=your_analytics_key

πŸš€ Installation

Automated Setup

# Clone the repository
git clone https://github.com/yourusername/skincare-ai.git

# Navigate to project directory
cd skincare-ai

# Install dependencies
pod install

# Setup configuration
./scripts/setup.sh

# Open workspace
open SkinCare.ai.xcworkspace

Manual Configuration

  1. Create Configuration.plist in the project root
  2. Add required API keys and environment variables
  3. Configure signing certificates
  4. Select appropriate build scheme
  5. Build and run the project

πŸ—οΈ Architecture

MVVM + Store Pattern

// Example ViewModel Structure
class SkinAnalysisViewModel: ObservableObject {
    @Published var analysisResult: ScanResult?
    @Published var isAnalyzing: Bool = false
    @Published var progressData: [ProgressMetric] = []
    
    private let scanStore: ScanStore
    private let aiAnalyzer: MLAnalyzing
    
    init(scanStore: ScanStore = .shared, 
         aiAnalyzer: MLAnalyzing = GeminiAnalyzer()) {
        self.scanStore = scanStore
        self.aiAnalyzer = aiAnalyzer
    }
    
    @MainActor
    func analyzeSkin(image: UIImage) async {
        isAnalyzing = true
        defer { isAnalyzing = false }
        
        do {
            let result = try await aiAnalyzer.analyze(image: image)
            analysisResult = result
            await scanStore.addScan(result)
        } catch {
            handleError(error)
        }
    }
}

Data Flow Architecture

graph TD
    A[Camera View] --> B[Analysis ViewModel]
    B --> C[AI Service Layer]
    C --> D[Core ML Model]
    C --> E[Gemini API]
    D --> F[Local Analysis]
    E --> F
    F --> G[Scan Store]
    G --> H[Progress Store]
    H --> I[Dashboard View]
    G --> J[Local Storage]
Loading

Store Management

class ScanStore: ObservableObject {
    @Published var scans: [ScanResult] = []
    @Published var metrics: SkinMetrics = SkinMetrics()
    
    private let storage: SkinDataStorage
    
    init(storage: SkinDataStorage = RealmStorage()) {
        self.storage = storage
        loadScans()
    }
    
    func addScan(_ scan: ScanResult) async {
        await MainActor.run {
            scans.append(scan)
            updateMetrics()
        }
        try? await storage.save(scan)
    }
    
    private func updateMetrics() {
        metrics = SkinMetrics(from: scans)
    }
}

🎨 UI Components

Design System

struct SkinCareTheme {
    // Colors
    static let primary = Color("SkinCarePrimary")     // #FF6B9D
    static let secondary = Color("SkinCareSecondary") // #4ECDC4
    static let accent = Color("SkinCareAccent")       // #FFE66D
    static let background = Color("Background")        // #F8F9FA
    static let surface = Color("Surface")             // #FFFFFF
    static let text = Color("TextPrimary")            // #2C3E50
    
    // Typography
    static let titleFont = Font.custom("SF Pro Display", size: 28).weight(.bold)
    static let headlineFont = Font.custom("SF Pro Display", size: 20).weight(.semibold)
    static let bodyFont = Font.custom("SF Pro Text", size: 16).weight(.regular)
    static let captionFont = Font.custom("SF Pro Text", size: 14).weight(.light)
    
    // Spacing
    static let padding: CGFloat = 16
    static let cornerRadius: CGFloat = 12
    static let shadowRadius: CGFloat = 8
}

Core Components

  • Analysis Camera View
    • Real-time face detection overlay
    • Guidance animations
    • Capture confirmation
    • Error state handling
  • Progress Dashboard
    • Animated charts
    • Metric cards
    • Timeline view
    • Goal tracking
  • Ingredient Explorer
    • Search interface
    • Category filters
    • Detail sheets
    • Favorites system

Glass-morphism UI Elements

struct GlassMorphCard: View {
    let content: AnyView
    
    var body: some View {
        content
            .padding(.padding)
            .background {
                RoundedRectangle(cornerRadius: .cornerRadius)
                    .fill(.ultraThinMaterial)
                    .shadow(color: .black.opacity(0.1), 
                           radius: .shadowRadius, x: 0, y: 4)
            }
            .overlay {
                RoundedRectangle(cornerRadius: .cornerRadius)
                    .stroke(.white.opacity(0.2), lineWidth: 1)
            }
    }
}

πŸ€– AI Integration

Gemini AI Configuration

class GeminiAnalyzer: MLAnalyzing {
    private let apiKey: String
    private let session: URLSession
    
    init() {
        guard let apiKey = Bundle.main.infoDictionary?["GEMINI_API_KEY"] as? String else {
            fatalError("Gemini API Key not found")
        }
        self.apiKey = apiKey
        self.session = URLSession(configuration: .default)
    }
    
    func analyze(image: UIImage) async throws -> ScanResult {
        let base64Image = image.jpegData(compressionQuality: 0.8)?.base64EncodedString()
        
        let request = AnalysisRequest(
            image: base64Image,
            analysisType: .comprehensive,
            includeRecommendations: true
        )
        
        return try await performAnalysis(request: request)
    }
}

On-Device ML Pipeline

class CoreMLSkinAnalyzer: MLAnalyzing {
    private let visionModel: VNCoreMLModel
    private let classificationModel: VNCoreMLModel
    
    init() throws {
        let skinAnalysisModel = try SkinAnalysisModel(configuration: .init())
        let classificationMLModel = try SkinClassificationModel(configuration: .init())
        
        self.visionModel = try VNCoreMLModel(for: skinAnalysisModel.model)
        self.classificationModel = try VNCoreMLModel(for: classificationMLModel.model)
    }
    
    func analyze(image: UIImage) async throws -> ScanResult {
        return try await withCheckedThrowingContinuation { continuation in
            analyzeWithVision(image: image) { result in
                continuation.resume(with: result)
            }
        }
    }
}

Analysis Pipeline

  1. Image Preprocessing
    • Face detection and cropping
    • Lighting normalization
    • Resolution standardization
  2. Feature Extraction
    • Texture analysis
    • Color distribution
    • Geometric measurements
  3. Condition Classification
    • Multi-label classification
    • Confidence scoring
    • Severity assessment
  4. Recommendation Generation
    • Ingredient matching
    • Routine suggestions
    • Timeline predictions

⚑ Performance

Optimization Strategies

  • Image Processing
    • Efficient compression algorithms
    • Background processing queues
    • Memory-mapped file operations
    • Progressive loading
  • ML Inference
    • Model quantization
    • Batch processing
    • GPU acceleration
    • Result caching
  • UI Responsiveness
    • Lazy loading
    • View recycling
    • Animation optimization
    • Haptic feedback timing

Performance Benchmarks

Operation Target Time Current Average 95th Percentile
App Launch < 3s 2.1s 2.8s
Skin Analysis < 8s 6.4s 7.9s
Ingredient Search < 0.5s 0.2s 0.4s
Progress Load < 1s 0.6s 0.9s
Data Sync < 5s 3.2s 4.7s

Memory Usage

// Memory optimization example
class ImageCache {
    private let cache = NSCache<NSString, UIImage>()
    
    init() {
        cache.countLimit = 50
        cache.totalCostLimit = 100 * 1024 * 1024 // 100MB
    }
    
    func store(_ image: UIImage, forKey key: String) {
        let cost = image.jpegData(compressionQuality: 0.8)?.count ?? 0
        cache.setObject(image, forKey: key as NSString, cost: cost)
    }
}

πŸ”’ Security

Data Protection Framework

class SecureStorage {
    private let keychain = Keychain(service: "com.skincare.ai")
    
    func store(_ data: Data, for key: String) throws {
        try keychain
            .accessibility(.whenUnlockedThisDeviceOnly)
            .set(data, key: key)
    }
    
    func retrieve(for key: String) throws -> Data? {
        return try keychain.getData(key)
    }
}

Privacy Measures

  • Local Processing
    • On-device ML inference
    • Encrypted local storage
    • No image transmission by default
  • Data Minimization
    • Only essential data collection
    • Automatic data expiration
    • User-controlled deletion
  • Compliance
    • GDPR compliance
    • CCPA compliance
    • HIPAA considerations
    • SOC 2 Type II

🀝 Contributing

Development Setup

# Install development tools
brew install swiftlint
brew install xcbeautify

# Setup git hooks
./scripts/install-hooks.sh

# Run initial setup
make setup

Code Quality Standards

// Example component structure
struct SkinAnalysisCard: View {
    // MARK: - Properties
    let scanResult: ScanResult
    @State private var isExpanded: Bool = false
    
    // MARK: - Body
    var body: some View {
        GlassMorphCard {
            VStack(alignment: .leading, spacing: 12) {
                headerSection
                if isExpanded {
                    detailSection
                }
            }
        }
        .animation(.spring(response: 0.6, dampingFraction: 0.8), 
                  value: isExpanded)
    }
    
    // MARK: - View Components
    private var headerSection: some View {
        HStack {
            VStack(alignment: .leading) {
                Text("Skin Analysis")
                    .font(.headlineFont)
                Text(scanResult.date.formatted())
                    .font(.captionFont)
                    .foregroundColor(.secondary)
            }
            Spacer()
            Button {
                withAnimation {
                    isExpanded.toggle()
                }
            } label: {
                Image(systemName: "chevron.down")
                    .rotationEffect(.degrees(isExpanded ? 180 : 0))
            }
        }
    }
}

Testing Requirements

  • Minimum 80% code coverage
  • All UI components must have accessibility tests
  • Performance tests for critical paths
  • Integration tests for AI pipeline

πŸ“š Documentation

API Reference

Architecture Guides

User Guides

βœ… Testing

Test Suite Structure

class SkinAnalysisViewModelTests: XCTestCase {
    var viewModel: SkinAnalysisViewModel!
    var mockScanStore: MockScanStore!
    var mockAnalyzer: MockAnalyzer!
    
    override func setUp() {
        super.setUp()
        mockScanStore = MockScanStore()
        mockAnalyzer = MockAnalyzer()
        viewModel = SkinAnalysisViewModel(
            scanStore: mockScanStore,
            aiAnalyzer: mockAnalyzer
        )
    }
    
    func testSuccessfulAnalysis() async throws {
        // Given
        let testImage = UIImage(systemName: "photo")!
        mockAnalyzer.mockResult = ScanResult.sample
        
        // When
        await viewModel.analyzeSkin(image: testImage)
        
        // Then
        XCTAssertEqual(viewModel.analysisResult, ScanResult.sample)
        XCTAssertFalse(viewModel.isAnalyzing)
        XCTAssertEqual(mockScanStore.addScanCallCount, 1)
    }
}

Testing Commands

# Run all tests
xcodebuild test -workspace SkinCare.ai.xcworkspace -scheme SkinCare.ai -destination 'platform=iOS Simulator,name=iPhone 15 Pro'

# Run specific test suite
xcodebuild test -workspace SkinCare.ai.xcworkspace -scheme SkinCare.ai -only-testing:SkinCareAITests/SkinAnalysisViewModelTests

# Generate coverage report
xcodebuild test -workspace SkinCare.ai.xcworkspace -scheme SkinCare.ai -enableCodeCoverage YES

πŸ“¦ Deployment

Build Configuration

// Configuration.plist structure
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>GEMINI_API_KEY</key>
    <string>$(GEMINI_API_KEY)</string>
    <key>ENVIRONMENT</key>
    <string>$(ENVIRONMENT)</string>
    <key>APP_VERSION</key>
    <string>$(MARKETING_VERSION)</string>
</dict>
</plist>

CI/CD Pipeline

name: iOS CI/CD
on:
  push:
    branches: [ main, develop ]
  pull_request:
    branches: [ main ]

jobs:
  test:
    runs-on: macos-latest
    steps:
    - uses: actions/checkout@v3
    - name: Install dependencies
      run: pod install
    - name: Run tests
      run: xcodebuild test -workspace SkinCare.ai.xcworkspace -scheme SkinCare.ai
    - name: Generate coverage
      run: xcbeautify --report junit

App Store Release Process

  1. Pre-release
    • Version bump and changelog update
    • Code signing verification
    • TestFlight beta distribution
  2. Release
    • App Store submission
    • Metadata and screenshots update
    • Release notes preparation
  3. Post-release
    • Performance monitoring
    • User feedback analysis
    • Hotfix deployment if needed

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE.md file for details.

πŸ™ Acknowledgments

  • Google Gemini AI for advanced AI capabilities
  • Apple Core ML for on-device machine learning
  • SwiftUI for modern UI framework
  • Vision Framework for computer vision
  • Our dermatology consultants and beta testing community
  • Open source contributors and skincare ingredient databases

SkinCare.ai - Transforming skincare through intelligent analysis and personalized recommendations.

About

An intelligent iOS skincare analysis and recommendation app powered by AI, offering personalized skincare routines through advanced computer vision and machine learning capabilities.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages