Skip to content

Instantly share code, notes, and snippets.

View malcolmkmd's full-sized avatar
🎯
Focusing

Malcolm malcolmkmd

🎯
Focusing
View GitHub Profile
@malcolmkmd
malcolmkmd / SetupView-LockScreenX.swift
Created September 15, 2017 12:20
SetupView for LockScreenX
func setupView(){
// Background View
view.addSubview(bgImageView)
bgImageView.snp.makeConstraints{ make in
make.edges.equalToSuperview()
}
// Detail Container View
view.addSubview(detailContainer)
detailContainer.snp.makeConstraints{ make in
@malcolmkmd
malcolmkmd / gitignore
Created September 15, 2017 06:43
Xcode Git Ignore, ignores pods
# Xcode
#
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
## Build generated
build/
DerivedData/
## Various settings
*.pbxuser
@malcolmkmd
malcolmkmd / Storyboard.swift
Created August 6, 2017 07:27
Storyboard identifiable
import UIKit
protocol StoryboardIdentifiable {
static var storyboardIdentifier: String { get }
}
extension StoryboardIdentifiable where Self: UIViewController {
static var storyboardIdentifier: String {
return String(describing: self)
}
@malcolmkmd
malcolmkmd / Ext+UITableView.swift
Last active September 20, 2017 06:46
UITableview nibloadable
import UIKit
extension UITableView {
func register<T: UITableViewCell>(_: T.Type) {
let nib = UINib(nibName: T.nibName, bundle: nil)
register(nib, forCellReuseIdentifier: T.reuseIdentifier)
}
func dequeueReusableCell<T: UITableViewCell>(forIndexPath indexPath: IndexPath) -> T {
@malcolmkmd
malcolmkmd / String+Styles.swift
Created July 10, 2017 11:23
String Extensions
import UIKit
import BonMot
extension String {
func styleTitle() -> NSAttributedString {
let style = StringStyle(
.font(UIFont(name: "Futura", size: 18)!),
.color(UIColor.white)
)
@malcolmkmd
malcolmkmd / UIView+Anchors.swift
Created July 10, 2017 11:16
UIView Extensions
import Foundation
import UIKit
extension UIView {
func addConstraintsWithFormat(_ format: String, views: UIView...) {
var viewsDictionary = [String: UIView]()
for (index, view) in views.enumerated() {
let key = "v\(index)"
import Foundation
import Moya
enum MovieApi {
case reco(id:Int)
case topRated(page:Int)
case newMovies(page:Int)
case video(id:Int)
}
@malcolmkmd
malcolmkmd / Movie.swift
Created July 3, 2017 14:19
Movie Model
import Foundation
struct APIResults: Decodable {
let page: Int
let numResults: Int
let numPages: Int
let movies: [Movie]
private enum CodingKeys: String, CodingKey {
case page, numResults = "total_results", numPages = "total_pages", movies = "results"
@malcolmkmd
malcolmkmd / MovieJSON.json
Created July 3, 2017 13:58
Movie Api Json
{
"page": 1,
"total_results": 6452,
"total_pages": 323,
"results": [
{
"vote_count": 78,
"id": 374430,
"video": false,
"vote_average": 8.8,
@malcolmkmd
malcolmkmd / PodFile.txt
Last active July 3, 2017 13:56
CinemaHub
# Uncomment the next line to define a global platform for your project
platform :ios, '9.0'
inhibit_all_warnings!
target 'CinemaHub' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for CinemaHub
pod 'ChameleonFramework', '~> 2.1.0'
pod 'BonMot', '~> 4.3.1'