标签:special min 错误 文件 files ogr long 是你 等等
```
... earlier we said top-level code isn’t allowed in most of your app’s source files. The exception is a special file named “main.swift”, which behaves much like a playground file, but is built with your app’s source code. The “main.swift” file can contain top-level code, and the order-dependent rules apply as well. In effect, the first line of code to run in “main.swift” is implicitly defined as the main entrypoint for the program. This allows the minimal Swift program to be a single line — as long as that line is in “main.swift”.
```
原因就是你把print等等表达式放到其他文件去了。在main.swift这个文件中写就没问题
知道怎么改就可以了。如果不满足的话,可以看看上面这段官方代码,写得真好
swift错误 Expressions are not allowed at the top level
标签:special min 错误 文件 files ogr long 是你 等等
原文地址:http://www.cnblogs.com/wanglizhi/p/6228443.html