{"id":2402,"date":"2015-09-25T13:21:35","date_gmt":"2015-09-25T13:21:35","guid":{"rendered":"http:\/\/truelogic.org\/wordpress\/?p=2402"},"modified":"2015-09-25T13:23:01","modified_gmt":"2015-09-25T13:23:01","slug":"xcode-6-ctrl-drag-fails-to-create-outlet-for-ui-component-fix","status":"publish","type":"post","link":"https:\/\/truelogic.org\/wordpress\/2015\/09\/25\/xcode-6-ctrl-drag-fails-to-create-outlet-for-ui-component-fix\/","title":{"rendered":"Xcode 6 &#8211; &#8216;Ctrl Drag fails to create Outlet for UI component&#8217; Fix"},"content":{"rendered":"<p>This seems to be a bug in the later versions of Xcode &#8211; specifically 4.0 and later, though it seems to work \u00a0in some cases without any problems. When you select a UI control in the storyboard, open the AssistantEditor and control-drag it to the relevant file in the editor, nothing happens.<\/p>\n<p><a href=\"https:\/\/truelogic.org\/wordpress\/wp-content\/uploads\/2015\/09\/Screen-Shot-2015-09-25-at-6.24.58-PM.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-medium wp-image-2404\" src=\"https:\/\/truelogic.org\/wordpress\/wp-content\/uploads\/2015\/09\/Screen-Shot-2015-09-25-at-6.24.58-PM-620x277.png\" alt=\"Screen Shot 2015-09-25 at 6.24.58 PM\" width=\"620\" height=\"277\" srcset=\"https:\/\/truelogic.org\/wordpress\/wp-content\/uploads\/2015\/09\/Screen-Shot-2015-09-25-at-6.24.58-PM-620x277.png 620w, https:\/\/truelogic.org\/wordpress\/wp-content\/uploads\/2015\/09\/Screen-Shot-2015-09-25-at-6.24.58-PM-300x134.png 300w, https:\/\/truelogic.org\/wordpress\/wp-content\/uploads\/2015\/09\/Screen-Shot-2015-09-25-at-6.24.58-PM-940x420.png 940w, https:\/\/truelogic.org\/wordpress\/wp-content\/uploads\/2015\/09\/Screen-Shot-2015-09-25-at-6.24.58-PM-900x402.png 900w, https:\/\/truelogic.org\/wordpress\/wp-content\/uploads\/2015\/09\/Screen-Shot-2015-09-25-at-6.24.58-PM.png 1092w\" sizes=\"auto, (max-width: 620px) 100vw, 620px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>A lot of people face this problem and the general solutions provided are:<\/p>\n<ul>\n<li>The wrong file is open in the Assistant Editor<\/li>\n<li>The correct class file needs to be assigned to the the Storyboard, specially if you are using a custom Viewcontroller class.<\/li>\n<li>Deleting the working files of the project and loading it again in Xcode.<\/li>\n<\/ul>\n<p>I was not able to resolve my problem with the above solutions. But the reason for the problem was clear &#8211; the correct class was not assigned to the Storyboard so it was rejecting the creation of an Outlet. I found that out of 5 scenes in the storyboard, only the last 2 were having this problem and the other 3 did not have this problem. On investigating this further, I found that the the storyboard had not assigned the <em>customClass<\/em> and <em>customModule <\/em>attributes\u00a0 to the viewController xml tag to the two scenes where this problem existed, whereas the other 3 scenes where Outlets could be created, these attributes were there.<\/p>\n<p><a href=\"https:\/\/truelogic.org\/wordpress\/wp-content\/uploads\/2015\/09\/Screen-Shot-2015-09-25-at-6.46.18-PM.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-medium wp-image-2405\" src=\"https:\/\/truelogic.org\/wordpress\/wp-content\/uploads\/2015\/09\/Screen-Shot-2015-09-25-at-6.46.18-PM-620x252.png\" alt=\"Screen Shot 2015-09-25 at 6.46.18 PM\" width=\"620\" height=\"252\" srcset=\"https:\/\/truelogic.org\/wordpress\/wp-content\/uploads\/2015\/09\/Screen-Shot-2015-09-25-at-6.46.18-PM-620x252.png 620w, https:\/\/truelogic.org\/wordpress\/wp-content\/uploads\/2015\/09\/Screen-Shot-2015-09-25-at-6.46.18-PM-300x122.png 300w, https:\/\/truelogic.org\/wordpress\/wp-content\/uploads\/2015\/09\/Screen-Shot-2015-09-25-at-6.46.18-PM-940x382.png 940w, https:\/\/truelogic.org\/wordpress\/wp-content\/uploads\/2015\/09\/Screen-Shot-2015-09-25-at-6.46.18-PM-900x366.png 900w, https:\/\/truelogic.org\/wordpress\/wp-content\/uploads\/2015\/09\/Screen-Shot-2015-09-25-at-6.46.18-PM.png 955w\" sizes=\"auto, (max-width: 620px) 100vw, 620px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>\\<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>After manually adding the attributes directly in the Storyboard file xml, the problem went away and the Outlets could be created.<\/p>\n<pre>&lt;viewController id=\"BYZ-38-t0r\"<span style=\"text-decoration: underline;\"> customClass=\"ViewController\" customModule=\"Swerk\"<\/span> customModuleProvider=\"target\" sceneMemberID=\"viewController\"&gt;\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"mh-excerpt\"><p>This seems to be a bug in the later versions of Xcode &#8211; specifically 4.0 and later, though it seems to work \u00a0in some cases <a class=\"mh-excerpt-more\" href=\"https:\/\/truelogic.org\/wordpress\/2015\/09\/25\/xcode-6-ctrl-drag-fails-to-create-outlet-for-ui-component-fix\/\" title=\"Xcode 6 &#8211; &#8216;Ctrl Drag fails to create Outlet for UI component&#8217; Fix\">[&#8230;]<\/a><\/p>\n<\/div>","protected":false},"author":1,"featured_media":2409,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[310],"tags":[],"class_list":["post-2402","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-xcode-swift"],"_links":{"self":[{"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/posts\/2402","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/comments?post=2402"}],"version-history":[{"count":3,"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/posts\/2402\/revisions"}],"predecessor-version":[{"id":2407,"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/posts\/2402\/revisions\/2407"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/media\/2409"}],"wp:attachment":[{"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/media?parent=2402"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/categories?post=2402"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/tags?post=2402"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}