How make an instance of a struct and add properties all in one line

I made a Cookie struct. On the struct I have a function, makeNewCookie(nameOfCookie:hasNuts:) so I can create instances of Cookies. Then I declare and initialize a Cookie variable, sugarCookie. I then call the makeNewCookie(nameOfCookie:hasNuts:) on sugarCookie to add properties to sugarCookie.

Is there a way to make it so I can declare sugarCookie and add it’s properties all on one line? Creating a cookie variable and then calling makeNewCookie(nameOfCookie:hasNuts:) on the next line seems redundant. If I’m going to be making a lot of cookies, I’d want a way to do it all on one line.

import Cocoa

struct Cookie {
    var name = "Default Cookie"
    var containsNuts = false

    mutating func makeNewCookie(nameOfCookie: String, hasNuts: Bool){ = nameOfCookie
        self.containsNuts = false

var sugarCookie = Cookie()
sugarCookie.makeNewCookie(nameOfCookie: "Sugar Cookie", hasNuts: false)


You can already do that, with the (default) memberwise initializer for a structure:

var sugarCookie = Cookie (name: "Sugar Cookie", containsNuts: false)

Read the [initialization] ( section in The Swift Programming Language.

Thanks! Knew there was something like that