This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Created by Marcin Krzyzanowski | |
import Foundation | |
public protocol JSONEncodable: Encodable { } | |
public extension JSONEncodable { | |
func toJSON(using encoder: @autoclosure () -> JSONEncoder = JSONEncoder()) throws -> String { | |
try String(decoding: encoder().encode(self), as: UTF8.self) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class func loadMessage(complete: (_ objects: Any, error: Error?) -> Void) { | |
let managerQuery = UserModel.query()! | |
let userRole = PFRole(withoutDataWithObjectId: "lEGrVrXO0a") // 角色:球場管理 | |
managerQuery.whereKey("userRole", equalTo: userRole) | |
let caddy = UserModel.current()! | |
let courseID = caddy.course! | |
managerQuery.whereKey("course", equalTo: courseID) | |