Skip to content

use throwing var methods for realm references to other objects #1035

Closed
@tomholub

Description

@tomholub

@tomholub ability to throw from var variable was added to the Swift recently:

var activeUser: UserRealmObject {
    get throws {
        guard let user = user else { throw AppErr... }
        return user
    }
  }

This looks good. Probably for another issue/PR?

The advantage is that an exception can be captured and handled (in the general error handling somewhere in VC, wherever user action was initiated) while a forced unwrap cannot.

Originally posted by @tomholub in #1030 (comment)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions