我有以下无法编译的swift代码:classCustomView:NSView{overridefuncdrawRect(dirtyRect:NSRect){varcontextPointer:COpaquePointer=NSGraphicsContext.currentContext()!.graphicsPort()varcontext:CGContext?=contextPointeras?CGContextCGContextSetRGBFillColor(context,1,0,0,1)CGContextFillRect(context,CGRectMake(0,0,100,
我有以下无法编译的swift代码:classCustomView:NSView{overridefuncdrawRect(dirtyRect:NSRect){varcontextPointer:COpaquePointer=NSGraphicsContext.currentContext()!.graphicsPort()varcontext:CGContext?=contextPointeras?CGContextCGContextSetRGBFillColor(context,1,0,0,1)CGContextFillRect(context,CGRectMake(0,0,100,
在Swift中我如何转换CFStringRef[]和CFTypeRef[]至CMutablePointer?我想调用CFDictionaryCreate来自swift。我已经定义:varkeys:CFStringRef[]=[kCGImageSourceCreateThumbnailWithTransform,kCGImageSourceCreateThumbnailFromImageIfAbsent,kCGImageSourceThumbnailMaxPixelSize,kCGImageSourceCreateThumbnailFromImageAlways]varvalues:CF