[Both] Adds support for installing apps over USB

This commit is contained in:
Riley Testut
2020-01-13 10:17:30 -08:00
parent e0a899ee9a
commit ae98105772
23 changed files with 1044 additions and 210 deletions

View File

@@ -44,17 +44,22 @@ enum ConnectionError: LocalizedError
struct Server: Equatable
{
var identifier: String
var service: NetService
var identifier: String? = nil
var service: NetService? = nil
var isPreferred = false
var isWiredConnection = false
}
extension Server
{
// Defined in extension so we can still use the automatically synthesized initializer.
init?(service: NetService, txtData: Data)
{
{
let txtDictionary = NetService.dictionary(fromTXTRecord: txtData)
guard let identifierData = txtDictionary["serverID"], let identifier = String(data: identifierData, encoding: .utf8) else { return nil }
self.identifier = identifier
self.service = service
self.identifier = identifier
}
}