Convert NWPathMonitor into a string

127 Views Asked by At

This has me stumped, I am trying to get a the string of NWPathMonitor. If I print NWPathMonitor I get this:

"satisfied (Path is satisfied), interface: en0, ipv4, dns"

How can I get the same text in a string.

let interface = NWPathMonitor() // get the NWPathMonitor in a variable

let interfaceString = String(pathMonitor) // change that variable to a string

So the second line gives me "No exact matches in call to initializer."

It's seems that NWPathMonitor() has a lot of info and I am not clearly specifying what I want.

Any idea how can I get the same line that prints "satisfied (Path is satisfied), interface: en0, ipv4, dns" into a string variable?

0

There are 0 best solutions below