vendredi 23 septembre 2016

How to convert string to UInt32?

I am a beginner in swift and I am having a problem with convering string to UInt32.

   let Generator = (ReadableJSON ["People"] [Person]["F1"].string! as NSString).doubleValue

    if Generator == 1 {

        NameLabel1 = ReadableJSON ["People"] [Person]["A1"].string as String!
        NameImeNaObekt = ReadableJSON ["People"] [Person] ["B1"].string as String!
        Picture = ReadableJSON ["People"] [Person] ["E1"].string as String!

    } else {

         let RGen = arc4random_uniform ("\(Generator)")

    }

Would you advise me how to fix it. The problem is in the last line, which is red and it says Cannot convert value of type String to UInt32. The main idea is that I am reading the number from a JSON file and I have to populate this number into the arc4random_uniform.




Aucun commentaire:

Enregistrer un commentaire