Skip to content

Instantly share code, notes, and snippets.

@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 / gist:c3073d99b647a6554b82
Last active October 5, 2019 10:53
OS X Shortcuts
Xcode:
Show Toolbar: Shift + Command + T
Hide Toolbar: Shift + Command + T
Sketch:
Show Toolbar: Shift + Command + T
Hide Toolbar: Shift + Command + T
Show Inspector: Alt(Option) + Command + 0
Show Layers List: Command + 0
@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!
@3lvis
3lvis / Cell.swift
Created September 18, 2015 14:06
Cell.swift
import UIKit
class SlotCell: UITableViewCell {
static let Identifier = "SlotCellIdentifier"
override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
self.contentView.backgroundColor = UIColor(hex: "28C787")
}
@3lvis
3lvis / Controller.swift
Created September 18, 2015 14:06
Controller.swift
import UIKit
import DATASource
class SlotsController: UITableViewController {
var networking: NetworkingClient
// MARK - Getters
lazy var dataSource: DATASource = {
let dataSource = DATASource(tableView: self.tableView, fetchRequest: Slot.request(), sectionName: nil, cellIdentifier: SlotCell.Identifier, mainContext: self.networking.data.mainContext, configuration: { cell, item, indexPath in
@3lvis
3lvis / ManagedObject.swift
Created September 18, 2015 14:07
ManagedObject.swift
import CoreData
@objc(Slot)
public class Slot: _Slot {
static func request() -> NSFetchRequest {
let request = NSFetchRequest(entityName: Slot.entityName())
request.sortDescriptors = [NSSortDescriptor(key: "startTime", ascending: true)]
return request
}