Skip to content

Instantly share code, notes, and snippets.

Resumo:

Instalar os pacotes abaixo:

  1. cocoapods (via gem)
  2. fastlane (via gem)
  3. xcodegen(via Make)
  4. Bundler (via gem)

Gerar projeto:

@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
extension DispatchQueue {
static var background: DispatchQueue { return DispatchQueue.global(qos: .background) }
// Execute on main queue without deadlock
static func performOnMainQueue(_ completion: @escaping () -> Void ) {
if Thread.isMainThread {
completion()
} else {
DispatchQueue.main.async(execute: {
@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
protocol UserABTestingProtocol {
var userToken: String? { get set }
var fullscreenFeature: ABFullscreenFeature { get }
// Os outros foram deletados só pra ilustrar melhor
}
class ABFullscreenFeature: ABFeatureTestInteractor {
enum Alternatives: String, CaseIterable {
@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
@souzainf3
souzainf3 / UIView+ScreenPoint.swift
Created October 11, 2017 17:51
Frame in global screen (window)
extension UIView {
var globalScreenPoint :CGPoint? {
return self.superview?.convert(self.frame.origin, to: nil)
}
var globalScreenFrame :CGRect? {
return self.superview?.convert(self.frame, to: nil)
}
}