MΓ³dulo 02 Β· Swift, One Level Deeper β LecciΓ³n 4 de 5 Β· ~17 min
Arrays & Closures
Many values, one name
A walker covers several neighborhoods, an owner has several bookings, the backend returns a list of walkers. An array is an ordered list of values that all share one type. The type is written in square brackets β [String] is "array of String" β and so is a literal: ["Mission", "Castro"]. That's exactly what Walker.neighborhoods is.
Arrays come with built-in properties: .count (how many), .isEmpty (is it zero?), and .first (the first element β as an optional, because the array might be empty).