The question is really if having both is just overkill for some use cases.
You have presented your preferred layout. Everyone has their own preferences, of course.
I find it virtually unreadable though. I can't see where variables are declared, or what is declared, without parsing the whole chunk of code in my head. You can't skim that code to find something.
Ultimately, the most important piece of information is the variable name which is being declared. Consider that the "title" of the statement. I can go from that to details like constancy, errors etc. For me, having those "titles" clearly and consistently visible is important. Swift is the only language I have ever used that does not offer this option.
Pretty clear I am the only one though, so will call it a day on this one.
Update: Thought I would relayout your preferred style too, to show that even there, things become much more readable...
let store = sharedNotesStore else {
throw Error.noSharedNotesStoreAvailable
}
let blobs: [SharedNote.Blob] = [.init("ABC")]
let data = section.propertyDictionary.json else {
throw Error.serializationFailure
}
let key = UUID().uuidString
let section = section(withIdentifier: noteIdentifier, data: data) else {
throw Error.noSectionFoundForNote
}
let sharedNote = SharedNote(
store: store,
section: section,
key: key,
blobs: blobs
)
Even with plenty of space, and a vertical orientation, removing the guards makes this code 10x easier to parse quickly. What is "section" again? Boom! You are right there. And I can immediately see it can potentially fail to be fetched, and throw.
Giving the "guard" keyword so much prominence is in my view a complete mistake. The correct thing to focus on is what is unique. It's the variable name. The thing you will be looking for 90% of the time.