Skip to content

Request: Make backingStore optional rather than force unwrapped #444

Open
@alessdiimperio

Description

@alessdiimperio

New Feature / Enhancement Checklist

Current Limitation

when launching tests one doesn't necessarily want the entire app and all it's dependencies setup and initialized. So if we are running tests we generally skip certain setup functions.

However after migrating to ParseSwift from the ObjC SDK i realized that we were getting crashes only when testing.
The reason for the crash was calling Installation.current which returns an optional Installation. However the backingStore is force unwrapped so even though the value is optional the underlying force unwrapped store crashes.
Note the cause is that we don't initialize parse when running tests.

if the backingStore was optional instead of force unwrapped it wouldn't crash but instead just return nil.

Feature / Enhancement Description

change ! to ? and allow for the backingStore to be optional rather than force unwrapping it.
at worst you'll have to add a few ? here and there but will allow for returning an optional value where an optional value is to be returned.

Example Use Case

running tests without having to initialize all dependencies

Alternatives / Workarounds

🤷

3rd Party References

force unwrapping is 👿 no bueno :P

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions