I'm writing a swift-macro to expand a function with param which has default value. I want it to write those convenient functions exposed to oc.
I have done this macro. But those functions are not accessable from obj-c. Anyone can help?
original code:
@ExpandVariantsForOC
func testExpandVariantsForOC(test topic: Int, _ option: Double = 0, h_src: String? = nil) {
print(topic)
}
expanded code:
@objc
@available(swift, obsoleted: 1.0)
func testExpandVariantsForOC(test topic: Int) {
testExpandVariantsForOC(test: topic, 0, h_src: nil)
}
@objc
@available(swift, obsoleted: 1.0)
func testExpandVariantsForOC(test topic: Int, _ option: Double) {
testExpandVariantsForOC(test: topic, option, h_src: nil)
}
@objc
@available(swift, obsoleted: 1.0)
func testExpandVariantsForOC(test topic: Int, h_src: String?) {
testExpandVariantsForOC(test: topic, 0, h_src: h_src)
}