{"id":1212,"date":"2018-05-06T16:52:31","date_gmt":"2018-05-06T16:52:31","guid":{"rendered":"http:\/\/sezeromer.com\/?p=1212"},"modified":"2023-02-26T23:35:43","modified_gmt":"2023-02-26T20:35:43","slug":"swift-pin-olusturmak","status":"publish","type":"post","link":"https:\/\/sezeromer.com\/en\/swift-pin-olusturmak\/","title":{"rendered":"Swift Creating Pin"},"content":{"rendered":"<p>Hello friends. In this article, I will talk about an activity that we will frequently use in mappings. I&#8217;m talking about making pins. In order to show a place in the maps we need to indicate a symbol on it. We call it pin. We showed how we were going to be in <strong>Xamarin<\/strong>. In this article I will talk about how to create with <strong>Swift<\/strong>.<\/p>\n<p>First we need to specify the position of the pin we will create. I am creating a variable of type <strong>CLLocationCoordiante2D<\/strong>. This variable takes 2 variables, X and Y position. Thus, we have created the position of the <strong>pin<\/strong>.<\/p>\n<div class=\"wp-block-codemirror-blocks code-block \">\n<pre class=\"CodeMirror\" data-setting=\"{&quot;mode&quot;:&quot;swift&quot;,&quot;mime&quot;:&quot;text\/x-swift&quot;,&quot;theme&quot;:&quot;default&quot;,&quot;lineNumbers&quot;:true,&quot;lineWrapping&quot;:false,&quot;styleActiveLine&quot;:true,&quot;readOnly&quot;:true,&quot;align&quot;:&quot;&quot;}\">let ilkKonum:CLLocationCoordinate2D = CLLocationCoordinate2D(latitude: 40.773074, longitude: 30.394817)<\/pre>\n<\/div>\n<p>After you specify the pin position, we need to create the pin. We do this with the <strong>MKPointAnnotation<\/strong> () function. We then assign the coordinates that we have formed to these pinin coordinate properties. Then we add a pine cap. This head will appear under the pin in a big way. We then make a subtitle assignment to display more information. The last thing we do is add this map to the map with the <strong>addAnnotation<\/strong> () function.<\/p>\n<div class=\"wp-block-codemirror-blocks code-block \">\n<pre class=\"CodeMirror\" data-setting=\"{&quot;mode&quot;:&quot;swift&quot;,&quot;mime&quot;:&quot;text\/x-swift&quot;,&quot;theme&quot;:&quot;default&quot;,&quot;lineNumbers&quot;:true,&quot;lineWrapping&quot;:false,&quot;styleActiveLine&quot;:true,&quot;readOnly&quot;:true,&quot;align&quot;:&quot;&quot;}\">let pinSakarya= MKPointAnnotation()\r\n        \/\/ a\u00e7\u0131klamaya kordinat ekliyoruz\r\n        pinSakarya.coordinate = ilkKonum\r\n        pinSakarya.title = \"Sakarya Merkez\"\r\n        pinSakarya.subtitle = \"Adapazar\u0131n\u0131n ortas\u0131\"\r\n        self.harita.addAnnotation(pinSakarya)<\/pre>\n<\/div>\n<p>The pin looks like the photo below on the map.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1213\" src=\"http:\/\/sezeromer.com\/wp-content\/uploads\/2018\/04\/harita-4.png\" sizes=\"(max-width: 364px) 100vw, 364px\" srcset=\"http:\/\/sezeromer.com\/wp-content\/uploads\/2018\/04\/harita-4.png 364w, http:\/\/sezeromer.com\/wp-content\/uploads\/2018\/04\/harita-4-184x300.png 184w\" alt=\"\" width=\"364\" height=\"595\" \/><\/p>\n<p>When you click Pine, the icon size is growing and the subtitle appears.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1214\" src=\"http:\/\/sezeromer.com\/wp-content\/uploads\/2018\/04\/harita-5.png\" sizes=\"(max-width: 364px) 100vw, 364px\" srcset=\"http:\/\/sezeromer.com\/wp-content\/uploads\/2018\/04\/harita-5.png 364w, http:\/\/sezeromer.com\/wp-content\/uploads\/2018\/04\/harita-5-184x300.png 184w\" alt=\"\" width=\"364\" height=\"595\" \/><\/p>\n<p>If you have any questions, you can reach us by email or comment.<\/p>","protected":false},"excerpt":{"rendered":"<p>Hello friends. In this article, I will talk about an activity that we will frequently use in mappings. I&#8217;m talking about making pins. In order to show a place in the maps we need to indicate a symbol on it. We call it pin. We showed how we were going to be in Xamarin. In [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1219,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[327],"tags":[451,452,447,172,294,446,420,450,8,445,440,448,449],"class_list":["post-1212","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-swift","tag-addannotation","tag-cllocationcoordiante2d","tag-coordinate","tag-harita","tag-konum","tag-koordinat","tag-maps","tag-mkpointannotation","tag-omer","tag-pin","tag-sezer","tag-x","tag-y"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/sezeromer.com\/en\/wp-json\/wp\/v2\/posts\/1212"}],"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=1212"}],"version-history":[{"count":3,"href":"https:\/\/sezeromer.com\/en\/wp-json\/wp\/v2\/posts\/1212\/revisions"}],"predecessor-version":[{"id":2591,"href":"https:\/\/sezeromer.com\/en\/wp-json\/wp\/v2\/posts\/1212\/revisions\/2591"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/sezeromer.com\/en\/wp-json\/wp\/v2\/media\/1219"}],"wp:attachment":[{"href":"https:\/\/sezeromer.com\/en\/wp-json\/wp\/v2\/media?parent=1212"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sezeromer.com\/en\/wp-json\/wp\/v2\/categories?post=1212"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sezeromer.com\/en\/wp-json\/wp\/v2\/tags?post=1212"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}