Skip to content

Instantly share code, notes, and snippets.

View TimOliver's full-sized avatar
😆
Out for a byte. Back in a bit.

Tim Oliver TimOliver

😆
Out for a byte. Back in a bit.
View GitHub Profile
@Ben-G
Ben-G / DynamicInit.swift
Last active May 5, 2025 13:33
Dynamically create instance based on type in Swift
protocol Initializable {
init()
}
class A : Initializable {
var content:String
required init() {
content = "TestContent"
}
@austinzheng
austinzheng / CustomTextInputView.swift
Last active January 20, 2022 15:14
Simple UIKeyInput example
import UIKit
/// A very simple example view that can accept keyboard input and add or delete text from an enclosed label.
class CustomTextInputView : UIControl, UIKeyInput {
var label : UILabel?
override func canBecomeFirstResponder() -> Bool {
return true
}
@PurpleBooth
PurpleBooth / README-Template.md
Last active May 15, 2025 16:42
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@cmittendorf
cmittendorf / DocumentIdentifier.swift
Created August 1, 2015 10:51
Returns the NSURLDocumentIdentifierKey for a file.
#!/usr/bin/env swift
import Foundation
let args = Process.arguments
if (args.count != 2) {
print("usage: \(args[0]) <file>\n")
exit(-1)
}
@cmittendorf
cmittendorf / StartTrackingDocumentIdentifier.swift
Created August 21, 2015 08:44
A script to enable tracking the DocumentIdentifier for a file on OSX.
#!/usr/bin/env swift
import Foundation
let args = Process.arguments
if (args.count != 2) {
print("usage: \(args[0].lastPathComponent) <file>\n")
exit(-1)
}
@muukii
muukii / MTKCIImageView.swift
Created September 28, 2015 05:32
CIImageView (Using Metal)
//
// MTKCIImageView.swift
// Fil
//
// Created by Muukii on 9/27/15.
// Copyright © 2015 muukii. All rights reserved.
//
import Foundation
import Metal
@Packetfahrer
Packetfahrer / gist:e4af21b6638a02132176
Created October 27, 2015 20:37 — forked from n00neimp0rtant/gist:27829d87118d984232a4
UIVisualEffectView blur radius manipulation (new for iOS 9)
// iOS 9 allows you to animate between visual effects, which gives you the
// ability to manipulate the blur radius. this can be useful for animating
// a backdrop for a custom modal, and with a few tricks, can even be set
// indirectly, allowing you to "scrub" between them back and forth with
// a gesture, just like when you pull down Spotlight.
// these are the two effects you want to transition between
UIVisualEffect *startEffect = nil; // "nil" means no blur/tint/vibrancy (plain, fully-transparent view)
UIVisualEffect *endEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleLight];
@justinbellamy
justinbellamy / cltools.sh
Last active March 6, 2022 03:46 — forked from jellybeansoup/cltools.sh
Install Autoconf and Automake on OS X El Capitan
#!/bin/sh
##
# Install autoconf, automake and libtool smoothly on Mac OS X.
# Newer versions of these libraries are available and may work better on OS X
#
# This script is originally from http://jsdelfino.blogspot.com.au/2012/08/autoconf-and-automake-on-mac-os-x.html
#
export build=~/devtools # or wherever you'd like to build
@ryuichis
ryuichis / gist:755e6297aec13c900cdf
Last active June 4, 2022 05:38 — forked from gavrix/gist:5054182
Script integrating OCLint into XCode. Put it in "Run script" build phase.
source ~/.bash_profile
cd ${SRCROOT}
xcodebuild clean
xcodebuild | xcpretty -r json-compilation-database
oclint-json-compilation-database -- -report-type xcode
@sergigracia
sergigracia / iOSProjectFolderStructure.swift
Last active June 10, 2022 15:30
How to organize an Xcode project? This is a folder structure proposal for an iOS project.
App
Coordinators // Views management
UI // Grouped by features/viewHierarchy
General // Custom textfield, picker
FeatureA
A.swift
AView.swift
AController.swift
AppExtensions // Specific code for extensions
Watch