This is what I am trying to do: struct shellyProperties : Codable { let device_id: String let name: String let app: String let model: String let stock_fw_model: String let host: String let version: String let fw_build: String let uptime: Int let failsafe_mode: Bool let auth_en: Bool } func GetShellyProp(ip : String)-> shellyProperties{ var shelly_dev = shellyProperties(device_id: , name: , app: , model: , stock_fw_model: , host: , version: , fw_build: , uptime: 0, failsafe_mode: false, auth_en: false) // Create URL let url = URL(string: http:// + ip + /rpc/Shelly.GetInfo) //let url = URL(string: http:// + 10.0.1.6 + /rpc/Shelly.GetInfo) guard let requestUrl = url else { fatalError() } // Create URL Request var request = URLRequest(url: requestUrl) // Specify HTTP Method to use request.httpMethod = GET // Send HTTP Request let task = URLSession.shared.dataTask(with: request) { (data, response, error) in // Check if Error took place if l