Today I Learned

hashrocket A Hashrocket project

Add element to beginning of array

You can add an element to the beginning of an array by insert at an index.

var pastSearches: [String] = []
pastSearches.insert("hi")
print(pastSearches)
=> ["hi"]
pastSearches.insert("bye", at: 0)
=> ["bye", "hi"]
See More #swift TILs