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"]
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"]