Skip to content

Instantly share code, notes, and snippets.

@souzainf3
souzainf3 / Predicatable.swift
Created April 30, 2022 13:01 — forked from harrytwright/Predicatable.swift
Swift4 KeyPath Predicate
import Foundation
/// Predicatable is the protocol that all predicting objects conform.
public protocol Predicatable: CustomStringConvertible {
/// Returns a Boolean value indicating whether the specified object matches the conditions specified by the predicate.
///
/// - Parameter object: The object against which to evaluate the predicate.
/// - Returns: `true` if object matches the conditions specified by the predicate, otherwise `false`.
func evaluate(with object: Any?) -> Bool
@souzainf3
souzainf3 / file0.txt
Created July 23, 2020 22:41 — forked from tamanugi/file0.txt
[Xcode]「unable to boot device because it cannot be located on disk ios simulator」と出てplaygroudが動かなくなったときの対処法 ref: http://qiita.com/tamanugi/items/3358a56d34e38b50c877
sudo killall -9 com.apple.CoreSimulator.CoreSimulatorService
@souzainf3
souzainf3 / LocationVCard.swift
Created May 28, 2018 02:18 — forked from ElegyD/LocationVCard.swift
Create a location vCard for use in UIActivityViewController like in Apple's Maps app.
import CoreLocation
static func vCardURL(from coordinate: CLLocationCoordinate2D, with name: String?) -> URL {
let vCardFileURL = URL(fileURLWithPath: NSTemporaryDirectory()).appendingPathComponent("vCard.loc.vcf")
let vCardString = [
"BEGIN:VCARD",
"VERSION:4.0",
"FN:\(name ?? "Shared Location")",
"item1.URL;type=pref:http://maps.apple.com/?ll=\(coordinate.latitude),\(coordinate.longitude)",
@souzainf3
souzainf3 / CURLSwift.swift
Created May 15, 2018 20:45 — forked from digoreis/CURLSwift.swift
test extension for curl - Update to Swift 3
//
// CURLDebug.swift
//
// Created by apple on 02/06/16.
// Copyright © 2016 Rodrigo Reis. All rights reserved.
//
import Foundation