vendredi 27 juillet 2018

swift - cannot make my if statement work is well as i need

i have a problem when i typed my code as is bellow but i got error ?!

i want user if typed code = 4234 on textFields and tap on "ADD" = "https://pastebin.com/raw/4234"

else = any url "http://www.example.com/"

@IBAction func btnPlusPressed(_ sender: UIButton)
{

    let alert = UIAlertController(title: "Provider M3U URL", message: "Add Provided URL to add you M3U Plailist", preferredStyle: .alert)
    let loginAction = UIAlertAction(title: "ADD", style: .default, handler: { (action) -> Void in

        var url = alert.textFields![0]

        if (url.text == "535" as String ){
            let strURLl : String = "https://pastebin.com/raw/\(url.text!)"

        }else{
            let strURLl : String = "\(url.text!)"
        }


        UserDefaults .standard .set(strURLl, forKey: "URL")

        let channelsVC = self.storyboard!.instantiateViewController(withIdentifier: "ChannelsViewController") as! ChannelsViewController
        channelsVC.strURL = strURLl!
        self.navigationController?.pushViewController(channelsVC, animated: true)

    })

why error appear like this : (Use of unresolved identifier 'strURLl')

Aucun commentaire:

Enregistrer un commentaire