mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-05-30 19:30:39 +02:00
SaveResult Polish #33
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @PaulWoodIII on GitHub (Jan 17, 2016).
Looking at the code the SaveResult seems a little off
Here why is the save result optional?
Your implementation always returns a result from what I can see.
Also you might be inspired by Alamofire's Result enum: isSuccess and isFailure can be helpful to some:
https://github.com/Alamofire/Alamofire/blob/990fded98afe5135dc418e1f6eb0287027dd067f/Source/Result.swift
@JohnEstropia commented on GitHub (Jan 18, 2016):
@PaulWoodIII The documentation for
beginSynchronous(...)explains why it's optional:So if you don't call
commit()inside the transaction block (i.e. if you abandon/cancel the transaction), you are guaranteed to get anilresult.As for Alamofire's isSuccess and isFailure,
SaveResultalready implementsBooleanType, so you are free to check the result as so:@PaulWoodIII commented on GitHub (Jan 18, 2016):
Okay I get it now the extra code there really helps as well