cocoa touch - CMutablePointer<NSRange> dead end -
i'm trying call linefragmentrectforglyphatindex method of nslayoutmanager object in swift. description that:
func linefragmentrectforglyphatindex(glyphindex: int, effectiverange: cmutablepointer<nsrange>) but can't figure out how suppose call it. according apple docs have call this:
let somerange : nsrange = ... layoutmanager.linefragmentrectforglyphatindex(0, effectiverange: &somerange) that's documentation says. error: 'nsrange' not subtype of '@lvalue $t5'
what should do?
try making var instead of let:
var somerange: nsrange = ... layoutmanager.linefragmentrectforglyphatindex(0, effectiverange: &somerange) basically: using & on var gives compatible cmutablepointer, let not supposed mutable. hence type error.
if want pass null pointer, write nil instead of &somerange (and of course don't need declare var).
Comments
Post a Comment