Skip to content

Instantly share code, notes, and snippets.

@exorcyze
exorcyze / SampleViewController.m
Last active December 11, 2015 20:48
SampleViewController using EXTableView, EXPullToRefresh and base DataService calls to implement a functional twitter view.
#import "SampleViewController.h"
#import "EXTableView.h"
#import "SampleDataService.h"
#import "EXPullToRefresh.h"
@interface SampleViewController ()
- (void) setupView;
- (void) refreshData;
@end
@exorcyze
exorcyze / ParsingExtensions.swift
Last active August 29, 2015 14:06
Sample Swift JSON Parsing
// *** Extensions
extension NSString {
func dictionaryFromJson() -> NSDictionary {
let jsonData = self.dataUsingEncoding( NSUTF8StringEncoding )!
return jsonData.dictionary()
}
}
extension String {
func dictionaryFromJson() -> NSDictionary {
let jsonData = self.dataUsingEncoding( NSUTF8StringEncoding )!
@exorcyze
exorcyze / UIViewConstraint.swift
Created December 30, 2020 17:48
Simpler constraint setup
// Sample usages
v1.constrainWidth( left: 20, right: 20 ).constrain( .height, to: 30 )
v2.constrainWidth( left: 20, right: 20 ).constrain( .height, to: 30 )
v3.constrain( .height, to: 100 ).constrain( .width, to: 100 )
v3.constrain( .centerX, to: v2, .centerX )
container.constrainVStack( 20, v1, 10, v2, 20, v3 )
//
// UIViewConstraint
// Created : Mike Johnson, 2020
@exorcyze
exorcyze / LayoutSample.swift
Last active December 30, 2020 21:36
View layouts made easier
override func viewWillLayoutSubviews() {
super.viewWillLayoutSubviews()
// takes up entire superview
myscroll.pinWidth().pinHeight()
// take the entire superview width, and
// make the height a 16/9 ratio of that
titleImage.pinWidth().pinHeightToWidth(by: 16/9)
// pin to the width of the superview with 20 padding each side
overviewLabel.pinWidth( lpad: 20, rpad: 20 )
//
// UIViewController+Preview.swift
// Created : Mike Johnson, 2020
//
import Foundation
import UIKit
import SwiftUI
// Source: https://www.swiftbysundell.com/articles/getting-the-most-out-of-xcode-previews/
//
// UIView+Style.swift
// Created / Copyright © : Mike Johnson, 2020
//
import Foundation
import UIKit
// MARK: - App Size Values
//
// DebugLog.swift
// Created / Copyright © : Mike Johnson, 2016
//
import Foundation
import os
// MARK: - Module Struct
//
// EXTextField
// Created / Copyright © : Mike Johnson, 2021
//
import Foundation
import UIKit
// MARK: - Lifecycle
//
// TestDetailController
// Created / Copyright © : Mike Johnson, 2021
//
import Foundation
import UIKit
// MARK: - Lifecycle Methods
//
// SettingsCell
// Created / Copyright © : Mike Johnson, 2021
//
import Foundation
import UIKit
// MARK: - Lifecycle