Skip to content
This repository has been archived by the owner on Jan 17, 2019. It is now read-only.

HubViewController as protocol #330

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

marmelroy
Copy link
Contributor

@cerihughes and I discussed the fact that subclassing HubViewController in order to define a contract (i.e. act as a protocol) was a bit strange.

The argument against it was that Swift will look at UIViewController as just a UIViewController and there will be lots of casting in the Swift code.

That's true (for now).

However, Swift looks at id as a HubViewController protocol.

Going with this approach, there's only one line of casting in the Swift code and that's only to make UIKit happy. I think that's acceptable.

@cerihughes
Copy link
Contributor

... but if we do create a protocol for the VC (there are still other cases where it's easier if it's a concrete class), we'd want to expose this in the API as UIViewController<HUBViewController> *, not id<HUBViewController>.

I think we should get to a point where we're not experimenting so much with different VC implementations and then look at whether using a protocol in the API is feasible.

For now, let's keep it as it is.

@spotify-ci-bot
Copy link

23 Errors
🚫 fatal error: too many errors emitted, stopping now [-ferror-limit=]
🚫 tests/HUBViewControllerImplementationTests.m#L259: no known instance method for selector ‘viewWillAppear:’
[self.viewController viewWillAppear:YES];
🚫 tests/HUBViewControllerImplementationTests.m#L564: no known instance method for selector ‘viewWillAppear:’
[self.viewController viewWillAppear:YES];
🚫 tests/HUBViewControllerImplementationTests.m#L270: no known instance method for selector ‘viewDidAppear:’
[weakViewController viewDidAppear:YES];
🚫 tests/HUBViewControllerImplementationTests.m#L542: no known instance method for selector ‘viewWillAppear:’
[self.viewController viewWillAppear:YES];
🚫 tests/HUBViewControllerImplementationTests.m#L276: no known instance method for selector ‘loadView’
[self.viewController loadView];
🚫 Couldn’t find the (junit) unit test report file in ‘build/tests-dynamic’. Make sure the tests were actually run.
🚫 tests/HUBViewControllerImplementationTests.m#L277: no known instance method for selector ‘viewDidLoad’
[self.viewController viewDidLoad];
🚫 tests/HUBViewControllerImplementationTests.m#L544: no known instance method for selector ‘viewWillAppear:’
[self.viewController viewWillAppear:YES];
🚫 tests/HUBViewControllerImplementationTests.m#L279: no known instance method for selector ‘viewDidLayoutSubviews’
[self.viewController viewDidLayoutSubviews];
🚫 tests/HUBViewControllerImplementationTests.m#L593: no known instance method for selector ‘viewDidLayoutSubviews’
[self.viewController viewDidLayoutSubviews];
🚫 tests/HUBViewControllerImplementationTests.m#L281: no known instance method for selector ‘viewWillAppear:’
[self.viewController viewWillAppear:YES];
🚫 tests/HUBViewControllerImplementationTests.m#L524: no known instance method for selector ‘viewDidLayoutSubviews’
[self.viewController viewDidLayoutSubviews];
🚫 tests/HUBViewControllerImplementationTests.m#L290: no known instance method for selector ‘viewDidAppear:’
[weakViewController viewDidAppear:YES];
🚫 tests/HUBViewControllerImplementationTests.m#L543: no known instance method for selector ‘viewDidLayoutSubviews’
[self.viewController viewDidLayoutSubviews];
🚫 tests/HUBViewControllerImplementationTests.m#L330: no known instance method for selector ‘viewWillAppear:’
[self.viewController viewWillAppear:YES];
🚫 tests/HUBViewControllerImplementationTests.m#L545: no known instance method for selector ‘viewDidLayoutSubviews’
[self.viewController viewDidLayoutSubviews];
🚫 tests/HUBViewControllerImplementationTests.m#L521: no known instance method for selector ‘viewWillAppear:’
[self.viewController viewWillAppear:YES];
🚫 tests/HUBViewControllerImplementationTests.m#L565: no known instance method for selector ‘viewWillAppear:’
[self.viewController viewWillAppear:YES];
🚫 tests/HUBViewControllerImplementationTests.m#L522: no known instance method for selector ‘viewDidLayoutSubviews’
[self.viewController viewDidLayoutSubviews];
🚫 Couldn’t find the (junit) unit test report file in ‘build/tests-static’. Make sure the tests were actually run.
🚫 tests/HUBViewControllerImplementationTests.m#L523: no known instance method for selector ‘viewWillAppear:’
[self.viewController viewWillAppear:YES];
🚫 Couldn’t find the (junit) unit test report file in ‘build/ui-tests’. Make sure the tests were actually run.

Generated by 🚫 Danger

@rastersize
Copy link
Contributor

@marmelroy @cerihughes With Swift 4 it’ll be possible to expose and use types as UIViewController<HUBViewController>. So “all” will be good in about 6 months time.

@marmelroy
Copy link
Contributor Author

@rastersize, can't wait :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
4 participants