RocketChat / Rocket.Chat.iOS

Legacy mobile Rocket.Chat client in Swift for iOS
https://rocket.chat
MIT License
1.04k stars 438 forks source link

Which view structure its better, one Storyboard? Many? Xib? #10

Closed felipeflorencio closed 8 years ago

felipeflorencio commented 9 years ago

Hello guys, taking advantage that project its starting and growing up talking with @rafaelks we raise an doubt, which view structure is better, for me basic question is for productivity, issue free for merges and support. Actually the project already started using Xcode 7 and swift 2, and because Xcode 7 we have now storyboard segue between them, and that its really handful.

For me, and its what i already practice building apps where i work / worked, since i still can migrate projects for Xcode 7 i do something like this:

1 - Super View Controller - That all view will inherit from it. 2 - Main class for storyboard / view segue - Sometimes this class is a extension from UIStoryboard or just a NSObject class, with that we always have all connections between views, controllers, storyboard in one place, that help a lot and make support very easy for other dev. 3 - Multiple Storyboard - How many storyboard depend of project, but basically i create one for each "super view controller", something like, "message" i create one, "login" other, and go on, this helps when work with team and i'm working at "message" and other dev at "login" we could merge without create any merge issue that storyboard really like create, even if we not changed or worked at the same feature.

Now, like we use Xcode 7 he have a handful tool that is segue between storyboard, for sure that will help.

Its basically this, what you do? Any other way, its welcome, please fell free for help!

rafaelks commented 9 years ago

@felipeflorencio Awesome, thanks for opening this issue!

  1. Totally, we should inherit from a BaseViewController. :+1:
  2. This is pretty handy. What I usually do is create a singleton with Storyboard instance and share all over the app.
  3. Totally, no doubt about it.
gsaslis commented 9 years ago

Fantastic!!!

Thanks for contributing these thoughts @felipeflorencio !! 

Most of us are still just learning about xcode and swift, so these tips really help! ;) 

No major objection against 1 & 2 - though I have to say I don't yet see the use-case they'll come in handy.. The pattern I've certainly come across before and usually the case against it is encapsulation.. I.e. Don't give access where it's not needed - not everyone needs to see everyone else until it's needed by the model..

Perhaps this is sth specific to ios / xcode though, so I'm happy to go with your experience here!!

For 3, if I understand correctly, the main reason in favour of using the multiple storyboards is to reduce the merging overhead when there are many developers working on the project, right? 

I guess it also helps with a better (visual) organization of the project structure to not have a huge monolithic storyboard.. 

In any case, thanks so much for sharing these - much appreciated!! : )

— Yorgos Saslis

On Thu, Aug 27, 2015 at 1:03 AM, Rafael Kellermann Streit notifications@github.com wrote:

@felipeflorencio Awesome, thanks for opening this issue!

  1. Totally, we should inherit from a BaseViewController. :+1:
  2. This is pretty handy. What I usually do is create a singleton with Storyboard instance and share all over the app.

3. Totally, no doubt about it.

Reply to this email directly or view it on GitHub: https://github.com/RocketChat/Rocket.Chat.iOS/issues/10#issuecomment-135186048

gsaslis commented 9 years ago

I've already proceeded with an independent storyboard for our left-side nav menu and I think so has @kormic, so I think we all agree on #3... Are there any further comments on points 1 & 2?

Is someone planning to open a PR with these?

rafaelks commented 9 years ago

@gsaslis Yes, your points are correct. Can you submit a PR with your changes?

gsaslis commented 9 years ago

they're already on my fork in case you want to have a look, currently working on a few auto layout issues then I'll open the PR once it's ready ; )

Yorgos Saslis Software Engineer

On 1 September 2015 at 00:23, Rafael Kellermann Streit < notifications@github.com> wrote:

@gsaslis https://github.com/gsaslis Yes, your points are correct. Can you submit a PR with your changes?

— Reply to this email directly or view it on GitHub https://github.com/RocketChat/Rocket.Chat.iOS/issues/10#issuecomment-136505993 .

gsaslis commented 9 years ago

@rafaelks just submitted my PR ...

but what do we do about 1 & 2 ? will someone open a PR, or should we just close this?

rafaelks commented 9 years ago

@gsaslis OK, I'll review soon... I'm not working on 1 & 2 now, but we totally should do that!

felipeflorencio commented 9 years ago

This weekend i really hope have time and i will work in this task getting master branch to implement :)

gsaslis commented 9 years ago

sounds good!

p.s: @felipeflorencio just keep in mind we're still working on the develop branch, until we are at a point we can issue a release... ;) can't remember if we discussed this guys, but we wanted to use git flow as the branching model.. anyone have any issues with that?

felipeflorencio commented 9 years ago

O ye, sorry its correct, i will do at developer, using git flow its good :D

gsaslis commented 9 years ago

@felipeflorencio - did you ever manage to move forward on the remaining 2 issues here?

shrtcrt commented 8 years ago

A BaseViewController is great for having access to commonly needed functionality, I see that is there already.

As far as storyboards, a storyboard per feature/function helps keep things clean. So one for Login, one for Sign Up, one for Side Menu, etc. Keep it clean.

I forked the repo and have been cleaning up code and improving organization. I noticed that code formatting is all over the place.