swift - Initialzer for conditional binding must have Optional type not 'String' -


compiler throwing error "initialzer conditional binding must have optional type not 'string'"

if let classstring = string.fromcstring(class_getname(currentveiw?.dynamictype)){ } 

the compiler telling you can't use if let because it's totally unnecessary. don't have optionals unwrap.if let used exclusively unwrap optionals. use:

let classstring = string(describing: type(of: currentveiw!)) 

Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -