Skip to content

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

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)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions