You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 of try!. If error is not blocking, use try? 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 add throws 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.
The text was updated successfully, but these errors were encountered:
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:
try
instead oftry!
. If error is not blocking, usetry?
and provide a fallback valuetry?
and provide fallback value with nil coalescing operator (let value = (try? something()) ?? defaultValue
)testSomething
methods (Unit tests with XCTest, in Tests folder), simply addthrows
to method declarationIt's not easy to spot them all, but using Xcode looking glass and searching for
try!
can be a good start.The text was updated successfully, but these errors were encountered: