Shortcut for adding UIView in Xcode - ios

Is there anybody who knows how to create shortcut for adding UIView to Storyboard?
Or is it possible to create user's shortcuts for custom actions in Xcode? Or maybe it's already exists.

You can use this shortcut ⇧+option+⌘+L to open the Library fast and you can drag it from there
You can also use bettertouchtool to add an action when doing a specific shortcut or tapping a button on the touchbar to do this:
⇧+option+⌘+L and typing then UIView

For me works with ⌘+⇧+L.
option is not necessary.

You can add shortcuts using Xcode > Preferences > Key Bindings. Search for the command-name using the field at the top-right, then double click in the key field and type the key you want to use.
But other than predefined commands not sure if you can add custom ones.

Related

Custom class not automatically showing up - Swift 3 iOS 10.2 Xcode 8

So I have my app set up with two view controllers. The first one is my initiation screen, where the app starts, and the second is one the user can navigate to. I added the second one later on in my development, but when I went to the right column under the identity inspector, my new Cocoa Touch Class file is not populated for me to select. Now if you ask me to just type it in, I've tried that, it does not seem to connect. I've tested it by printing a simple line in the viewDidLoad() of the new second class when it is loaded in the simulator, but nothing is printed. Any help would be greatly appreciated!! Thanks!
EDIT
Easy fix is:
Select the activity indicator on storyboard and go to identity inspector and copy the object id. as image: ObjectID_ActivityIndicator
Right click the storyboard file which has the view controller you are working at.
Open as > Source Code
Press command + F to find and look for the id you copied previously
Paste this: customClass="yourclassname" customModule="moduleNAme" customModuleProvider="target"(don't change this target word, you can choose desired module from identity inspector if any).
Command + S to save it and again right click on storyboard file > openAs> Interface builder
Now select activity indicator again and go to identity inspector. You will now see it there. You can also change it as per requirement.
Enjoy. I faced this problem today and found no help online. My class and module field were greyed out. Tried this fix and it worked.
Note: Make sure your custom class is accessible and is in app directory i.e it's not highlighted in red color but gives a normal look.
I have seen a problem like this where the solution was to change the "Module" to a specific value, close the storyboard, reopen it and delete the "Module" setting (assuming it was originally blank or restore it to its original value). This happened in project with many targets and their names may have changed.

Xcode when adding localization not all storyboards are found

When I try to add localization to my app by clicking on project-> localization -> + and add a new language the popup will only show two storyboards even though my app has three.
One storyboard file is missing from the popup
You need do following steps :
First you need to create new string file.
after select this string file and In file inspector and click on Localize button .
then you can see string file along with storyboards.
Adding Localizable.strings is a needed. If you still don't find some storyboards when adding a language, select the storyboards that don't appear and click localize button on the File Inspector in the right pane. Now when you add a new language the popup will show those missing storyboards
I had to open my storyboard and add a base localization, then it would show up in the popup when I wanted to add a new language

Xcode jump from viewcontroller.swift to storyboard

I'm working on a large ios app and I'm also a newb. I'm trying to find the correct scene in a storyboard in a large app. I'm in the .swift file and I need a quick way to figure out which scene is associated with that swift controller file. The only way I know now is to go through each scene and look at the Class property, which will take forever. Is there a shortcut to jump from the swift file to the associated scene?
In Xcode, open "Find in Workspace..." (Command+Shift+F)
Type the name of your ViewController.
In the results panel, check the entries under the .storyboard file. Clicking on them will open that exactly scene in the Interface Builder.
Profit.
You can also go further and filter the search by filetype. Check this out:
Create a custom Scope:
Super awesome result:

Unable to connect object with outlet in Xcode with automatic like below

I am facing problem to connect an object with outlet so when i open assistant editor there are no related file found on automatic...why NSObject file showing always.
Right where Automatic is highlighted, to the left of that there is an arrow, clicking that solved my issue
Because the storyboard don't have equivalent for automatic.
You have to select manual and navigate to the desired source file

XCode doesn't show all subclasses in drop-down when creating a new file

I'm building an iOS application with Xcode 6 and I want to add a UINavigationController file into my project.
When I click 'New File' and select 'Cocoa Touch Class', it doesn't show all the subclasses it should in the specific project I'm working on. It used to be pretty long scroll-down, but now I see only eight options not containing UINavigationController.
What should I do to fix this problem?
remove the string from "Class". Now hit tab to enter subclass of , start typing your Super class name, It will update the dropdown, just like the search in iPhone. :)

Resources