Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:
coding

man CocoaDebug

:octocat:
coding
View GitHub Profile
@CocoaDebug
CocoaDebug / gist:40ff4aac920b3febed2ce9d2868e68c6
Created Mar 24, 2018 — forked from arshad/gist:de147c42d7b3063ef7bc
Convert a Hex string to UIColor in Swift
View gist:40ff4aac920b3febed2ce9d2868e68c6
// Creates a UIColor from a Hex string.
func colorWithHexString (hex:String) -> UIColor {
var cString:String = hex.stringByTrimmingCharactersInSet(NSCharacterSet.whitespaceAndNewlineCharacterSet()).uppercaseString
if (cString.hasPrefix("#")) {
cString = cString.substringFromIndex(1)
}
if (countElements(cString) != 6) {
return UIColor.grayColor()
@CocoaDebug
CocoaDebug / BinaryDataScanner.h
Created Feb 25, 2018 — forked from davepeck/BinaryDataScanner.h
Two simple Objective-C classes that make it crazy easy to read data from sequential binary files.
View BinaryDataScanner.h
//
// BinaryDataScanner.m
//
// Copyright 2009 Dave Peck <davepeck [at] davepeck [dot] org>. All rights reserved.
// http://davepeck.org/
//
// This class makes it quite a bit easier to read sequential binary files in Objective-C.
//
// This code is released under the BSD license. If you use it in your product, please
// let me know and, if possible, please put me in your credits.
@CocoaDebug
CocoaDebug / ArrayDeepCopy.swift
Created Jan 8, 2018 — forked from sohayb/ArrayDeepCopy.swift
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)
}
You can’t perform that action at this time.