In a tableview:

        let itemToDelete = people[indexPath.row]

    print(itemToDelete)

    if (editingStyle == UITableViewCellEditingStyle.delete) {
        // handle delete (by removing the data from your array and updating the tableview)

        persistenceService.context.delete(itemToDelete)
        self.people.remove(at: indexPath.row)

        do {
            try persistenceService.context.save()
        } catch let error as NSError {
            print("Error While Deleting: \(error.userInfo)")
        }


    }

In an alert view:

 let action = UIAlertAction(title: "Save", style: .default) { (_) in
            let name = alert.textFields!.first!.text!
            let age = alert.textFields!.last!.text!

//            fill container
            let person = Person(context: persistenceService.context)
            person.name = name
            person.age = Int16(age)!

//            save container
            persistenceService.saveContext()
            self.people.append(person)

        self.tableView.reloadData()

    }

Auf dem Git Server:

mkdir repository.git
cd repository.git
git init --bare

In Xcode9:

Rechtsklick -> Add Existing Remote

Source Control -> Push

Pfad nach folgendem Muster: user@192.168.1.2:/home/git/repository.git

Works with a Dictionary like this:

["Key":["value1", "value2"]]

        let array = DICTIONARY.values.reduce([], +)
//Remove Empty Keys
            for (key, value) in DICTIONARY{
                if value == [] {
                    print("Key: ", key)
                    self.defaultDevicesSections.removeValue(forKey: key)
                }
            }

Sollte optimalerweise in der AppDelegate unter "didFinishLaunchingWithOptions" untergebracht werden:

let isFirstLaunch = UserDefaults.isFirstLaunch()
 if isFirstLaunch == true {
            print("firstStart")
        } else {
            print("notfirstStart")
        }

Snip um die Navigationsleiste komplett transparent zu machen:

let visualEffectView   = UIVisualEffectView(effect: UIBlurEffect(style: .light))
UINavigationBar.appearance().shadowImage = UIImage()
UINavigationBar.appearance().backgroundColor = UIColor(red: 0.0, green: 0.0, blue: 0.0, alpha: 0.0)
UINavigationBar.appearance().isTranslucent = true
UINavigationBar.appearance().addSubview(visualEffectView)
UINavigationBar.appearance().setBackgroundImage(UIImage(), for: .default)

Ich hatte ein paar Probleme mit Swift 3 eine URLSession mit aktivierter Authentifizierung zustande zu bekommen. Viele Anleitungen gelten noch für Swift 2, hier mal mein Code (Am beispiel einer Json Abfrage):

let url = URL(string: "http://blublbub.com/json")!
        print (url)

        let config = URLSessionConfiguration.default
        let username = "user"
        let password = "password"
        let loginData = String(format: "%@:%@", username, password).data(using: String.Encoding.utf8)!
        let base64LoginData = loginData.base64EncodedString()
        let authString = "Basic \(base64LoginData)"
        config.httpAdditionalHeaders = ["Authorization" : authString]

        let urlSession = URLSession(configuration: config)

        let task = urlSession.dataTask(with: url) { (data, response, error) in

            let jsonData =  try! JSONSerialization.jsonObject(with: data!, options: []) as? [String: AnyObject]


            }
        }

        task.resume()

Zusätzlich hier noch ein snip für HTTP Requests:

let devURL = URL(string: "http://url.com")

let username = "user"
let password = "password"
let loginData = String(format: "%@:%@", username, password).data(using: String.Encoding.utf8)!
let base64LoginData = loginData.base64EncodedString()

//HTTP Request:
let request = NSMutableURLRequest(url: devURL!)
request.httpMethod = "GET"
request.setValue("Basic \(base64LoginData)", forHTTPHeaderField: "Authorization")

let task = URLSession.shared.dataTask(with: request as URLRequest){
    data, response, error in
    if error != nil{
        print("error=\(String(describing: error))")
        return
    }

    let responseString = NSString(data: data!, encoding: String.Encoding.utf8.rawValue)
    print("responseString=\(String(describing: responseString))")

}

task.resume()