0

I am trying to initialize an unsafe pointer

func f1()
{
    var ifaddr : UnsafeMutablePointer<ifaddrs>?
    // ....
    // .... collect ifaddr value

    var d1 = UnsafePointer<sockaddr_dl>(ifaddr) 
}

and received the below error in the last line of code:

init is unavailable: use withMemoryRebound(to:capacity:_) to temporarily view memory as another layout-compatible type.

the posted answers to a similar problem are unclear to me, can anybody help with fixing this sample code?

shallowThought
  • 19,212
  • 9
  • 65
  • 112

0 Answers0