iOS Error Handling in Swift Error Handling Handling Errors

Enes Kılıç
Enes Kılıç
7,758 Points

Ios compiler error on treehouse

i am getting this error on treehouse compiler and not on my computer

Executable requires at least macOS 10.12, but is being run on macOS 10.11.6, and so is exiting.xcrun: error: unable to locate xcodebuild, please make sure the path to the Xcode folder is set correctly! xcrun: error: You can set the path to the Xcode folder using /usr/bin/xcode-select -switch sh: line 1: xcrun:: command not found

enum ParserError: Error {
    case emptyDictionary
    case invalidKey

struct Parser {
    var data: [String : String?]?

    func parse() throws {
        guard data != nil else {
            throw ParserError.emptyDictionary

        guard data?.keys.contains("someKey") == true else {
            throw ParserError.invalidKey

let data: [String : String?]? = ["someKey": nil]
let parser = Parser(data: data)

do {
    try parser.parse()
} catch ParserError.emptyDictionary {
    print("The dictionary is empty.")
} catch ParserError.invalidKey {
    print("The key 'someKey' does not exist.")