Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create Basic App #1

Open
wants to merge 108 commits into
base: jack_review
Choose a base branch
from
Open

Create Basic App #1

wants to merge 108 commits into from

Conversation

nottombrown
Copy link
Owner

All business logic is in ViewController.swift

// DRY this up -> The topButton and bottomButton should listen for state changes on the player
// @Jack: What is the cleanest way to do this?
// Make another controller for each half?
// Maybe also make the Player model observable with: https://github.com/slazyk/Observable-Swift
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like Key-Value Observing doesn't work quite the same way in swift as Obj-C. It might be good to use swift's built in Property Observers or the the Observable Swift Library built on top of that.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, ok. Haven't looked at any of that yet.
I actually think this logic should probably also live in a custom view. You could define a method on it (called, say, updateWithViewModel) that would take in a bunch of state and then update all the relevant UI.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, and then I would have two instances of the custom view. One for the top and one for the bottom. I'll look up examples of people using custom views in swift. Thanks!

@jflinter
Copy link

So yeah, broadly speaking I think you should have a TimeView class of some sort that knows how to display the remaining time and can report button presses to your view controller via a delegate pattern or something. There is prooobably too much logic in your ViewController right now (an extremely common antipattern of which i am often guilty). There is a good blog post on how you can mitigate this here: http://khanlou.com/2014/09/8-patterns-to-help-you-destroy-massive-view-controller/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants