import Foundation
class API
{
static let shared = API()
func selectCategory(userInfo : [String:Any]) {
NotificationCenter.default.post(name: .didSelectCategory, object: self, userInfo: userInfo)
}
}
import Foundation
extension Notification.Name {
static let didSelectCategory = Notification.Name("didSelectCategory")
}
NotificationCenter.default.addObserver(self, selector: #selector(didSelectCategory(_:)), name: .didSelectCategory, object: API.shared)
@objc func didSelectCategory(_ notification : Notification) {
let data = notification.userInfo as! [String : Any]
lblCategoryName.text = data["catName"] as! String
catID = data["catID"] as! Int
print(catID)
}
let data : [String : Any] = [
"catName" : section.selectedRow()?.value ?? "Nothing is selected",
"catID" : 1
]
API.shared.selectDays(userInfo: data)
Leave a Reply