Updated for Swift