Jacob Rhoda
09/26/2023, 5:22 PMfinal
. https://kotlinlang.org/docs/native-objc-interop.html#subclassing-swift-objective-c-classes-and-protocols-from-kotlinGiovanni Trenta
10/04/2023, 1:15 PMJacob Rhoda
10/04/2023, 1:16 PMJacob Rhoda
10/04/2023, 1:18 PMCarlo De Chellis
10/04/2023, 1:22 PMCarlo De Chellis
10/04/2023, 1:22 PMJacob Rhoda
10/04/2023, 1:23 PMCarlo De Chellis
10/04/2023, 1:27 PMGiovanni Trenta
10/04/2023, 2:29 PMxxfast
08/06/2025, 4:47 AM-[NFCTagReaderSession didDetectTags:connectedTagIndex:]:163 Delegate does not implement -tagReaderSession:didDetectTags: method
But my kotlin delegate looks like
class NFCTagReaderSessionDelegate() : NSObject(), NFCTagReaderSessionDelegateProtocol {
override fun tagReaderSession(session: NFCTagReaderSession, didDetectTags: List<*>) {
}
}
xxfast
08/06/2025, 4:49 AMxxfast
08/06/2025, 4:51 AMxxfast
08/06/2025, 5:02 AMactual class Nfc {
lateinit var delegate: NFCTagReaderSessionDelegate
@OptIn(ExperimentalForeignApi::class)
actual fun ndef(): Flow<NfcDataExchangeFormat> = callbackFlow {
delegate = NFCTagReaderSessionDelegate(scope = this)
val session = NFCTagReaderSession(
pollingOption = NFCPollingISO14443 or NFCPollingISO15693 or NFCPollingISO18092,
delegate = delegate,
queue = dispatch_get_main_queue(),
)
session.alertMessage = "Hold your iPhone near an NFC tag to pair with the device."
session.beginSession()
awaitClose { session.invalidateSession() }
}
}