Post

Replies

Boosts

Views

Activity

Reply to beginner in the code, I block on the line "let fighter = Fighter () ' Xcode displays "Missing argument for parameter 'name' in call"
You could also define an init: class Player { var name: String = "No Name" var characters: [Character] = [] init(name: String){ self.name = name } init() { } } Then let player = Player() print("Player's name", player.name) gives Player's name No Name Or define name in init() class Player { var name: String var characters: [Character] = [] init(name: String) { self.name = name } init() { self.name = "No Name" } } same result.
Topic: Programming Languages SubTopic: Swift Tags:
Mar ’21
Reply to Is there a way in Xcode to jump directly to edits that you made in a file, instead of having to scroll through to find them?
a way in Xcode to jump directly to edits that you made in a file What time frame ? Do you mean after closing the file and reopening ? do you mean the last changes you made in an edit session. There is the solution proposed above if you manage your versions in git. There are other simple ways (not so powerful): mark the changes in a comment as // 5.3.2021 Then searching through them is very easy. In an editing session, repeat undo to jump to the last changes until you find the one you want. But then you'll have to redo. So only useable to roll back a few changes.
Mar ’21