Skip to content

Instantly share code, notes, and snippets.

View dimohamdy's full-sized avatar
🏠
Working from home

Dimo Hamdy dimohamdy

🏠
Working from home
View GitHub Profile
@dimohamdy
dimohamdy / CoordinatorExtended.swift
Created November 13, 2019 08:35 — forked from bocato/CoordinatorExtended.swift
An extended implementation of the Coordinator pattern.
import UIKit
/// An enum that defines an output to be passed on from
/// a child to it's parents over the responders Chain
public protocol CoordinatorOutput {}
/// An enum that defines an input to be passed on from
/// the parent to it's childs
public protocol CoordinatorInput {}
@dimohamdy
dimohamdy / MigrateDefaults.swift
Created August 7, 2020 00:35 — forked from dougdiego/MigrateDefaults.swift
Migrate NSUserDefaults to App Groups - Swift
func migrateUserDefaultsToAppGroups() {
// User Defaults - Old
let userDefaults = NSUserDefaults.standardUserDefaults()
// App Groups Default - New
let groupDefaults = NSUserDefaults(suiteName: "group.myGroup")
// Key to track if we migrated
let didMigrateToAppGroups = "DidMigrateToAppGroups"
@dimohamdy
dimohamdy / UITextViewPlaceholder.swift
Created March 29, 2021 14:53 — forked from tijme/UITextViewPlaceholder.swift
The correct way to implement a placeholder in a UITextView (Swift)
//
// UITextViewPlaceholder.swift
// TextViewPlaceholder
//
// Copyright (c) 2017 Tijme Gommers <tijme@finnwea.com>
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// I re-typed what I saw in reference 3 below,
// went to Liked videos page on YouTube[1] while logged in,
// pasted that into browser dev tools console (Google Chrome Version 97.0.4692.99 (Official Build) (x86_64)),
// pressed enter, and it seemed to do its thing, for the most part
// (when I refreshed the page, there was still 1 video remaining).
// [1] as of 2022-01-23 that’s at https://www.youtube.com/playlist?list=LL
// context: https://twitter.com/QiaochuYuan/status/1485164256970510340
// references: