Skip to content

Instantly share code, notes, and snippets.

View ezefranca's full-sized avatar
💻
👨🏻‍💻

Ezequiel Santos ezefranca

💻
👨🏻‍💻
View GitHub Profile
@marmelroy
marmelroy / UIViewPropertyAnimator.swift
Last active November 9, 2022 02:28
A quick example of UIViewPropertyAnimator
// Create a UIViewPropertyAnimator object. Here's a simple one with a UIKit animation curve:
let colorChange = UIViewPropertyAnimator(duration: 0.3, curve: .easeIn, animations: { [weak self] in
self?.view.backgroundColor = UIColor(red: 255.0/255.0, green: 80.0/255.0, blue: 43.0/255.0, alpha: 1.0)
})
// There's also support for easy spring-based animations - all you need to set is a damping ratio (a value between 0 and 1). Alternatively, you can create your own curves by adopting the UITimingCurveProvider protocol.
let alphaChange = UIViewPropertyAnimator(duration: 0.3, dampingRatio: 0.6, animations: { [weak self] in
self?.circleView.alpha = 0.0
})
@vasarhelyia
vasarhelyia / rx_modelSelected.swift
Last active October 10, 2016 16:43
Table view selection binding in RxSwift
tableView
.rx_modelSelected(PasteboardItem)
.subscribeNext { [weak self] element in
self?.pasteViewModel.addItemsToPasteboard(element)
}.addDisposableTo(disposeBag)
@ezefranca
ezefranca / SPTransOlhoVivo.swift
Last active February 17, 2017 10:06
Acesso a API Olho Vivo da SPTrans em Swift (iOS)
+(NSString *)returnURL: (requestMethodGET)methodGET line:(id)line{
NSString *SPTrans = @"http://api.olhovivo.sptrans.com.br/v0";
switch (methodGET) {
case requestMethodGETLinhas: return [NSString stringWithFormat:@"%@/Linha/Buscar?termosBusca=%@", SPTrans, line]; break;
case requestMethodGETDetalhes: return [NSString stringWithFormat:@"%@/Linha/CarregarDetalhes?codigoLinha=%@", SPTrans, line] ;break;
case requestMethodGETParadas: return [NSString stringWithFormat:@"%@/Parada/Buscar?termosBusca=%@", SPTrans, line] ;break;
case requestMethodGETParadasPorLinha: return [NSString stringWithFormat:@"%@/Parada/BuscarParadasPorLinha?codigoLinha=%@", SPTrans, line] ;break;
case requestMethodGETParadasPorCorredor: return [NSString stringWithFormat:@"%@/Parada/BuscarParadasPorCorredor?codigoCorredor=%@", SPTrans, line] ;break;
case requestMethodGETCorredores: return [NSString stringWithFormat:@"%@/Corred
@marchinram
marchinram / UIImage+PixelColor.swift
Last active January 19, 2022 08:53
iOS Swift UIImage subscript extension to get pixel color
import UIKit
extension UIImage {
subscript (x: Int, y: Int) -> UIColor? {
guard x >= 0 && x < Int(size.width) && y >= 0 && y < Int(size.height),
let cgImage = cgImage,
let provider = cgImage.dataProvider,
let providerData = provider.data,
let data = CFDataGetBytePtr(providerData) else {
return nil
@stonehippo
stonehippo / FTDI_Basic_Hookup_for_ESP-01.jpg
Last active January 6, 2022 14:09
Notes on using the ESP8266 with the Arduino IDE
FTDI_Basic_Hookup_for_ESP-01.jpg
@mattrubin
mattrubin / WeakClassProtocol.swift
Last active August 12, 2017 21:13
Swift weak var of protocol type (No @objc required)
import UIKit
// A swift protocol can apply to a class, struct, or enum,
// but only a reference type can be stored in a `weak` var,
// so a weak var cannot be of a typical protocol type.
protocol MyProcotol {
}
@daniellevass
daniellevass / sharing_data_ios.md
Last active September 21, 2022 23:06
Sharing Data between iPhone and Apple Watch apps

#Sharing Data between iPhone and Apple Watch apps

So we've already taken a look at some of the issues we've faced building our Whiskr Apple Watch app, next we're going to look into how we shared data between the iPhone and Apple Watch app. This was probably one of the hardest aspects to learn and get right, and the current documentation isn't all that great!

To do this we'll have to create an App Group which is essentially a space which both apps can use. It was brought in with the exetension framework in iOS8 so apps can communicate with their Today widgets, or custom keyboards, and amongst other applications.

Add Capabilities

The first thing we have to do is add the app group capability to both our iPhone and Watch Watch Extension targets.

@AliSoftware
AliSoftware / struct_vs_inheritance.swift
Last active March 5, 2025 06:57
Swift, Struct & Inheritance: How to balance the will of using Struct & Value Types and the need for Inheritance?
// #!Swift-1.1
import Foundation
// MARK: - (1) classes
// Solution 1:
// - Use classes instead of struct
// Issue: Violate the concept of moving model to the value layer
// http://realm.io/news/andy-matuschak-controlling-complexity/
@JaviLorbada
JaviLorbada / FRP iOS Learning resources.md
Last active October 30, 2025 15:45
The best FRP iOS resources.

Videos

@dethbiscuit
dethbiscuit / Swift and Soap Web Service
Created January 21, 2015 12:58
Swift and Soap Web Service
//
// Call a soap web service
//
// Add
// NSURLConnectionDelegate
// NSXMLParserDelegate
class MapViewController: UIViewController, MKMapViewDelegate, CLLocationManagerDelegate, NSURLConnectionDelegate, NSXMLParserDelegate{
@IBOutlet weak var mapKit: MKMapView!
var wsUrl : String = "http://mobilewebservice.greenmotion.ch/MobileEvpass.asmx"