I have this array of tuplets containing strings and a url
var notifications:[(body: String, header: String, icon: URL)] = []
Now, I want to append a tuplet with an empty URL
I tried
notifications.append((body: "some text, header: "some more text", icon: nil))
but that is not allowed
What is the way to do this?
If you want to allow for icon
to be nil
, you need to make it optional.
var notifications:[(body: String, header: String, icon: URL?)] = []
But you really should make a struct
instead of using a tuple. A struct is more powerful, gives you more options, and just better to work with.