User Input Challenge: How in Swift?


#1

In try to follow this tutorial/challenge in Swift, I’ve created ab Objective C Bridging Header to bring the Objective C library “libreadline.dylib” into Swift so that Swift will recognize the “readline” function. It appears to work correctly because when I type “readline()” it turns green as if it is now recognized by my swift project where as before the bridging header was configured, “readline” did not turn green. However, when I try to pass NULL to “readline” I get a compile error.

println("Who is cool?") let name: String = readline(NULL) //ERROR: use of unresolved identifier NULL

I feel like this has something to do with needing to use an optional instead of “NULL” in the “readline” function. Any ideas?