iosxcframework

Swiftinterface file only has reference to a single class


Im building an XCFramework for distribution. All of the classes and properties i want exposed and accessible are marked open or public. I have several classes and files in this framework, but when i open and view the .swiftinterface file i only see reference to a single class, and thus when i import this framework in my project the non referenced properties are unavailable.

The generated .swiftinterface looks like

// swift-interface-format-version: 1.0
// swift-compiler-version: Apple Swift version 6.0.2 effective-5.10 (swiftlang-6.0.2.1.2 clang-1600.0.26.4)
// swift-module-flags: -target arm64-apple-ios14.5-simulator -enable-objc-interop -enable-library-evolution -swift-version 5 -enforce-exclusivity=checked -O -enable-bare-slash-regex -module-name MyFramework
// swift-module-flags-ignorable: -no-verify-emitted-module-interface
import Foundation
@_exported import MyFramework
import Swift
import _Concurrency
import _StringProcessing
import _SwiftConcurrencyShims
open class MyFrameworkClass : Swift.Decodable {
  open var url: Swift.String?
  open var parameters: MyFrameworkProperty.Parameters?
  public init(url: Swift.String? = nil, parameters: MyFrameworkProperty.Parameters? = nil)
  @objc deinit
  required public init(from decoder: any Swift.Decoder) throws
}
open class Parameters : Swift.Decodable {
  open var PropertyA: Swift.String?
  open var PropertyB: Swift.String?
  open var PropertyC: Swift.String?
  public init(PropertyA: Swift.String? = nil, PropertyB: Swift.String? = nil, PropertyC: Swift.String? = nil)
  @objc deinit
  required public init(from decoder: any Swift.Decoder) throws
}
public enum PropertyC : Swift.String, Swift.CaseIterable {
  case a
  case b
  case c
  public init?(rawValue: Swift.String)
  public typealias AllCases = [MyFramework.PropertyC]
  public typealias RawValue = Swift.String
  nonisolated public static var allCases: [MyFramework.PropertyC] {
    get
  }
  public var rawValue: Swift.String {
    get
  }
}
extension MyFramework.PropertyC : Swift.Equatable {}
extension MyFramework.PropertyC : Swift.Hashable {}
extension MyFramework.PropertyC : Swift.RawRepresentable {}

i compiled these using the following commands

xcodebuild archive -workspace MyFramework.xcworkspace \
-scheme MyFramework \
-configuration Release \
-destination 'generic/platform=iOS Simulator' \
-archivePath './build/MyFramework.framework-iphonesimulator.xcarchive' \
SKIP_INSTALL=NO \
BUILD_LIBRARIES_FOR_DISTRIBUTION=YES

xcodebuild archive -workspace MyFramework.xcworkspace \
-scheme MyFramework \
-configuration Release \
-destination 'generic/platform=iOS' \
-archivePath './build/MyFramework.framework-iphoneos.xcarchive' \
SKIP_INSTALL=NO \
BUILD_LIBRARIES_FOR_DISTRIBUTION=YES

xcodebuild -create-xcframework \                          
-framework './build/MyFramework.framework-iphonesimulator.xcarchive/Products/Library/Frameworks/MyFramework.framework' \
-framework './build/MyFramework.framework-iphoneos.xcarchive/Products/Library/Frameworks/MyFramework.framework' \
-output './build/MyFramework.xcframework'

MyFramework.h file from my framework before compilation looks like

#import <Foundation/Foundation.h>

FOUNDATION_EXPORT double MyFrameworkVersionNumber;

FOUNDATION_EXPORT const unsigned char MyFrameworkVersionString[];

What is required to have all my public/open properties available to the project that imports the xcframework?


Solution

  • The answer turned out to be rather obvious - i had many files with no target member. The only one that had target ownership was the one that i could see its classes in the .swiftinterface file. Adding the files to my frameworks target resolved the problems.