Multiple developer work one storyboard in iOS - ios

Multiple developers are working on one project using Git. However, multiple developers are not working at the same time on the same storyboard.
Currently we found out one solution :
Create a storyboard particular to a UIViewController like xib.
If this is not right way then suggest me which way is best?
Memory leak accord when i use multiple storyboard for separate VC?

It really depends on how complex your views/storyboards are.
You could have 1 storyboard, which has multiple UIViewControllers, and multiple folks can work on different view controllers, with low chance of conflicts. You could have one storyboard for each view controller, but IMO you don't have to. Our project sometimes have almost ten UIViewControllers in one storyboard, and things are fine.
My two cents here is that, use one storyboard to include multiple view controllers that are relevant in a same workflow (like Sunny said), and use xib for those small pieces that are repeatedly used in various places across the app. So for a complete app, you might end up with a few storyboards and each in turn has multiple related view controllers, plus some xibs if needed.

Split up the Storyboard into several Storyboards. You can extract subviews into container views. Then you extract these into their own storyboards -> Editor -> Refactor to Storyboard.

Related

Best approach for 1 screen contains 2 view controller

I want to learn parent - child concepts in iOS. I found a some app in app store and I liked the their design. They have 3 button in same view controller when the user taps a button below view changes and calls their view controllers. Like a TabBar.
I tried to create 3 xib files. When the user taps the buttons they are awaking from nib and I added them to my containerView subview. It works. But I couldn't send a data between them because there is no prepare for segue method to so i couldn't prepared them.
I tried to create 3 viewController in Storyboard and I use them with the Storyboard ID. It works. But still can't transfer data between them.
I didn't understand what is the best approach for solve this problem ? I researched on the web about Custom Segues and Parent - Child concepts but I couldn't find anything.
What is the best approach for make a container like in the image ?
Thank you.
I am not sure if there is something like a best approach, at least in general term. It really depends on your specific demands and other logic of your app.
Both creating XIB files and creating ViewControllers in Storyboard together with their ID is ok. Here it is more about your preferred way. I would say that today you will probably see more using Storyboard than XIB files.
In terms of data transition. There are several ways, if it is not some very heavy logic then delegates can do it pretty well and easy.

Storyboard and Programmatic design simultaneously

I use programmatic way to create design parts and I won't use storyboard for design. But at some design I feel it will be easy with storyboard, is it possible to do design in both storyboard and programmatic in one project simultaneously. If so please tell me the process.
You can. Everything you can do in the designer you can do in code (though not vice versa).
You can instantiate the storyboard using the "UIStoryboard FromName" methods. From the storyboard object you can then use "InstantiateInitialViewController" to get the initial view controller of the storyboard. From this point on the storyboard segues will perform as expected.
If you want to jump to a certain part of the storyboard, you simply use the other method on UIStoryboard which takes an Identifier.vc.
Once you are done with your storyboard view controllers you can then get rid of it programmatically as expected (use pop/dismiss depending on how it was presented).
It is similar to the technique used for splitting large storyboards into smaller ones. If you google "splitting large storyboards" you will be able to find a lot of articles which will help you.
Absolutely. Most (if not all) of the objects you see in storyboard are part of the UIKit, which you'll see is imported at the top of every View Controller Xcode makes for you. You can add UI Objects, like a UILabel, to a View using addSubview, for instance.
Technically, you don't need to use the Interface Builder at all (and there was a time when you couldn't), it just makes things incredibly faster to produce.

What is the reason for storyboards?

New to iOS, just wondering if someone could explain the point of the storyboard.
If i create a view controller and programmatically add to it, what do i need a storyboard for?
Is it only for custom views? custom tables? etc
Thanks.
Long story short, my understanding of storyboard purpose is as follows:
Less code -> less bugs
Visual representation of UI layout simplifies UI creation (views hierarchy, autolayout constraints)
Extremely simple way to set objects' properties (e.g. delegates, gesture recognizers) just by control-drag
From Apple's Document:
Storyboards
Storyboards are the recommended way to design your app’s user interface. Storyboards let you design your entire user interface in one place so that you can see all of your views and view controllers and understand how they work together. An important part of storyboards is the ability to define segues, which are transitions from one view controller to another. These transitions allow you to capture the flow of your user interface in addition to the content. You can define these transitions visually, in Xcode, or initiate them programmatically.
You can use a single storyboard file to store all of your app’s view
controllers and views, or you can use multiple view storyboards to
organize portions of your interface. At build time, Xcode takes the
contents of the storyboard file and divides it into discrete pieces
that can be loaded individually for better performance. Your app never
needs to manipulate these pieces directly. The UIKit framework
provides convenience classes for accessing the contents of a
storyboard from your code.
For more information about using storyboards to design your interface,
see Xcode Overview . For information about how to access storyboards
from your code, see the UIStoryboard Class Reference .

Best practise in creating an uiview and presenting them in iOs

Is it a good practise to creates views in xcode and hide them and when required show them?
I am asking that because I prefer to create views visually and not in code.
If the view is to complex(a lot of subviews) should I create a new view controller to it?
I know there isn't a specify question here but I really need a clarification on this matter.
Regards
One of my first iOS applications had a tab bar and views that the user could switch between. Originally it was done by hiding and showing the right views depending on what the user pressed on the tab bar. This ended up being a complex disaster.
I then rewrote the app so that each tab bar view had its own UIViewController with its own set of views. That turned out to be so much easier to manage. (I also changed from using Interface Builder to straight code for creating the views, but that's beside the point and you can continue to use IB if you want.)
As for me, I prefer folowing practice:
Usually, a use storyboards,where views are placed, but if a view is complex, I create a separate XIB file, arrange all subviews there, and then in storyboard drag an UIView subclass and connect my XIB view with it.It helps to avoid mess in storyboard.
As for hiding views, I also don't recommend such practice as it can become very complex to understand your code and all those views are allocated when XIB is loaded, so the mobile developing rule "do as lazy as u can" is not met. We should try to spend as less memory as it's possible.
UIView is the best way to create iOS app, esp. if you want to reuse the code.
For example if you have same view to present in iPad n iPhone then using UIView can result in lots of similar code in View-controller
In another case if your view might need to have multiple table view it can be quite complex to handle each with delegates in ViewController. But separate view will solve this problem.
I have made my 1st open source code after learning how to use View
https://github.com/bishalg/BGRadioList
which I had learned from
http://www.raywenderlich.com/1768/uiview-tutorial-for-ios-how-to-make-a-custom-uiview-in-ios-5-a-5-star-rating-view
About the hiding view - I have used lots of hide and show view codes in my apps but believe me at one point it will become complex and unmanageable if you have lots of views.

Will we get frequent conflicts when using storyboard?

I think using storyboard will save us a lot of work sometimes. But when more than one mates working on the same storyboard. Is it possible that conflicts occurs frequently? When using .xib I and my workmates will have conflicts when we are working on the same .xib. So how about the storyboard? BTW:Don't tell me to use more than one storyboard. I think I prefer xib than storyboard if I need to use more than one storyboard.
If you have one big storyboard for your app, and several developers on your team will need to make changes in the storyboard, you will probably get conflicts.
If you're using xibs, you can put unrelated views in separate xibs. Then when developer A needs to change something in view 1, he just changes the xib containing view 1. And at the same time, if developer B changes something in view 2, he changes the xib containing view 2, which is probably separate from the xib containing view 1. So you don't get a conflict.
If you're using a storyboard, all the views are in one file. So developer A changes the storyboard to modify view 1, and at the same time developer B changes the storyboard to modify view 2. Boom, you get a conflict.
If your team has multiple developers working on the app user interface, you are much more likely to get conflicts if you use storyboards than if you use (carefully-separated) xibs. This is a serious problem with storyboards.
However, you can't create a table view controller with static content in a xib. You can only do that in a storyboard. So sometimes it's worthwhile to create a storyboard containing just one table view controller, in a project that uses xibs for everything else.

Resources