public void EnumerateCaretOffsets() { if (!TestRuntime.CheckXcodeVersion(7, 0)) { Assert.Ignore("Requires iOS9+ or macOS 10.11+"); } var sa = new CTStringAttributes(); sa.ForegroundColor = UIColor.Blue.CGColor; sa.Font = new CTFont("Georgia-BoldItalic", 24); sa.UnderlineStyle = CTUnderlineStyle.Double; // It does not seem to do anything sa.UnderlineColor = UIColor.Blue.CGColor; sa.UnderlineStyleModifiers = CTUnderlineStyleModifiers.PatternDashDotDot; var attributedString = new NSAttributedString("Hello world.\nWoohooo!\nThere", sa); var line = new CTLine(attributedString); bool executed = false; #if XAMCORE_2_0 line.EnumerateCaretOffsets((double o, nint charIndex, bool leadingEdge, ref bool stop) => { #else line.EnumerateCaretOffsets((double o, int charIndex, bool leadingEdge, ref bool stop) => { #endif executed = true; }); Assert.IsTrue(executed); }