ios - Use of unresolved identifier false warning Swift 3 xcode -
so edited post more clear. new in xcode , swift 3 , facing strange problem. project contains several swift files. put simple common methods utils.swift, instance simple string functions, etc. many days had no problems after point xcode time complaining red exclamation marks in files use method if calling methods utils.swift file: "use of unresolved identifier 'xxx'".
// debug bool variable declared before utils.swift:
func log(_ message: string) { if debug { print(message) } } viewcontroller.swift:
log("error happened") this gives error "use of unresolved identifier 'log' ". function there don't understand why red warning exclamation mark during coding when click on build, successful, , runs , warning gone. start typing again in code area, red error comes back. if build once more successful again. doesn't make sense me.
i thought maybe cache problem, xcode live issues function doesn't recognise utils.swift or this... cleaned build folder (cmd + shift + option + k), cleaned project (product > clean), restarted xcode, restarted mac, removed utils.swift, re-added utils.swift project can not rid of these false warnings during coding if build project ok. don't have problem in other projects. idea?
okay found answer myself. clicking on swift file (now utils.swift) had select "location relative group" in file inspector , set appropriate target memberships well.
it weird despite previous 'wrong' settings build completes success gives error in code area.
Comments
Post a Comment