Skip to content

Instantly share code, notes, and snippets.

@vade
Created January 10, 2019 17:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vade/37f6f0f27c3b8736cda52bcf87bf03d6 to your computer and use it in GitHub Desktop.
Save vade/37f6f0f27c3b8736cda52bcf87bf03d6 to your computer and use it in GitHub Desktop.
var selectionRule: (TrashEditSelectionRule & TrashEditSelectionRuleProtocol)? = nil
if let selectionRuleString = editFormula?.editSelectionRuleClass
{
if let selectionRuleClass = NSClassFromString(selectionRuleString) {
// Commenting out this line allows compilation to succeed:
selectionRule = selectionRuleClass.init() as? (TrashEditSelectionRule & TrashEditSelectionRuleProtocol)
}
}
else {
selectionRule = TrashEditSelectionRuleLeastSimilar()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment