NFC Reader and Writer in one ViewController

Hello,

i want to have a NFCReader and NFCWriter in one ViewController. The problem is that always the writeNFC function gets called even when I call the readNFC function.

What I want: readNFC function which starts the session calls -->     func readerSession(_ session: NFCNDEFReaderSession, didDetectNDEFs messages: [NFCNDEFMessage]) {

writeNFC function which starts the session calls -->   func readerSession(_ writesession: NFCNDEFReaderSession, didDetect tags: [NFCNDEFTag]) {

What happens: write and readNFC call --> func readerSession(_ writesession: NFCNDEFReaderSession, didDetect tags: [NFCNDEFTag]) { which is the function that writes on NFC Tags.

How can you have both functions in on file and be able to call them both?

Thanks for Help

NFC Reader and Writer in one ViewController
 
 
Q