Thanks for response and here issue in pid value change is due to 'var ip: String' in my swift code. I have declared ip as 'String' type in swift and 'unsigned char[16]' type in C.
Now I removed structure from swift and defined the struct in a C-style header file, and imported it into Swift using the Bridging-Header. I able to assign the values to all member variables in structure in C-style header file except for 'unsigned char ip[16]'
I tried to assign value to unsigned char ip[16] type in C-style header from swift as below
let host: String = remoteEndpoint.hostname as String
event_info.ip = Array(host.utf8)
But I am facing with compilation error Cannot assign value of type 'Array<String.UTF8View.Element>' (aka 'Array<UInt8>') to type '(UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8)'
Please help me to assign value to unsigned char[16] type from swift. Sample code and structure defnition already available in the thread.
Topic:
Programming Languages
SubTopic:
Swift
Tags: