Skip to content

Conversation

@jumaallan
Copy link
Member

@jumaallan jumaallan commented Nov 1, 2025

User description

Story: https://app.shortcut.com/smileid/story/xxx

Summary

A few sentences/bullet points about the changes

Known Issues

Any shortcomings in your work. This may include corner cases not correctly handled or issues related
to but not within the scope of your PR. Design compromises should be discussed here if they were not
already discussed above.

Test Instructions

Concise test instructions on how to verify that your feature works as intended. This should include
changes to the development environment (if applicable) and all commands needed to run your work.

Screenshot

If applicable (e.g. UI changes), add screenshots to help explain your work.


PR Type

Enhancement


Description

  • Migrated iOS implementation from CocoaPods to Swift Package Manager (SPM)

  • Updated Pigeon configuration to generate Swift code in new SPM directory structure

  • Restructured iOS plugin architecture with new source files and package manifest

  • Enhanced sample app with SPM support and updated project configuration


File Walkthrough

Relevant files
Configuration changes
5 files
messages.dart
Updated Swift output path for Pigeon code generation         
+1/-1     
Package.swift
Added Swift Package Manager manifest for iOS plugin           
+11/-0   
AppFrameworkInfo.plist
Updated minimum iOS version to 13.0                                           
+1/-1     
project.pbxproj
Updated Xcode project with SPM package references               
+23/-1   
Runner.xcscheme
Enhanced build scheme with Flutter framework preparation script
+21/-0   
Enhancement
15 files
FlutterPlatformView+EmbedSwiftUIView.swift
Implemented SwiftUI view embedding utility for Flutter platform views
[link]   
Mapper.swift
Added comprehensive data mapping between Flutter and native types
[link]   
SmileIDBiometricKYC.swift
Implemented Biometric KYC platform view with Flutter integration
[link]   
SmileIDDictExt.swift
Added dictionary extension for JSON compatibility conversion
[link]   
SmileIDDocumentCaptureView.swift
Implemented document capture view with SwiftUI integration
[link]   
SmileIDDocumentVerification.swift
Implemented document verification platform view with delegate handling
[link]   
SmileIDEnhancedDocumentVerification.swift
Implemented enhanced document verification with consent information
support
[link]   
SmileIDMessages.g.swift
Generated Pigeon message classes for Flutter-iOS communication
[link]   
SmileIDPlugin.swift
Implemented main plugin class with API methods and view registrations
[link]   
SmileIDSmartSelfieAuthentication.swift
Implemented Smart Selfie authentication platform view       
[link]   
SmileIDSmartSelfieAuthenticationEnhanced.swift
Implemented enhanced Smart Selfie authentication with SwiftUI
[link]   
SmileIDSmartSelfieCaptureView.swift
Implemented selfie capture view with liveness detection support
[link]   
SmileIDSmartSelfieEnrollment.swift
Implemented Smart Selfie enrollment platform view               
[link]   
SmileIDSmartSelfieEnrollmentEnhanced.swift
Implemented enhanced Smart Selfie enrollment with SwiftUI
[link]   
SmileIDUtils.swift
Added utility functions for URL validation and timestamp generation
[link]   
Formatting
1 files
AppDelegate.swift
Updated app delegate annotation to use @main                         
+1/-1     
Additional files
1 files
.gitkeep [link]   


Need help?
  • Type /help how to ... in the comments thread for any questions about PR-Agent usage.
  • Check out the documentation for more information.
  • @jumaallan jumaallan requested a review from a team as a code owner November 1, 2025 10:33
    @prfectionist prfectionist bot changed the title Migrate to SPM 🥷 Migrate to SPM 🥷 Nov 1, 2025
    @prfectionist
    Copy link
    Contributor

    prfectionist bot commented Nov 1, 2025

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 4 🔵🔵🔵🔵⚪
    🧪 No relevant tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    Error Handling

    The getFile function silently returns nil on errors without logging or providing context. This could make debugging file access issues difficult. Consider adding error logging or throwing specific errors to help diagnose problems during file operations.

    func getFile(atPath path: String) -> Data? {
        // Create a URL from the provided path
        let fileURL = URL(fileURLWithPath: path)
        do {
            // Check if the file exists
            let fileExists = try fileURL.checkResourceIsReachable()
            if fileExists {
                // Read the contents of the file
                let fileData = try Data(contentsOf: fileURL)
                return fileData
            } else {
                return nil
            }
        } catch {
            return nil
        }
    }
    Force Unwrapping

    Multiple force unwraps are used when accessing file data (e.g., getFile(atPath: selfieImage)!). If the file doesn't exist or can't be read, this will cause a crash. Should implement proper error handling and propagate failures to the completion handler instead of force unwrapping.

    selfieImage: MultipartBody(
        withImage: getFile(atPath: selfieImage)!,
        forName: URL(fileURLWithPath: selfieImage).lastPathComponent
    )!,
    livenessImages: livenessImages.map {
        MultipartBody(
            withImage: getFile(atPath: $0)!,
            forName: URL(fileURLWithPath: $0).lastPathComponent
        )!
    },
    Deprecated API

    Uses deprecated UIApplication.shared.windows API which was deprecated in iOS 15. This should be updated to use UIApplication.shared.connectedScenes or window scene-based approach for better compatibility with modern iOS versions.

    if let navigationController = UIApplication.shared.windows.first?.rootViewController
        as? UINavigationController,
        let flutterViewController = navigationController.viewControllers.first
            as? FlutterViewController {
        flutterViewController.addChild(hostingController)
        parentView.addSubview(hostingController.view)
        hostingController.view.setNeedsLayout()
        hostingController.view.layoutIfNeeded()
    } else {
        let rootViewController = UIApplication.shared.windows.first?.rootViewController
        rootViewController?.addChild(hostingController)
    }

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Projects

    None yet

    Development

    Successfully merging this pull request may close these issues.

    1 participant