{"id":2304,"date":"2022-07-08T16:31:27","date_gmt":"2022-07-08T16:31:27","guid":{"rendered":"https:\/\/sezeromer.com\/?p=2304"},"modified":"2023-03-04T14:44:04","modified_gmt":"2023-03-04T11:44:04","slug":"open-public-internal-private","status":"publish","type":"post","link":"https:\/\/sezeromer.com\/en\/open-public-internal-private\/","title":{"rendered":"Open &#8211; Public &#8211; Internal &#8211; Private (Access Levels)"},"content":{"rendered":"<p>Hello friends, in this article, we can use Swift to create variables, functions, classes, extensions, etc. We will talk about the Access Levels part that we use when creating structures. In every programming language, we need to pay attention to the access level when creating variables. As you know, this is very important when we work as a team or for people who will continue the project after us. For this, Swift offers us 5 different access levels. These;<\/p>\r\n<ul>\r\n<li>Open<\/li>\r\n<li>Public<\/li>\r\n<li>Internal<\/li>\r\n<li>Private<\/li>\r\n<li>File-private<\/li>\r\n<\/ul>\r\n<h3><strong>Open<\/strong><\/h3>\r\n<p>Variables created with the open access type can be used in the same module or in other modules. You can inherit or override classes created with Open in other modules.<\/p>\r\n<h3><strong>Public<\/strong><\/h3>\r\n<p>It is similar to Open. The only difference is that you cannot inherit or override in different modules.<\/p>\r\n<h3><strong>Internal<\/strong><\/h3>\r\n<p>If you have not created a variable with Swift and set an access level, Internal is defined by default. You can use variables defined as internal in the same module, but you cannot access them from different modules.<\/p>\r\n<h3><strong>Private<\/strong>\u00a0<\/h3>\r\n<p>You can use variables or functions defined with Private only in the class they are in or in inherited classes.<\/p>\r\n<h3><strong>File-private<\/strong><\/h3>\r\n<p>Variables defined as file private can only be used in the defined file. Even if it is inherited or an extension is attempted, it cannot be accessed when it is in a different file.<\/p>\r\n<p>More information can be found <a href=\"https:\/\/docs.swift.org\/swift-book\/LanguageGuide\/AccessControl.html\">here<\/a>. You can find my other articles about Swift <a href=\"https:\/\/sezeromer.com\/swift\/\">here<\/a>.<\/p>\r\n<p>If you have questions, you can reach us by sending an e-mail or comment. Good work.<\/p>","protected":false},"excerpt":{"rendered":"<p>Hello friends, in this article, we can use Swift to create variables, functions, classes, extensions, etc. We will talk about the Access Levels part that we use when creating structures. In every programming language, we need to pay attention to the access level when creating variables. As you know, this is very important when we [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1706,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[327,706],"tags":[908,910,390,916,915,913,909,8,912,914,680,911,440,328,707],"class_list":["post-2304","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-swift","category-swiftui","tag-access","tag-erisim","tag-file","tag-file-private","tag-fileprivate","tag-internal","tag-levels","tag-omer","tag-open","tag-private","tag-public","tag-serviyeleri","tag-sezer","tag-swift","tag-swiftui"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/sezeromer.com\/en\/wp-json\/wp\/v2\/posts\/2304"}],"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=2304"}],"version-history":[{"count":4,"href":"https:\/\/sezeromer.com\/en\/wp-json\/wp\/v2\/posts\/2304\/revisions"}],"predecessor-version":[{"id":2348,"href":"https:\/\/sezeromer.com\/en\/wp-json\/wp\/v2\/posts\/2304\/revisions\/2348"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/sezeromer.com\/en\/wp-json\/wp\/v2\/media\/1706"}],"wp:attachment":[{"href":"https:\/\/sezeromer.com\/en\/wp-json\/wp\/v2\/media?parent=2304"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sezeromer.com\/en\/wp-json\/wp\/v2\/categories?post=2304"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sezeromer.com\/en\/wp-json\/wp\/v2\/tags?post=2304"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}