Skip to content

Instantly share code, notes, and snippets.

Ahmed Hamdy dimohamdy

Block or report user

Report or block dimohamdy

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
bocato / CoordinatorExtended.swift
Last active May 19, 2020
An extended implementation of the Coordinator pattern.
View CoordinatorExtended.swift
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 children
public protocol CoordinatorInput {}
bocato / CacheService.swift
Last active Nov 13, 2019
Simple Cache Service implementation
View CacheService.swift
import Foundation
/// Defines the CacheService errors
/// - encryptionFailed: the key encription has failed
/// - couldNotSaveData: the data could not be saved
/// - couldNotLoadData: the data could not be loaded
/// - raw: some system error, not previously defined
public enum CacheServiceError: Error {
case encryptionFailed
View HTTPBasicAuthenticationSessionTaskDelegate.swift
Everyone on Stack Overflow does HTTP Basic Authentication on iOS by manually
building the HTTP headers.
This amounts to re-implementing HTTP.
Why? The Cocoa Touch URL Loading System aleady knows HTTP, and you can
configure your URLSession to supply HTTP Basic Authentication credentials
like so.
ollieatkinson / HTTPStatusCode.swift
Last active May 18, 2020
HTTP status codes as a Swift enum.
View HTTPStatusCode.swift
/// This is a list of Hypertext Transfer Protocol (HTTP) response status codes.
/// It includes codes from IETF internet standards, other IETF RFCs, other specifications, and some additional commonly used codes.
/// The first digit of the status code specifies one of five classes of response; an HTTP client must recognise these five classes at a minimum.
enum HTTPStatusCode: Int, Error {
/// The response class representation of status codes, these get grouped by their first digit.
enum ResponseType {
/// - informational: This class of status code indicates a provisional response, consisting only of the Status-Line and optional headers, and is terminated by an empty line.
case informational
Bhavdip /
Created Oct 6, 2016
Modify Sketch to never ending trial

###Sketch trial non stop

Open hosts files:

$ open /private/etc/hosts

Edit the file adding:
swifted / QuadPageControl.swift
Last active Apr 23, 2020
UIPageControl with square dots having custom size (hack).
View QuadPageControl.swift
import UIKit
class QuadPageControl: UIPageControl {
override func layoutSubviews() {
guard !subviews.isEmpty else { return }
let spacing: CGFloat = 3
arnoappenzeller / appbuilders_2016_slides
Last active May 11, 2016
Link to all slides from App Builders 2016 (On going)
View appbuilders_2016_slides ("SourceKit and you" by @jpsim) ("Non-technical ways to be a better developer" by @icanzlib) ("Refactoring Wunderlist for Android" by @CesarValiente) ("Being a developer after 40" Medium Post: by @akosma) ("Error Handling" by @nst021) ("Upgrading approaches to the secure mobile architecture" by @vixental) ("Dynamic, native, backend-driven UIs" by @johnsundell)
sohayb / ArrayDeepCopy.swift
Last active May 22, 2020
Array deep copy in Swift
View ArrayDeepCopy.swift
//Protocal that copyable class should conform
protocol Copying {
init(original: Self)
//Concrete class extension
extension Copying {
func copy() -> Self {
return Self.init(original: self)
thebrankoo / TBAsyncOperation.swift
Last active Jun 14, 2016
Simple custom NSOperation subclass that handles piece of work with completion block
View TBAsyncOperation.swift
import UIKit
typealias TBAsyncBlock = (completionHandler: dispatch_block_t ) -> Void
class TBAsyncOperation: NSOperation {
private var block : TBAsyncBlock!
private var _executing : Bool = false
override var executing : Bool {
ericdke / splitBy.swift
Last active May 10, 2020
Swift: split array by chunks of given size
View splitBy.swift
let arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
extension Array {
func splitBy(subSize: Int) -> [[Element]] {
return 0.stride(to: self.count, by: subSize).map { startIndex in
let endIndex = startIndex.advancedBy(subSize, limit: self.count)
return Array(self[startIndex ..< endIndex])
You can’t perform that action at this time.