[swift-evolution] [Pitch] #warning

Brent Royal-Gordon brent at architechies.com
Tue May 31 23:46:24 CDT 2016

> Swift doesn’t have this problem, so it treats warnings as “things that should be addressed before you commit your patch, but shouldn’t block a build if (e.g.) you’re in the middle of a big refactoring”.  For example, an unused variables is a warning in Swift.

That sounds an awful lot like the way Xcode's templates use warnings:

	func tableView(_ tableView: UITableView, numerOfRowsInSection section: Int) -> Int {
		#warning "Implement something useful here."
		return 0

(Incidentally, I prefer `#warning` to `#warning(_:)` here, because I think of the parentheses forms as expressions.)

Brent Royal-Gordon

More information about the swift-evolution mailing list