You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
cloudmusic/cloudmusic/Alert.swift

29 lines
1.0 KiB

//
// Alert.swift
// cloudmusic
//
// Created by Qihua Pan on 2020/7/3.
// Copyright © 2020 Qihua Pan. All rights reserved.
//
import UIKit
import CoreData
extension UIViewController{
func alert(message:String,title:String="警告信息",preferredStyle:UIAlertController.Style=UIAlertController.Style.alert,style:UIAlertAction.Style=UIAlertAction.Style.destructive){
let alertController = UIAlertController(title: title, message: message, preferredStyle: preferredStyle)
alertController.addAction(UIAlertAction(title: "确认", style:style, handler: nil))
self.present(alertController, animated: true, completion: nil)
}
//
func getContext()-> NSManagedObjectContext {
//
let appDelegate = UIApplication.shared.delegate as! AppDelegate
//
//let managedObjectContect = appDelegate.persistentContainer.viewContext
//
return appDelegate.persistentContainer.viewContext
}
}