[swift-users] NSFontManager's availableMembers(ofFontFamily: String) broken?

Jens Persson jens at bitcycle.com
Sat Oct 8 01:37:41 CDT 2016


It crashes runtime except when the given string is not an existing font
family name, in which case it returns nil (as expected).

So I'm unable to use it.

Here's a REPL session demo of the issue, but it's the same in Xcode 8 and
8.1 beta 1 (haven't tried any other versions):

Welcome to Apple Swift version 3.0 (swiftlang-800.0.46.2 clang-800.0.38).
Type :help for assistance.
  1> import AppKit
  2> NSFontManager.shared().availableMembers(ofFontFamily: "Blahblah")
$R0: [[Any]]? = nil
  3> NSFontManager.shared().availableMembers(ofFontFamily: "Georgia")
Execution interrupted. Enter code to recover and continue.
Enter LLDB commands to investigate (type :help for assistance.)
  4> NSFontManager.shared().availableMembers(ofFontFamily: "Times")
Execution interrupted. Enter code to recover and continue.
Enter LLDB commands to investigate (type :help for assistance.)
  5> NSFontManager.shared().availableMembers(ofFontFamily: "Timeeess")
$R1: [[Any]]? = nil
  6>

Any ideas and/or workarounds?

/Jens
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20161008/937dc711/attachment.html>


More information about the swift-users mailing list