Sobes.tech
Junior — Middle

Kas saaksite anda näite Swift standardraamatukogu struktuuri kasutamisest?

sobes.tech AI

Vastus AI-lt

In Swift, one of the frequently used structures of the standard library is Array — an ordered collection of elements of the same type.

Example of usage:

var numbers: [Int] = [1, 2, 3, 4, 5]
numbers.append(6) // Adding an element
print(numbers) // Will output: [1, 2, 3, 4, 5, 6]

Additionally, the Dictionary structure is used for storing key-value pairs, and Set for unique elements without a specific order.