{"id":1065,"date":"2018-03-06T22:19:54","date_gmt":"2018-03-06T22:19:54","guid":{"rendered":"http:\/\/sezeromer.com\/?p=1065"},"modified":"2023-02-26T13:20:57","modified_gmt":"2023-02-26T10:20:57","slug":"swift-outlet-ve-action","status":"publish","type":"post","link":"https:\/\/sezeromer.com\/en\/swift-outlet-ve-action\/","title":{"rendered":"Swift Outlet and Action"},"content":{"rendered":"<p>Hello. In this article I will talk about outlet and action differences for friends who have just started Swift. Actually, this difference is so simple that sometimes it can get us in trouble. Some friends may not even know where these preferences come from. I will tell from the beginning. First you need to open a project in XCode. When you open the project you will see a screen like this. This page is where our project information is located. We have no business with this page right now. We have more work with Main.storyboard.<\/p>\n<p><a href=\"http:\/\/sezeromer.com\/swift-outlet-ve-action\/xcode\/\" rel=\"attachment wp-att-1066\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-1066 size-full\" src=\"http:\/\/sezeromer.com\/wp-content\/uploads\/2018\/03\/xcode.png\" sizes=\"(max-width: 1400px) 100vw, 1400px\" srcset=\"http:\/\/sezeromer.com\/wp-content\/uploads\/2018\/03\/xcode.png 1400w, http:\/\/sezeromer.com\/wp-content\/uploads\/2018\/03\/xcode-300x171.png 300w, http:\/\/sezeromer.com\/wp-content\/uploads\/2018\/03\/xcode-768x438.png 768w, http:\/\/sezeromer.com\/wp-content\/uploads\/2018\/03\/xcode-1024x584.png 1024w\" alt=\"\" width=\"1400\" height=\"799\" \/><\/a><\/p>\n<p>If we open the Main.storyboard screen, we will see a screen like this. We can design this screen, we can control the page controller. We will put the controller here and do the tests. First, we assign a button. When we click on the round yellow button on the page design to assign the button, the controller on the right side is the bottom. We have to choose the button from here. When we write a button to the search section, it is already exiting directly. We use the drag and drop method to drop the button. After that, I make a label so that the outlet and the action are different.<\/p>\n<p><a href=\"http:\/\/sezeromer.com\/swift-outlet-ve-action\/xcode-1\/\" rel=\"attachment wp-att-1067\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1067\" src=\"http:\/\/sezeromer.com\/wp-content\/uploads\/2018\/03\/xcode-1.png\" sizes=\"(max-width: 1440px) 100vw, 1440px\" srcset=\"http:\/\/sezeromer.com\/wp-content\/uploads\/2018\/03\/xcode-1.png 1440w, http:\/\/sezeromer.com\/wp-content\/uploads\/2018\/03\/xcode-1-300x166.png 300w, http:\/\/sezeromer.com\/wp-content\/uploads\/2018\/03\/xcode-1-768x426.png 768w, http:\/\/sezeromer.com\/wp-content\/uploads\/2018\/03\/xcode-1-1024x568.png 1024w\" alt=\"\" width=\"1440\" height=\"799\" \/><\/a><\/p>\n<p>We need to assign the button and label to the class with the left mouse button while holding down the command key. When you leave it off, there is a small option screen. This screen has a <strong>connection<\/strong> option. There are outlet and action options here. The difference is that when we select the outlet we change the controller&#8217;s physical properties. If Action is an event, we will write it. So when I click on the label or touch the button, I write. I&#8217;m going to change the text on the label when the button is touched. So I choose the label as outlet. Button is the action. Name is the name we will give.<\/p>\n<p><a href=\"http:\/\/sezeromer.com\/swift-outlet-ve-action\/xcode-3\/\" rel=\"attachment wp-att-1068\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1068\" src=\"http:\/\/sezeromer.com\/wp-content\/uploads\/2018\/03\/xcode-3.png\" sizes=\"(max-width: 1440px) 100vw, 1440px\" srcset=\"http:\/\/sezeromer.com\/wp-content\/uploads\/2018\/03\/xcode-3.png 1440w, http:\/\/sezeromer.com\/wp-content\/uploads\/2018\/03\/xcode-3-300x188.png 300w, http:\/\/sezeromer.com\/wp-content\/uploads\/2018\/03\/xcode-3-768x480.png 768w, http:\/\/sezeromer.com\/wp-content\/uploads\/2018\/03\/xcode-3-1024x640.png 1024w\" alt=\"\" width=\"1440\" height=\"900\" \/><\/a><\/p>\n<p>When we place the controller here, we come to the button click function and when we click on the button we change the text property of the label that we give the name.<\/p>\n<p><a href=\"http:\/\/sezeromer.com\/swift-outlet-ve-action\/xcode-4\/\" rel=\"attachment wp-att-1069\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1069\" src=\"http:\/\/sezeromer.com\/wp-content\/uploads\/2018\/03\/xcode-4.png\" sizes=\"(max-width: 1440px) 100vw, 1440px\" srcset=\"http:\/\/sezeromer.com\/wp-content\/uploads\/2018\/03\/xcode-4.png 1440w, http:\/\/sezeromer.com\/wp-content\/uploads\/2018\/03\/xcode-4-300x166.png 300w, http:\/\/sezeromer.com\/wp-content\/uploads\/2018\/03\/xcode-4-768x426.png 768w, http:\/\/sezeromer.com\/wp-content\/uploads\/2018\/03\/xcode-4-1024x568.png 1024w\" alt=\"\" width=\"1440\" height=\"799\" \/><\/a><\/p>\n<p>In fact, we can summarize the difference between outlet and action. If you have any questions, you can reach us by email or comment.<\/p>","protected":false},"excerpt":{"rendered":"<p>Hello. In this article I will talk about outlet and action differences for friends who have just started Swift. Actually, this difference is so simple that sometimes it can get us in trouble. Some friends may not even know where these preferences come from. I will tell from the beginning. First you need to open [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1070,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[327],"tags":[346,115,7,347,329,328],"class_list":["post-1065","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-swift","tag-action","tag-ios","tag-omer-sezer","tag-outlet","tag-programming","tag-swift"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/sezeromer.com\/en\/wp-json\/wp\/v2\/posts\/1065"}],"collection":[{"href":"https:\/\/sezeromer.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sezeromer.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sezeromer.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sezeromer.com\/en\/wp-json\/wp\/v2\/comments?post=1065"}],"version-history":[{"count":3,"href":"https:\/\/sezeromer.com\/en\/wp-json\/wp\/v2\/posts\/1065\/revisions"}],"predecessor-version":[{"id":1075,"href":"https:\/\/sezeromer.com\/en\/wp-json\/wp\/v2\/posts\/1065\/revisions\/1075"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/sezeromer.com\/en\/wp-json\/wp\/v2\/media\/1070"}],"wp:attachment":[{"href":"https:\/\/sezeromer.com\/en\/wp-json\/wp\/v2\/media?parent=1065"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sezeromer.com\/en\/wp-json\/wp\/v2\/categories?post=1065"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sezeromer.com\/en\/wp-json\/wp\/v2\/tags?post=1065"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}