mercredi 31 mai 2017

How to get a random category in a switch with the correct siteID - Swift3

Whats here the problem? I have some siteIDs (from 6 to 12). I filter which siteID is used and i want to get a random category. Is a random category in the right siteID found, they should be returned to work with it. Thanks for your help!

    let sideIDS = helper.selectedSideID()
    let category: String
    return (arc4random_uniform(category))//category: String
    switch sideIDS {
    case 6, 8:
        let category = ["Waschmaschinen", "Kühlschrank", "Geschirrspüler", "Wäschetrockner", "Fernseher", "Staubsauger", "Lampen", "Reifen"]
        //return (category[Int(arc4random_uniform(UInt32(category.count)))])
    case 7, 11:
        let category = ["Washing machine", "Fridge", "Dishwasher", "Dryer", "TVs", "Vacuum Cleaners", "Lamps", "Tyres"]
        //return (category[Int(arc4random_uniform(UInt32(category.count)))])
    case 9:
        let category = ["Lavadoras", "Refrigerador", "Lavavajillas", "Secadoras", "Televisores", "Aspiradoras", "Lamparas", "Neumatico"]
        //return (category[Int(arc4random_uniform(UInt32(category.count)))])
    case 10:
        let category = ["Lave-Linge", "Frigo", "Lave-Vaisselle", "Seche-Linge", "TV", "Aspirateur", "Lampes", "Pneu"]
        //return (category[Int(arc4random_uniform(UInt32(category.count)))])
    case 12:
        let category = ["Lavatrici", "Frigo", "Lavastoviglie", "Asciugatrice", "Televisore", "Aspirapolvere", "Lampade Design", "Pneumatico"]
        //return (category[Int(arc4random_uniform(UInt32(category.count)))])
    default:
        XCTFail("No sideID found")
    }




Aucun commentaire:

Enregistrer un commentaire