Unable to use iOS framework which is internally using .xib file

前端 未结 8 2251
你的背包
你的背包 2020-12-16 19:14

I am trying to make a universal framework, for iOS by following steps specified in this URL: Universal-framework-iOS

I have a viewController class within, that frame

8条回答
  •  独厮守ぢ
    2020-12-16 19:28

    As an another option you can directly put your xib file into your framework project and can get your nib with calling

    Swift 3 and Swift 4

    let bundleIdentifier = "YOUR_FRAMEWORK_BUNDLE_ID"
    let bundle = Bundle(identifier: bundleIdentifier)
    let view = bundle?.loadNibNamed("YOUR_XIB_FILE_NAME", owner: nil, options: nil)?.first as! UIView
    

    Objective-C

    NSString *bundleIdentifier = @"YOUR_FRAMEWORK_BUNDLE_ID";
    NSBundle *bundle = [NSBundle bundleWithIdentifier:bundleIdentifier];
    UIView *view =  [bundle loadNibNamed:@"YOUR_XIB_FILE_NAME" owner:nil options:nil];
    

提交回复
热议问题