Skip to content

Instantly share code, notes, and snippets.

Vincent Chau chauvincent

  • DoorDash
  • San Francisco, CA
Block or report user

Report or block chauvincent

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Fix.swift
protocol OrdersListDisplayLogic: class {}
class OrdersListPresenter: OrdersListPresentationLogic {
weak var view: OrdersListDisplayLogic?
...
}
View Builder.swift
// In some builder class:
let view = OrdersListViewController()
let interactor = OrdersListInteractor()
let presenter = OrdersListPresenter()
view.interactor = interactor
interactor.presenter = presenter
presenter.view = view
View CleanSwiftStub.swift
protocol OrdersListDisplayLogic {}
protocol OrdersListBusinessLogic {}
protocol OrdersListPresentationLogic {}
class OrdersListViewController: OrdersListDisplayLogic {
var interactor: OrdersListBusinessLogic
...
}
class OrdersListInteractor: OrdersListBusinessLogic {
View Fixed.swift
let someModalVC = SomeModalViewController()
someModalVC.actionHandler = { [weak someModalVC] in
someModalVC?.dismiss(animated: true, completion: nil)
}
present(someModalVC, animated: true, completion: nil)
View Caller.swift
let someModalVC = SomeModalViewController()
someModalVC.actionHandler = {
someModalVC.dismiss(animated: true, completion: nil)
}
present(someModalVC, animated: true, completion: nil)
View SomeModalViewController.swift
class SomeModalViewController: UIViewController {
var actionHandler: (() -> Void)?
@IBAction func onTappedAction(_ sender: Any) {
actionHandler?()
}
}
View ClosureVersion.swift
NotificationCenter.default.addObserver(
forName: .SomethingToObserveNotification,
object: nil,
queue: .main) { [weak self] notification in
self?.handleNotification(notification)
}
View FunctionAsClosure.swift
NotificationCenter.default.addObserver(
forName: .SomethingToObserverNotification,
object: nil,
queue: .main,
using: handleNotification
)
View ObservableViewController.swift
// MARK: - Init
deinit {
NotificationCenter.default.removeObserver(self)
}
// MARK: - View Life Cycle
override func viewDidLoad() {
super.viewDidLoad()
View gist:0126fe6799122e6ec6b5a384addaf0cd
/usr/bin/xcrun xcodebuild -workspace /Users/vincentchau/Desktop/Carthage/Checkouts/pusher-websocket-swift/PusherSwift.xcworkspace -scheme PusherSwift -configuration Release -derivedDataPath /Users/vincentchau/Library/Caches/org.carthage.CarthageKit/DerivedData/9.2_9C40b/pusher-websocket-swift/5.1.0 -sdk iphoneos ONLY_ACTIVE_ARCH=NO BITCODE_GENERATION_MODE=bitcode CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= CARTHAGE=YES archive -archivePath /var/folders/2d/0rf8h8p14h3d6055x6k206_w0000gn/T/pusher-websocket-swift SKIP_INSTALL=YES GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=NO CLANG_ENABLE_CODE_COVERAGE=NO (launched in /Users/vincentchau/Desktop/Carthage/Checkouts/pusher-websocket-swift)User defaults from command line:
IDEArchivePathOverride = /var/folders/2d/0rf8h8p14h3d6055x6k206_w0000gn/T/pusher-websocket-swift
IDEDerivedDataPathOverride = /Users/vincentchau/Library/Caches/org.carthage.CarthageKit/DerivedData/9.2_9C40b/pusher-websocket-swift/5.1.0
Build settings from command line:
BITCODE_GENERATION_MODE =
You can’t perform that action at this time.