Skip to content

Instantly share code, notes, and snippets.


Olivier Halligon AliSoftware

View GitHub Profile
AliSoftware / Bindings.swift
Last active May 13, 2021
Re-implementation of @binding and @State (from SwiftUI) myself to better understand it
View Bindings.swift
This is a concept re-implementation of the @Binding and @State property wrappers from SwiftUI
The only purpose of this code is to implement those wrappers myself
just to understand how they work internally and why they are needed,
⚠️ This is not supposed to be a reference implementation nor cover all
subtleties of the real Binding and State types.
The only purpose of this playground is to show how re-implementing
them myself has helped me understand the whole thing better
AliSoftware / Demo.swift
Last active Apr 10, 2021
NestableCodingKey: Nice way to define nested coding keys for properties
View Demo.swift
struct Contact: Decodable, CustomStringConvertible {
var id: String
var firstname: String
var lastname: String
var address: String
enum CodingKeys: String, NestableCodingKey {
AliSoftware / struct_vs_inheritance.swift
Last active Apr 7, 2021
Swift, Struct & Inheritance: How to balance the will of using Struct & Value Types and the need for Inheritance?
View struct_vs_inheritance.swift
// #!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
AliSoftware / git-groom
Last active Mar 26, 2021
Sync git working copies' trunk and develop branches and prune local and remote deleted/orphan branches
View git-groom
#!/bin/bash -euo pipefail
# Author: O.Halligon
# Jan 2021
# Help
if [ "${1:-}" == "-h" -o "${1:-}" == "--help" ]; then
AliSoftware / pod_stats.rb
Last active Mar 12, 2021
Tools to investigate the state of our internal pods at a8c
View pod_stats.rb
#!/usr/bin/env ruby
require 'json'
require 'yaml'
require 'open-uri'
# [Array<String>] List of iOS/macOS apps
app_dirs = ['WordPress-iOS', 'woocommerce-ios', 'simplenote-ios', 'simplenote-macos', 'autoproxxy']
specs_cache = File.join(__dir__, 'pod_stats.cache')
View CustomCodable+PropertyWrapper.swift
import Foundation
protocol TransformerType {
associatedtype BaseType
associatedtype TypeForCoding: Codable
static var encodeTransform: (BaseType) throws -> TypeForCoding { get }
static var decodeTransform: (TypeForCoding) throws -> BaseType { get }
AliSoftware / morphing.swift
Created Aug 3, 2017
A simple demo of doing some morphing using CAShapeLayer & UIBezierPath
View morphing.swift
import UIKit
import PlaygroundSupport
// Create a view to display the result in playground
let view = UIView(frame: CGRect(x: 0, y: 0, width: 500, height: 500))
view.backgroundColor = .white
PlaygroundPage.current.liveView = view;
View Generics-Macros.h
// Allow to use generics even if not supported yet
#if __has_feature(objc_generics)
#define NSArrayOf(x) NSArray<x>
#define NSMutableArrayOf(x) NSMutableArray<x>
#define NSDictionaryOf(x,y) NSDictionary<x, y>
#define NSMutableDictionaryOf(x, y) NSMutableDictionary<x, y>
#define NSSetOf(x) NSSet<x>
#define NSMutableSetOf(x) NSMutableSet<x>
#define NSArrayOf(x) NSArray
AliSoftware / Coordinators-v2.swift
Last active Nov 25, 2020
Our implementation of the Coordinators pattern — V2, more strict than V1
View Coordinators-v2.swift
// Coordinator.swift
import Foundation
public protocol Coordinator: class {
var components: CoordinatorComponents { get }
/// Set up here everything that needs to happen just before the Coordinator is presented
/// - Parameter modalSetup: A parameter you can use to customize the default mainViewController's
AliSoftware / Coordinator.swift
Last active Nov 13, 2020
Coordinators & StateMachine - Concept
View Coordinator.swift
struct Coordinator {
let window: UIWindow
let navCtrl: UINavigationController?
func start() {
private func presentWelcomeScreen() {
let vc = WelcomeScreenViewController() // Instanciate from code, XIB, Storyboard, whatever your jam is