Skip to content

Instantly share code, notes, and snippets.

View yoxisem544's full-sized avatar
🥑

David Lin yoxisem544

🥑
View GitHub Profile
// 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)
}
@yoxisem544
yoxisem544 / model.swift
Last active June 22, 2017 01:26 — forked from jenhausu/model.swift
MVC
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)