本から入手したObjective-CコードをSwiftに翻訳しています。問題のコードは、NSTextContainer
メソッドのカスタム実装です。
-(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;
}
これを Swift で複製するのに苦労しています。何を試しても、let
変数に代入できないと言われ続けています。