I expected the initializer NLLanguage(rawValue: "...")
to return nil
if I gave it junk, but it doesn't. It accepts any string. I'm loading values from a database so I'd like to know if I'm getting one that is valid, like "en"
, "es"
, etc., as opposed to an error. Is there anyway to check that?
I'm using it to set NLLanguageRecognizer.languageConstraints
, so I guess by "valid" I mean all the languages that work with that property.
The struct has a bunch of static constants:
struct NLLanguage {
static let english = ...
static let spanish = ...
...
}
If those all work with NLLanguageRecognizer
I guess I can paste them all into a dictionary.