I need a variable array that can hold 100 things so I have this code.....
import SwiftUI
var mythings = [String](repeating: "a", count: 100)
And I want to add things to my array when the program starts using this type of code.....
mythings.insert("abcde", at: 0)
But the code above doesn't work.
I've tried pasting this code everywhere in Xcode but I keep getting errors.
So I'd look up the errors and try to figure it out, but I still can't figure it out. And I even tried using this viewdidload function.....
var body: some View {
func viewdidload() {
mythings.insert("Item 1", at: 0)
}
And this created an error that I couldn't work out.
Overall nothing's worked!
So if someone could PLEASE help me that would be appreciated.
How do I add things to my array when the app is started?
Thank you.