In the course, I used String.isEmpty to check whether the string is empty or not. But that does not work with blank characters. You can use the following extension instead.
extension String { var isEmptyOrWhitespace: Bool { return trimmingCharacters(in: .whitespacesAndNewlines).isEmpty } }