-
Notifications
You must be signed in to change notification settings - Fork 13
Open
Description
After #18 is merged, we should work on SDK safety.
Code is still full of force unwraps (someVar!.something()
) and force try (try! something
) which is dangerous as it could lead to crashes.
We should remove all of them, apps should not crash because of our SDK.
Fixing strategy should be:
- if a method is already throwing, simply use
try
instead oftry!
. If error is not blocking, usetry?
and provide a fallback value - if a method is not marked as throwing, use
try?
and provide fallback value with nil coalescing operator (let value = (try? something()) ?? defaultValue
) - in
testSomething
methods (Unit tests with XCTest, in Tests folder), simply addthrows
to method declaration
It's not easy to spot them all, but using Xcode looking glass and searching for try!
can be a good start.
Metadata
Metadata
Assignees
Labels
No labels