I found this sample code to get all local IP addresses, but I don\'t find an easy solution to get the public IP.
A legacy class from Apple allowed to do that ... bu
In case you want to retrieve IP asynchronously, there is a way to do that using ipify.org and Alamofire in 1 line of code:
Alamofire.request("https://api.ipify.org").responseString { (response) in print(response.result.value ?? "Unable to get IP") }