Skip to content

Instantly share code, notes, and snippets.

View Infinity-James's full-sized avatar

James Valaitis Infinity-James

View GitHub Profile

Booking Flow

  1. The user taps on the type of ticket they wish to purchase.
  2. This action either displays a reservation confirmation panel or a required GDPR agreement that, if accepted, is followed by the panel.
  3. In this reservation confirmation view, the user can adjust the number of tickets to purchase (if the ticket type allows such adjustments), agree to non-required GDPR questions, and add a promo code.
  4. The user taps the call to action and: a) If the ticket is free, the user is immediately shown the details for the booking. Technically:
    i. I accept the relevant GDPR requirements via /api/v2/app/gdpr
    ii. I create a reservation via /api/v2/app/reservations
    iii. I check the created reservation pending or checked out, in which case I start polling for the booking details.
@Infinity-James
Infinity-James / UIView+Borders.swift
Created January 21, 2019 16:47
Corner Borders for UIView
// MARK: Borders
public extension UIView {
/**
Adds borders to the given corners.
- Parameter corners: The corners to which borders should be added.
- Parameter color: The color of the borders.
- Parameter length: The length of each border across the view.
- Parameter width: The thickness of the borders.
*/
func addBorders(to corners: Set<Corner>, color: UIColor = .black, length: CGFloat = 16.0, width: CGFloat = 1.0) {
@Infinity-James
Infinity-James / NavigationTheme.swift
Created November 17, 2018 15:02
Allows for easily setting a theme on the navigation bar.
//
// NavigationTheme.swift
//
// Created by James Valaitis on 13/04/2018.
//
import UIKit
// MARK: Navigation Theme
/**
@Infinity-James
Infinity-James / NibLoadable.swift
Created April 20, 2018 08:37
Allows for easy registration and dequeue of table view and collection view cells.
import UIKit
// MARK: Nib Loadable
public protocol NibLoadable {
/// The name of the .xib file in which this view is defined.
static var nibName: String { get }
}
// MARK: Nib Loadable Convenience
public extension NibLoadable where Self: UIView {
static var nibName: String { return NSStringFromClass(self).components(separatedBy: ".").last! }
@Infinity-James
Infinity-James / InteractiveTextView.swift
Last active May 3, 2018 11:55
An RxSwift subclass of UITextView which allows for observation of taps on an arbitrary portion of text.
//
// InteractiveTextView.swift
// Views
//
// Created by James Valaitis on 05/03/2018.
// Copyright © 2018 VIPR Digital. All rights reserved.
//
import RxSwift
import UIKit
@Infinity-James
Infinity-James / swift-style-guide.markdown
Last active May 6, 2016 08:23
Office Serve Swift Style Guide

Naming

Use descriptive names with camel case for classes, methods, variables, etc. Class names should be capitalized, while method names and variables should start with a lower case letter.

Preferred:
private let maximumFoodProducts = 100

class FoodProductDetailView