Skip to content

Instantly share code, notes, and snippets.

Step 1:
git clone https://github.com/hyperoslo/pod-template.git MyPod; cd MyPod; ./init.rb
Step 2:
pod name > MyPod
@3lvis
3lvis / gist:d84020ba97bb7f16c0a5
Created April 22, 2015 22:20
Generating a Core Data Model from code
- (void)generateModel {
NSManagedObjectModel *model = [NSManagedObjectModel new];
NSEntityDescription *runEntity = [NSEntityDescription new];
runEntity.name = @"Run";
runEntity.managedObjectClassName = @"Run";
model.entities = @[runEntity];
NSMutableArray *runProperties = [NSMutableArray new];
NSAttributeDescription *dateAttribute = [NSAttributeDescription new];
@3lvis
3lvis / gist:113bcf23dc8255f09712
Last active August 29, 2015 14:20
Enums in Swift and Objective-C
// Swift
enum StatusCode: Int {
case Unknown = 0
case Unauthorized = 401
case Forbidden = 403
case InternalServerError = 500
case ServiceUnavailable = 503
}
// Objective-C
//
// Warnings.xcconfig
//
// The list of warnings we (don’t) use, and the reasons why.
//
// :MARK: Warnings in use:
// :MARK: -everything
// We want the best possible diagnostics, so we simply enable everything that exists, and then opt–out of what doesn’t make sense for us.
//
// :MARK: - Warnings not to be promoted:
@3lvis
3lvis / gist:9e15d42fa70092213802
Created June 17, 2015 22:20
You can't be serious if your using .xibs. I mean, what's this?!
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7706" systemVersion="14D131" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7703"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" rowHeight="100" id="KGk-i7-Jjw" customClass="CHRLocationEventCell">
<rect key="frame" x="0.0" y="0.0" width="320" height="100"/>
@3lvis
3lvis / gist:8369592963b62b19f33b
Last active August 29, 2015 14:23
Who said that XML was a good writing to write visual interfaces?

How is this

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="7706" systemVersion="14D136" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="vXZ-lx-hvc">
    <dependencies>
        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7703"/>
    </dependencies>
    <scenes>
        <!--View Controller-->
@3lvis
3lvis / cell-designer.swift
Last active August 29, 2015 14:23
UITableViewCell Designer
import UIKit
import XCPlayground
class Cell: UITableViewCell {
init(frame: CGRect) {
super.init(style: .Default, reuseIdentifier: "Sample")
self.frame = frame
self.backgroundColor = .redColor()
import UIKit
import XCPlayground
func table() -> UITableView {
let frame = CGRect(x: 0, y: 0, width: 320.0, height: 320.0)
let tableView = UITableView(frame: frame)
tableView.registerClass(UITableViewCell.self, forCellReuseIdentifier: "cell")
return tableView
}
@3lvis
3lvis / view-designer.swift
Last active August 29, 2015 14:27
View Designer
import UIKit
import XCPlayground
class View: UIView {
override init(frame: CGRect) {
super.init(frame: frame)
self.frame = frame
@3lvis
3lvis / NetworkingClient.swift
Created September 18, 2015 13:35
NetworkingClient.swift
import Foundation
import Networking
import DATAStack
import Sync
import JSON
class NetworkingClient {
var data: DATAStack!
var networking: Networking!