Swift / parse: incremental rows

Quick part of the question:

So what I mean by incremental rows is what we start with var string = "title". I want to be able to increase numbers to the end, like "title1", "title2", "title3...". Should I use a for loop to do this? If so, how? Or another method?

for var i = 1; i < 6; i = i + 1 {
        //increment the strings here
    }

Part of the paragraph of the question:

I want mine to objectForKeyuse a lot of different names and numbers, which we will create above to objectForKeybe "title1", "title2", "title3".... I would make several columns in Parse with the names "title1, title2, title3 and the cells in the table view would correspond to this data. Thus, cell1 will use the data title1, cell2 will use the data header2, etc. Will it work as follows ?

var output1 = object.objectForKey(i) as! String
+4
2

Swift for i in 1...5, , :

for i in 1...5 {
    let title = "title\(i)"
    print(title)
}

Dan.

+3

Swift , , Swift 3,

:

for var i = 0; i <6; i++ {
    let string = "title\(i+1)"
}

: Swift Evolution

, GvS:

for i in 1...5 {
    let title = "title\(i)"
}

Swift :

   (1...5).forEach { i in
        let title = "title \(i)"
    }

(1...5).forEach { let title = "title \($0)" }
+1

Source: https://habr.com/ru/post/1622391/


All Articles