简体   繁体   中英

Xcode 6 Bug for Swift Functions?

I'm a newbie in iOS development. Here is a weird error I receive when I try to use functions written in Swift Can you suggest what I should try to do? This might be a bug in Xcode 6.

在此处输入图片说明

No, it's a bug in your code. You can't invoke functions inside a class declaration.

I think you're confusing class code with playgrounds code. In a class, you can only invoke methods from within other methods, try moving heyy() and the println line inside the viewDidLoad method and all should be fine

A class is more like a schematic document rather then a program code flow. Then, you cannot put a command statements (such as calling function) in a class scope. (between {} )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM