Skip to content

Instantly share code, notes, and snippets.

View MP0w's full-sized avatar
🏍️

Alex Manzella MP0w

🏍️
View GitHub Profile
@MP0w
MP0w / gist:0bdbe302806039594ecb4046be59e7ec
Created July 25, 2018 21:04
Render location trace as image
private extension MKMapRect {
func with(offset: UIOffset, size: CGSize) -> MKCoordinateRegion {
let horizontalRatio = self.size.width / Double(size.width)
let verticalRatio = self.size.height / Double(size.height)
let mapRect = MKMapRectInset(self, horizontalRatio * Double(offset.horizontal), verticalRatio * Double(offset.vertical))
var region = MKCoordinateRegionForMapRect(mapRect)
let minSpan = 0.001
region.span = MKCoordinateSpanMake(max(region.span.latitudeDelta, minSpan), max(region.span.longitudeDelta, minSpan))
return region
@MP0w
MP0w / MVVMÇ.md
Last active October 18, 2018 13:46
MVVMÇ

MVVMÇ (MVVM Calçot) is an implementation of MVVM influenced by VIPER. Basically VIPER with MVVM names.
The most important concept of MVVMÇ is that implements MVVM with immutable ViewModels, this helps to write correct and testable code with minor complexity.
Other than this it introduces Interactor and Coordinator to MVVM.

Content

import Foundation
import UIKit
protocol Interactor: class {
associatedtype ModelType
var model: ModelType { get }
var modelDidUpdate: (() -> Void)? { get set }
}