Colton Idle
01/07/2024, 4:26 PMval nsUrl = NSURL.URLWithString(url)
if (UIApplication.sharedApplication.canOpenURL(nsUrl!!)) {
UIApplication.sharedApplication.openURL(nsUrl)
}
Am I understanding this right... that this is kotlin code... but it's accessing apple/iOS framework code? I didn't know that was possible.
I was doing this in swift
func openInBrowser(url: String) {
#if os(iOS)
UIApplication.shared.open(URL(string: url)!)
#endif
#if os(macOS)
NSWorkspace.shared.open(URL(string: url)!)
#endif
}
jw
01/07/2024, 4:59 PMthis is kotlin code... but it's accessing apple/iOS framework codethis is entire function of the cinterop tool for Kotlin (and by extension, the C calling convention for any language)
Colton Idle
01/07/2024, 9:48 PMjw
01/07/2024, 9:49 PMjw
01/07/2024, 9:49 PMjw
01/07/2024, 9:50 PMjw
01/07/2024, 9:51 PMColton Idle
01/07/2024, 9:54 PMColton Idle
01/07/2024, 9:56 PMjw
01/07/2024, 9:58 PMjw
01/07/2024, 9:58 PMColton Idle
01/07/2024, 10:06 PMColton Idle
01/07/2024, 10:07 PMKotlin generates C headers that have objective c annotations to add sugar for objective c callersand if im on the right path with what headers are. then it'd seem like generating c headers with swift annotations would be "easy", no?
jw
01/07/2024, 10:09 PMjw
01/07/2024, 10:11 PMjw
01/07/2024, 10:11 PM