Why can't I use the new inline #imageLiteral syntax in Xcode 8? “Expected expression in return result”

前端 未结 2 2038
暖寄归人
暖寄归人 2021-01-18 06:43

I\'m trying to use the new #imageLiteral inline image assignment from your assets folder in Xcode 8, where instead of the whole UIImage(named: \"\")

相关标签:
2条回答
  • 2021-01-18 06:56

    You should check Swift Version.

    Build Settings > Use Legacy Swift Language Version = NO
    

    Image Literal is only supported on Swift3.0, not Swift2.3.

    0 讨论(0)
  • 2021-01-18 07:15

    For all having the same problem with Xcode 10 / Swift 4.2 -> Unfortunately, this feature (imageLiterals, auto completion ) was deprecated in its previous form.

    But there is new way to use imageLiterals -> https://stackoverflow.com/a/52523111/3143890

    0 讨论(0)
提交回复
热议问题