Closed ghost closed 6 years ago
Hey @ahamedsaifudeen
Currently WhatsNewKit
doesn't support Objective-C.
In order to make WhatsNewKit
compatible with Objective-C a lot of existing code must be refactored. For example all WhatsNew
structs must be refactored to classes to make them visible in an Objective-C environment.
@SvenTiigi
Understand the complexity. Thanks for the quick response.
If you write yourself a wrapper .swift file, you can use it in an Objective C project (assuming you've already setup support for having both ObjC and Swift in the same project)
@mikemaat Thanks a lot. This is very helpful. I have added this and it works great.
@SvenTiigi It might be helpful to include this.
This works great! You'll just need to create this as WhatsNewObjcWrapper.swift, then import
In case this saves anyone time, here is the code from the image above in copy/pastable text form:
import Foundation
import WhatsNewKit
@objc class WhatsNewObjcWrapper: UIViewController {
@objc static func getWhatsNewViewController() -> UIViewController {
let whatsNew = WhatsNew(title: "New!",
items: [
WhatsNew.Item(
title: "<Your Title>",
subtitle: "Your Description",
image: UIImage(named: "your-image")
),
WhatsNew.Item(
title: "<Your Title>",
subtitle: "Your Description",
image: UIImage(named: "your-image")
),
WhatsNew.Item(
title: "<Your Title>",
subtitle: "Your Description",
image: UIImage(named: "your-image")
),
]
)
let whatsNewViewController = WhatsNewViewController(whatsNew: whatsNew)
return whatsNewViewController
}
}
UIViewController* whatsNewController = [WhatsNewObjcWrapper getWhatsNewViewController];
[self.navigationController presentViewController:whatsNewController animated:true completion:nil];
Can you include an example for using your component on Objective-c?