ios-template icon indicating copy to clipboard operation
ios-template copied to clipboard

Make default coordinators less opinionated

Open ZevEisenberg opened this issue 7 years ago • 3 comments

This is not an official change - it's just the opinion of @ZevEisenberg, @heyltsjay, @KingOfBrian, @nbonatsakis. Here's the version of Coordinator.swift from my latest project, but even this may be more than we need:

import Foundation

/// Coordinators inherit from `NSObject` because they often need to be made
/// delegates or message receivers.
protocol Coordinator: class, NSObjectProtocol { }

ZevEisenberg avatar Nov 30 '17 16:11 ZevEisenberg

I may be missing something here, but what's the point of this protocol?

jvisenti avatar Nov 30 '17 16:11 jvisenti

It's really just for expressing intent. Coordinators are usually delegates, and it's going to have to be a class so it can be weak, and an NSObjectProtocol so it can be various kinds of UIKit delegates. This just establishes all that up front, so you don't have to keep rediscovering it through compiler errors as you work. I like it in my project, but you can just not use it in yours. Totally fine if we just delete the file entirely, rather than changing it to something like this.

ZevEisenberg avatar Nov 30 '17 16:11 ZevEisenberg

Pull Request in #75

heyltsjay avatar Mar 26 '18 14:03 heyltsjay