Skip to content

Commit

Permalink
added throwing option to withContext(do:)
Browse files Browse the repository at this point in the history
with `rethrows`, so existing code shouldn't be affected
  • Loading branch information
juliand665 committed Feb 19, 2018
1 parent a972756 commit 4fc4d4d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Bitmap/Shared/Bitmap.swift
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ public class Bitmap {
- Parameter block: This is your chance to prove yourself! Do whatever you want with the context you're given, just make sure it doesn't outlive this call. God knows what happens if you do anything to it after this bitmap is deallocated.
- Parameter context: A context referencing the bitmap's underlying data. Anything you do to this context will be reflected in the bitmap automagically.
*/
public func withContext<Result>(do block: (_ context: CGContext) -> Result) -> Result {
return block(context)
public func withContext<Result>(do block: (_ context: CGContext) throws -> Result) rethrows -> Result {
return try block(context)
}

/// creates and returns a new copy of this bitmap
Expand Down

0 comments on commit 4fc4d4d

Please sign in to comment.