1
我将从书中获得的一些Objective-C代码翻译成Swift。有问题的代码是一个NSTextContainer
方法的自定义实现:在Swift中填充NSRectPointer
-(NSRect)lineFragmentRectForProposedRect:(NSRect)proposedRect
sweepDirection:(NSLineSweepDirection)sweepDirection
movementDirection:(NSLineMovementDirection)movementDirection
remainingRect:(NSRectPointer)remainingRect
{
// ... now set value of the struct pointed at by NSRectPointer
*remainingRect = NSRectMake(0, 0, 100, 50);
//...
return mainRect;
}
我挣扎在斯威夫特复制这一点 - 不管我怎么努力我一直斥骂,我不能分配给一个let
变量。
我无法传入任何东西 - 该方法由* Cocoa *调用,因此参数也由* Cocoa *提供。 –
啊,我现在看到了。 – sbarow