Skip to content

Commit 497e990

Browse files
committed
Handle UIGraphicsGetCurrentContext's return value becoming optional.
...in such a way that both older and newer SDKs are supported (at least for now). rdar://problem/21819293 Swift SVN r30193
1 parent 0ad5915 commit 497e990

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

stdlib/public/SDK/UIKit/UIKit.swift

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,11 @@ struct _UIViewMirror : _MirrorType {
198198
}
199199

200200
UIGraphicsBeginImageContextWithOptions(bounds.size, false, 0.0)
201-
202-
let ctx = UIGraphicsGetCurrentContext()
201+
202+
// UIKit is about to update this to be optional, so make it work
203+
// with both older and newer SDKs. (In this context it should always
204+
// be present.)
205+
let ctx: CGContext! = UIGraphicsGetCurrentContext()
203206
UIColor(white:1.0, alpha:0.0).set()
204207
CGContextFillRect(ctx, bounds)
205208
_v.layer.renderInContext(ctx)

0 commit comments

Comments
 (0)