Skip to content

Instantly share code, notes, and snippets.

View ksoftllc's full-sized avatar

Chuck Krutsinger ksoftllc

  • KSoft, LLC
  • Denver, CO
View GitHub Profile
struct Frame {
enum Change {
case addRoll(_ roll: Int)
case setCurrentFrame(_ newValue: Bool)
}
static let Strike = 10
static let FullRackOfPins = 10
static let Gutter = 0
static let LastFrame = 10
class ViewController: UIViewController {
@IBOutlet weak var cardImageView: UIImageView!
let disposeBag = DisposeBag()
let divider = 100
deinit {
print("deinit vc")
}
override func viewDidLoad() {
super.viewDidLoad()
let x = { (i: Int) in
return String(square(increment(i)))
}
saveButton.rx.tap
.withLatestFrom(websiteAddress.rx.text)
.filter(verifyUrl)
.map(Website.init(address:))
.subscribe(onNext: updateWebsiteAddress)
.disposed(by: bag)
//composing with another (String) -> String shape
let shout = addExclamation(uppercase(s))
//composing with (String) -> A shape
let url = URL(string: uppercase("http://google.com")
//composing with (A) -> String shape
let fromData = uppercase(String(data: data, encoding: .utf8))
func uppercase(_ string: String) -> String {
  return string.uppercased()
}
//
// GithubSignupViewModel2.swift
// RxExample
//
// Created by Krunoslav Zaher on 12/6/15.
// Modified by Chuck Krutsinger on 2/20/19.
//
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
//
@ksoftllc
ksoftllc / GithubSignupViewModel2.swift
Created February 20, 2019 21:41
RxSwift ViewModel implemented as a top level function
//
// GithubSignupViewModel2.swift
// RxExample
//
// Created by Krunoslav Zaher on 12/6/15.
// Modified by Chuck Krutsinger on 2/20/19.
//
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
//
// SearchResultViewModel.swift
// RxExample
//
// Created by Krunoslav Zaher on 4/3/15.
// Modified by Chuck Krutsinger on 2/20/19.
//
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
//
import RxSwift
@ksoftllc
ksoftllc / Deinit.swift
Created February 20, 2019 01:06
A print statement to document when a class instance is deallocated from memory
#if DEBUG
deinit {
print("\(String(describing: self)) deinit")
}
#endif