Getting selected Text Value from NSComboBox

214 Views Asked by At

I'm trying to get the selected string from comboBox.The string casting is not working

   let font = NSFont(name:String(combo_font.objectValueOfSelectedItem), size: 50)

How to properly get the string value?

1

There are 1 best solutions below

1
vadian On BEST ANSWER

NSComboBox is a subclass of NSTextField, it's simply

NSFont(name: combo_font.stringValue, size: 50)