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

Rename all references from ViewModel to Item #20

Merged
merged 5 commits into from
Sep 26, 2016

Conversation

zenangst
Copy link
Contributor

This is a breaking change, it renames the ViewModel struct to Item and ViewConfigurable to ItemConfigurable.

It should be very easy to migrate to the new version as you only need to search and replace those changes and should be done in a jiffy.

This PR came to be after a discussion that me and @vadymmarkov had about naming. ViewModel kind of implies that it holds content for the entire screen as it would potentially deal with ViewController.

And the second reason is that it is mainly used in Spots where we always refer to the ViewModel as an Item.

Item is abstract to work on multiple instances, where as ViewModel implies a specific scenario where it will be used. You can always argue that it is in fact styling a specific view as ViewConfigurable is a property on the underlaying component, a cell for example.

Personally I think this is the best name for what it does. I hope you do as well.

describe("ViewModel") {
var viewModel: ViewModel!
describe("Item") {
var Item: Item!
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the variable name should be lowercase 😉

Copy link
Contributor

Choose a reason for hiding this comment

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

I's weird that it compiles 😱

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm gonna check it :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@vadymmarkov it didn't compile when running the tests :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe it should build the tests when calling build instead of just when the tests run. That would avoid these kind of things.

@zenangst
Copy link
Contributor Author

@vadymmarkov @onmyway133 @RamonGilabert yay, the tests pass!

@@ -2,7 +2,7 @@ import Tailor

// MARK: - Array

public extension _ArrayType where Generator.Element == ViewModel {
public extension _ArrayType where Generator.Element == Item {
Copy link
Contributor

Choose a reason for hiding this comment

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

Does making extension on slightly private type good practice?

@vadymmarkov vadymmarkov merged commit 6214ed9 into master Sep 26, 2016
@vadymmarkov vadymmarkov deleted the rename/view-model-to-item branch September 26, 2016 09:16
}

it("compare relations properly") {
var Item2 = Item(data)
Copy link
Contributor

Choose a reason for hiding this comment

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

Small detail, but it would be great if the variable is lowercase 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

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

True dat!

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.

4 participants