Cannot find type SwiftUI 'Color' in scope

I added an extension to UIColor with a quick conversion function to SwiftUI's Color. It's very simple:

import Foundation
import SwiftUI
import UIKit

@available(iOS 13, macOS 10.15, *)
public extension UIColor {
    
    /// Converts the platform specific color object to a swiftUI color struct. 
    /// - Returns: Equivalent SwiftUI color
    func psoColor() -> Color {
        return Color(self)
    }
}

The compiler raises an error in release mode: 'Cannot find type 'Color' in scope'. But when compiling in debug mode I don't get that error.

The framework where it resides was originally developed in obj-c but I have been adding Swift clases with no problems since Swift 3. I'm currently using Swift 5.3 with Xcode 12.0. The deployment target is set to iOS 10.0 that's why I added the @available decorator.

I have no idea how to debug this, any help is greatly appreciate it.


Problem is with architecture, swiftUI is not available for armv7. When building in release mode, it included arm64 and armv7.

Reference: SwiftUI - “Use of undeclared type xxx” on deployment targets below or equal to iOS 10


By adding import UIkit your problem will resolve in swift 5