什么是这个Objective-c代码的Swift代码?

时间:2016-09-21 09:19:09

标签: swift

 - (void) registerHotspot: (NEHotspotNetwork*) network andCommand:(NEHotspotHelperCommand*) cmd
{
     if ([network.SSID isEqualToString:@"Chameleon Cafe"])
     {
         [network setConfidence:kNEHotspotHelperConfidenceHigh];
         [network setPassword:@"chamcafe"];
         NEHotspotHelperResponse *response = [cmd createResponse:kNEHotspotHelperResultSuccess];
         NSLog(@"Response CMD %@", response);

         [response setNetworkList:@[network]];
         [response setNetwork:network];
         [response deliver];
     }

    NEHotspotNetwork * myNetwork = [[NEHotspotNetwork alloc] init];

    }

1 个答案:

答案 0 :(得分:0)

func registerHotspot(network : NEHotspotNetwork, andCommand cmd : NEHotspotHelperCommand){
        if(network.SSID == "Chameleon Cafe"){
            network.setConfidence(.High)
            network.setPassword("chamcafe")
            let response : NEHotspotHelperResponse = cmd.createResponse(.Success)
            print("Response CMD \(response)")
            response.setNetworkList([network])
            response.setNetwork(network)
            response.deliver()
        }

        let myNetwork = NEHotspotNetwork()
    }