Is there anything special with a main.swift
file?
I have created a command line based project in XCode. If I put an expression println("Hello, World!");
in a new swift file says test.swift, I will get the error message: Expressions are not allowed at the top level
However this expression is placed at top level in the main.swift that is created by XCode in the new project. No such exception is flagged by XCode.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…