<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by alicanbatur on Medium]]></title>
        <description><![CDATA[Stories by alicanbatur on Medium]]></description>
        <link>https://medium.com/@alicanbatur?source=rss-551323d31445------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*eMhSVV471xaXwckeN0z3Fw.png</url>
            <title>Stories by alicanbatur on Medium</title>
            <link>https://medium.com/@alicanbatur?source=rss-551323d31445------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 15 Nov 2026 16:36:32 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@alicanbatur/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Live Activities is Beta!]]></title>
            <link>https://medium.com/@alicanbatur/live-activities-is-live-5e5c3c03195a?source=rss-551323d31445------2</link>
            <guid isPermaLink="false">https://medium.com/p/5e5c3c03195a</guid>
            <category><![CDATA[ios-16]]></category>
            <category><![CDATA[lock-screen]]></category>
            <category><![CDATA[live-activities]]></category>
            <category><![CDATA[wwdc22]]></category>
            <category><![CDATA[ios-16-beta]]></category>
            <dc:creator><![CDATA[alicanbatur]]></dc:creator>
            <pubDate>Sun, 31 Jul 2022 10:30:38 GMT</pubDate>
            <atom:updated>2022-08-02T08:55:14.158Z</atom:updated>
            <content:encoded><![CDATA[<p>Hello iOS community!</p><p>At #WWDC22, Apple announced this new feature and I already gave information about it and it’s details are in the previous article here: <a href="https://blog.appcircle.io/article/live-activities-in-ios16"><strong>Live Activities in iOS16</strong></a></p><p>Apple announced the updates which contains details of this great feature yesterday(07.27.2022) and let’s focus on the details, together, as promised :)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*fFpoXcX9fZkTpQ0V" /><figcaption>Photo by <a href="https://unsplash.com/@caudatecoder?utm_source=medium&amp;utm_medium=referral">Alexey Suslyakov</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>I will put whole project link at github at the end of the article.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V4dhCnkjpxUyKHQwjST6wA.png" /></figure><h3>Prerequisites</h3><ul><li><strong>Xcode 14 beta 4</strong>: <a href="https://developer.apple.com/services-account/download?path=/Developer_Tools/Xcode_14_beta_4/Xcode_14_beta_4.xip">Download Xcode 14 beta (6.97 GB)</a></li><li>Beta 4 of iOS 16</li></ul><h3>Let’s create an app</h3><p>I prepared this process for you starting with figma. I designed a new view for the Live Activity that we will use. Example project will be about the CI CD pipelines that we have on <a href="https://www.appcircle.io/">AppCircle</a>. Appcircle is an easy-to-setup <strong>mobile</strong> <strong>CI/CD platform</strong> with testing and store deployment which I like most. So, instead of doing same food delivery application, having another perspective for this feature will be better, I think.</p><p>Think about the processes of ours on the AppCircle. When a state of a pipeline was changed, we want to let user know about it with giving build id.</p><p>You can check the design freely <a href="https://www.figma.com/file/9N3HLPTD8OvZothdAolH7h/Live-Activity-Tut?node-id=0%3A1">here</a>. And a sneak peak from the design which is about the states that we will display.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*R8MroINqudACKcwM5IxqzA.png" /></figure><h4>To see whole blog post, you can check it on <a href="https://blog.appcircle.io/article/live-activities-in-ios16">AppCircle</a></h4><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5e5c3c03195a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[12 new features that will make things more practical in Xcode14!]]></title>
            <link>https://medium.com/@alicanbatur/12-new-features-that-will-make-things-more-practical-in-xcode14-de0770e8f019?source=rss-551323d31445------2</link>
            <guid isPermaLink="false">https://medium.com/p/de0770e8f019</guid>
            <category><![CDATA[wwdc22]]></category>
            <category><![CDATA[xcode-14]]></category>
            <dc:creator><![CDATA[alicanbatur]]></dc:creator>
            <pubDate>Thu, 23 Jun 2022 13:17:02 GMT</pubDate>
            <atom:updated>2022-06-23T13:17:02.857Z</atom:updated>
            <content:encoded><![CDATA[<p>Hello fellow iOS developers,</p><p>I prepared a recap for you about Xcode updates newly announced at #WWDC22.</p><p>I love practical improvements and this year there are several improvements for us which will speed up the development and quality so that I wrote this article in the practical improvements perspective.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*9aNNVoMoTIY9A7DE" /><figcaption>Photo by <a href="https://unsplash.com/@tma?utm_source=medium&amp;utm_medium=referral">Tianyi Ma</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>This content does not contain updates on Swift, SwiftUI and other stuff. If you are here to check them, I will kindly ask you to check these links of my friends below:</p><ul><li><a href="https://appcircle.io/blog/whats-new-in-swift-5-7-wwdc-22/">What’s new on Swift</a>?</li><li><a href="https://appcircle.io/blog/whats-new-in-uikit-at-ios-16-wwdc22/">What’s new on UIKit</a>?</li><li><a href="https://appcircle.io/blog/what-is-new-in-swiftui-wwdc-2022/">What’s new on SwiftUI</a></li></ul><h3>AppIcon 🎉</h3><p><strong>Then</strong>; As I an iOS developer, when I create a new application for the whole users, I still prefer to use <a href="https://makeappicon.com/"><strong>https://makeappicon.com</strong></a> . Thanks to the team because it helped me a lot for the last 5 years. It’s logic is to upload an image of your logo with 1024x1024 size and it sends the all images for iOS and Android icons in to my e-mail. There are also another plugins on Figma to cover this needs.</p><p><strong>Now</strong>; I am sorry to drop using this tool because Apple announced brand new support on Xcode. All you need to do is to add 1024x1024 file in Xcode and select Single Size under Devices at AppIcon. That’s all:)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*0KM37BZBpgre7b7iGnCNKw.gif" /></figure><h3>Source Editor Updates</h3><h4>Pinning Code Structure in the source editor</h4><p><strong>Then</strong>; while I develop some new cool features or fixing a bug I was using scroll up and down to get where I was at.</p><p><strong>Now</strong>; Apple added a new feature called Code Structure on the editor which shows you directly where you are as a scope. Great, right? Simple but sharp. Also you can enable it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*x-f3mU5TmYu9gJDlcrCE5g.gif" /></figure><blockquote>To toggle this behavior, use “Show: Code structure while scrolling” in Xcode’s Text Editing preferences.</blockquote><h4>To read more, you can visit original post on <a href="https://appcircle.io/blog/whats-new-in-xcode-14-wwdc22/">AppCircle!</a></h4><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=de0770e8f019" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Fastlane + Firebase + iOS 11 ve ilklerin heyecanı]]></title>
            <link>https://medium.com/@alicanbatur/fastlane-firebase-ios-11-ve-ilklerin-heyecan%C4%B1-63c6d5e12e00?source=rss-551323d31445------2</link>
            <guid isPermaLink="false">https://medium.com/p/63c6d5e12e00</guid>
            <category><![CDATA[nsistanbul]]></category>
            <category><![CDATA[devnot]]></category>
            <category><![CDATA[gdgtekirdag]]></category>
            <dc:creator><![CDATA[alicanbatur]]></dc:creator>
            <pubDate>Tue, 12 Dec 2017 15:27:41 GMT</pubDate>
            <atom:updated>2017-12-12T15:27:41.009Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jnFMivk12dm15bVcIKuNdA.jpeg" /><figcaption>by <a href="https://unsplash.com/@clarktibbs">@clarktibbs</a></figcaption></figure><p>Merhabalar,</p><p>Son iki haftam, hayatıma güzel anılar bırakan, daha önceden yapmadığım/yapamadığım farklı etkinliklerde bulunduğum verimli bir süreç olarak yerini aldı. Her şey <a href="https://medium.com/u/3344ee478619">ahmet yalcinkaya</a>’nın bir gün bana gelip, “Kanka bir etkinlikte konuşmacı olarak yer almak ister misin?” demesiyle başlamıştı :) İlk başta heyecandan ne diyeceğimi bilemedim ama kısa süre sonra da neden olmasın diyerekten ilk kez konuşmacı olma şansını yakalamış oldum.</p><p>Bahsi geçen konuşma, sevgili <a href="https://medium.com/u/8ef77afcd658">Uğur Umutluoğlu</a> ‘nun düzenlediği <strong>“devnot mobile day”</strong> etkinliğiydi. O gün için etkinliğe yaklaşık 1 aydan fazla süre vardı. Bu etkinliğe katılma kararımın gazıyla gerek kendisi gerek içindeki güzel insanları pek sevdiğim <strong>NSIstanbul</strong>’da da yapılacak olan teknik sunum için de yerimi ayırttırdım. O da yetmez gibi bir de çok güzel gençlerin zamanlarından, hayatlarından feragat ederek organize ettikleri <strong>GDGTekirdağ</strong> etkinliği için de <strong>“cfp” </strong>ımı doldurdum ve orası için de konuşmacı olarak rezervasyonumu yaptırmış oldum :)</p><p>Daha öncesinde şirket içinde kendi aramızda yaptığımız etkinlikler dışında herhangi bir topluluk önüne çıkıp böyle bir etkinlik yapma fırsatım olmamıştı. O nedenle de yaşadığım heyecan boğazımı düğüm düğüm yapmıştı. Topluluk önünde çıkıp konuşmak için cidden bir cesaret gerekiyor. Sizi izleyen parlak parlak gözler, anlattıklarınızı dinleyen insanlar, sizden birşeyler almaya çalışan gençleri gördükten sonra da altına girdiğim bu yükün ne kadar da keyifli olduğunu öğrenmiş oldum.</p><p>İlk sunumumu NSİstanbul ile gerçekleştirdiğimiz etkinlite, Protel’in ofisinde yaptım. Orada <strong>fastlane</strong>’in ne olduğunu, ne amaçla kullandığımızı ve hangi durumlarda bizim için vazgeçilmez olabileceğini anlattım. İlgili sunumuma şuradan ulaşabilirsiniz;</p><p><a href="https://docs.google.com/presentation/d/1iktjOYMlI-Ygw4aAwSPHx9c_YrlC7P31OWp-8-czxLE/edit?usp=sharing">Fastlane+BuildConfgs@iOS</a></p><p>Sonraki etkinliğimiz ise Tekirdağ’daki GDGDevFest idi. GDG deki tüm arkadaşlara bir kez daha en içten dileklerimle teşekkür ediyorum. Cumartesi gününün tümünü de etkinliğe ayırıp gelen üniversiteli arkadaşlarımı da ayrıca tebrik ediyorum. Yollarını çizmek için şimdiden kendilerine bu tip yatırımlar yapmaları bence takdire şayan. Orada ise genel olarak <strong>firebase</strong>’i anlattım. Mobil geliştirici birinin gözünden uygulama geliştirme sürecinde bize ne faydaları olduğunu da yaşadığım deneyimler üzerinden paylaştım.</p><p><a href="https://docs.google.com/presentation/d/1oLoffQAcunKGK1N3DM56fF4b3Iasw9rDa4wlcy8Zh2Q/edit?usp=sharing">What&#39;s new, Firebase?</a></p><p>Son olarak da, devnot mobile day’de Swift 4.0 ve iOS 11 ile  ‘ın mobil dünyaya yön verebilecek ARKit, CoreML, Face ID gibi yeni teknolojilerini anlattım. O gün de gayet keyifli ve verimli geçti benim açımdan. İlgili sunumuma da burdan ulaşabilirsiniz;</p><p><a href="https://docs.google.com/presentation/d/1Zq1MWEvh97DnuyJx2mqq8Q7zG6Zh7ZYgUswH4GnwRt8/edit?usp=sharing">iOS11&amp;Swift4</a></p><p>Bir topluluğa karşı yapacağım sunumlarda hedefim, sunum bittiğinde detayları merak eden, anlattıklarımı gerçek hayatında kullanacağına dair bana geribildirimler veren arkadaşlarımın çıkmasıydı ki ne mutlu öyle de oldu :) Bir çok yeni arkadaş kazandım. Sektöre yeni girecek ya da girmiş en azından bir kaç kişiyi de doğru yönlendirme şansım olduysa daha da ne mutlu bana :)</p><p>Paylaşmak gerçekten güzel. Paylaşacağımız zaman işimizi ciddiye alıp yaptığımız araştırmalar ve hazırlıklar bizi, anlattıklarımız ise dinleyenleri geliştiriyor. Özellikle bizim kendi sektörümüzdeki bildiğini anlatmayı seven abilerimize, kardeşlerimize büyük saygı duyuyorum. Buna niyetlenip de bir türlü harekete geçemeyenleri de mutlaka sahneye davet ediyor ve sosyal mesajımı da yazımın resmi olarak kullandığım “do something great” ile vermiş oluyorum sanırım. Benim yaptığım “great” mi bilmem ama seninki olabilir…</p><p>Yazıyı beğendiyseniz alkışlayıp ve paylaşıp daha çok kişinin okumasını sağlayabilir ve beni de mutlu edersiniz :)</p><p>Sağlıkla kalın..</p><iframe src="https://cdn.embedly.com/widgets/media.html?url=https%3A%2F%2Fupscri.be%2F586b41%2F&amp;src=https%3A%2F%2Fupscri.be%2F586b41%3Fas_embed%3Dtrue&amp;type=text%2Fhtml&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;schema=upscri" width="800" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/0b8daf2f223045f408f8dd64979357d7/href">https://medium.com/media/0b8daf2f223045f408f8dd64979357d7/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=63c6d5e12e00" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Firebase Dev Summit ‘17]]></title>
            <link>https://medium.com/@alicanbatur/firebase-dev-summit-17-4aba73651c36?source=rss-551323d31445------2</link>
            <guid isPermaLink="false">https://medium.com/p/4aba73651c36</guid>
            <category><![CDATA[predictions]]></category>
            <category><![CDATA[cloud-firestore]]></category>
            <category><![CDATA[a-b-testing]]></category>
            <category><![CDATA[crashlytics]]></category>
            <category><![CDATA[firebase]]></category>
            <dc:creator><![CDATA[alicanbatur]]></dc:creator>
            <pubDate>Thu, 02 Nov 2017 07:47:44 GMT</pubDate>
            <atom:updated>2017-11-06T07:07:02.868Z</atom:updated>
            <cc:license>http://creativecommons.org/publicdomain/zero/1.0/</cc:license>
            <content:encoded><![CDATA[<p>Hi all,</p><p>I was at Firebase Dev Summit ’17. I met amazing people and Firebase team was very helpful and cheerful. Thanks for that event at Amsterdam. Btw, I had the opportunity to visit Amsterdam city which is very very beautiful. Local people were amazing. Trip was really amazing for my team except for the turbulence of the ✈️ :D</p><p>We planned our trip for 4 days which started on Saturday(28th of October) and ended at the event night. For 3 days we toured Amsterdam, drank local beers and tried local places like Omelegg, Cannibale Royal and some more. You should try them. 🍺</p><p>And let’s start to talk about the event with a real question! 😈 😇</p><h4>Will Google close Firebase?</h4><p>No. At least not, for now :D Google, please do not close it. I love it ❤️.</p><h3>So what’s new?</h3><h4>🎉 <a href="https://firebase.google.com/docs/crashlytics/">Crashlytics</a> is now a part of Firebase!</h4><blockquote>Crashlytics saves you troubleshooting time by intelligently grouping crashes and highlighting the circumstances that lead up to them.</blockquote><p>It is very useful to track your apps’ crashes just in time. It also helps the user to deploy and distribute their applications using own tool called Beta. Also, there is a page which you can inspect your app retentions, engagements and more. If you didn’t use it already, you should take a look at it. If you need any help, please let me know that I can help you. (<a href="https://twitter.com/alicanbatur"><strong>My twitter acc</strong></a>)</p><h4>🎉 <a href="https://firebase.google.com/docs/cloud-messaging/abtest-with-console">A/B Testing</a> Support!</h4><blockquote>A/B testing can help you find the optimal wording and presentation by testing message variants on selected portions of your user base.</blockquote><h4>🎉🎉 <a href="https://firebase.google.com/products/predictions/">Predictions</a>! (beta)</h4><blockquote>Firebase Predictions uses the power of <strong>Google’s machine learning</strong> to create dynamic user groups based on users’ predicted behavior.</blockquote><p>Machine Learning? Users’ predicted behaviors? Making more money? :) There is a whole new world to dive deeper.</p><p>You can also read <a href="https://medium.com/developermind/what-is-firebase-predictions-6712fcc8d34b">Candost’s post here</a> to learn more about Predictions.</p><h4>🎉 <a href="https://firebase.google.com/docs/firestore/">Cloud Firestore</a>! (beta)</h4><blockquote>Flexible, scalable database for mobile, web and server development from Firebase and Google Cloud Platform.</blockquote><p>NoSQL. The best advantage of Expressing Queries over Firebase Realtime DB!</p><ul><li><strong><em>Realtime Database</em></strong><em> is Firebase’s original database. It’s an efficient, low-latency solution for mobile apps that require synced states across clients in realtime.</em></li><li><strong><em>Cloud Firestore</em></strong><em> is Firebase’s new flagship database for mobile app development. It improves on the successes of the Realtime Database with a new, more intuitive data model. Cloud Firestore also features richer, faster queries and scales better than the Realtime Database.</em></li></ul><p>You can check differences between them, here: <a href="https://firebase.google.com/docs/firestore/rtdb-vs-firestore"><strong><em>Realtime DB vs Firestore</em></strong></a></p><h4>Conclusion</h4><p>Firebase still continues to grow with the new features they add and improving existing ones. It also offers a very successful alternative for mobile developers who do not want to write backends. I personally use it on my side projects and I am very satisfied. I also recommend it to you.</p><p>If you like my post please free to clap or to add a comment below. You can also register your e-mail to my newsletter.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fupscri.be%2F9b9306%3Fas_embed%3Dtrue&amp;url=https%3A%2F%2Fupscri.be%2F9b9306%2F&amp;image=https%3A%2F%2Fe.enpose.co%2F%3Fkey%3DdRXnS9Gplk%26w%3D700%26h%3D425%26url%3Dhttps%253A%252F%252Fupscri.be%252F9b9306%252F%253Fenpose&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=upscri" width="800" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/e7be8173897dd3691a8b37d80f3b1747/href">https://medium.com/media/e7be8173897dd3691a8b37d80f3b1747/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4aba73651c36" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Protocol Oriented Programming in Swift]]></title>
            <link>https://medium.com/nsistanbul/protocol-oriented-programming-in-swift-ad4a647daae2?source=rss-551323d31445------2</link>
            <guid isPermaLink="false">https://medium.com/p/ad4a647daae2</guid>
            <category><![CDATA[protocol-extensions]]></category>
            <category><![CDATA[protocol-oriented]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[protocol]]></category>
            <dc:creator><![CDATA[alicanbatur]]></dc:creator>
            <pubDate>Tue, 17 Oct 2017 12:38:30 GMT</pubDate>
            <atom:updated>2017-12-03T00:23:14.436Z</atom:updated>
            <cc:license>http://creativecommons.org/publicdomain/zero/1.0/</cc:license>
            <content:encoded><![CDATA[<p>Hi all,</p><p>In this article, I will talk about what actually protocol oriented programming is. Because some of my friends think that, using more protocols is protocol oriented programming :) That’s not about using more protocols, that’s a new programming paradigm that is announced at Swift 2.0.</p><h4>Protocols</h4><p>Protocols are blueprint of methods, properties, and other requirements that suit a particular task or piece of functionality. It’s an interface. A powerful feature of Swift language.</p><pre>// An example of a protocol<br>protocol TableCellProtocol {<br>    func cellButtonTapped()<br>}</pre><p>Swift checks whether the requirements of the protocol are met for the classes it implemented at compile-time. So this allows developers to find out if there are any issues or bugs in code even before running the program. Also protocols brings more abstraction than classes do in swift.</p><blockquote>“Don’t start with a class, start with a protocol.”</blockquote><h4>Tell me what Protocol Oriented Programming is</h4><p>Above, I told you what protocol is. Protocol OP is a new approach for programming which you decorate your classes, structs or enums using protocols. Swift does not support multiple inheritance, therefore problem pops out when you want to add multiple abilities to your class. Protocol OP lets you to add abilities to a class or struct or enum with protocols which supports multiple implementations.</p><h4>OOP should be enough?</h4><p>Modelling abstractions using classes relies on inheritance. Subclasses will have the ability of their super classes. A subclass can override that ability, add specific one. OOP works perfect till you need another ability from another class. There is no multiple inheritance in Swift. But protocols serve as blueprints rather than parents. A protocol models abstraction by describing what the implementation types shall implement. This is the key difference between OOP and Protocol OP. And two other pros over OOP are here:</p><ul><li>Types can conform more than one protocol. This brings perfect flexibility.</li><li>Protocols also can be extended and adopted by classes, structs and enums.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B_7lJQZsJbrSOlrs_yDJjg.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/photos/505eectW54k?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Thought Catalog</a> on <a href="https://unsplash.com/?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><h4>Talk is cheap, show me the code!</h4><p>Below, I will create a weapon protocol, <strong>NOT</strong> class.</p><pre>protocol Weapon {<br>    var name: String { get }<br>    var canFire: Bool { get }<br>    var canCut: Bool { get }<br>}<br>// You can create blueprints for vars and funcs. Creating a var in a // protocol lets your classes to conform that protocol with forcing // to define that variables. In this example, we force developer to // add name, canFire and canCut vars to weapon he/she created using // Weapon protocol</pre><p>Then, consider we have 2 types of weapons; fireable, cuttable. We will use these abilities with weapon protocol to create weapons as we want.</p><pre>protocol Fireable {<br>    var magazineSize: Int { get }<br>}</pre><pre>protocol Cuttable {<br>    var weight: Double { get }<br>    var steel: String { get }<br>}</pre><p>We created abilities and our Weapon protocol. Lets create structs using all these.</p><pre>struct LongSword: Weapon, Cuttable {<br>    let name: String<br>    let steel: String<br>    let weight = 7.2<br>    let canFire = false<br>    let canCut = true<br>}<br>// longsword is a weapon with ability to cut.</pre><pre>struct AK47: Weapon, Fireable {<br>    let name = &quot;AK47&quot;<br>    let magazineSize = 30<br>    let canFire = true<br>    let canCut = false<br>}<br>// ak47 is also a weapon with ability to fire bullets.</pre><p>As you can see above, we decorated our structs using protocols. Protocols force us to conform to them and also we add the ability we want. But a problem occurred above which is about holding canFire and canCut abilities at our custom structs. What can we do to fix this? Answer is <strong>Protocol Extension</strong> :)</p><pre>extension Weapon {<br>    var canFire: Bool { return self is Fireable }<br>    var canCut: Bool { return self is Cuttable }<br>}</pre><p>Then, please remove all canFire and canCut variables from AK47, Longsword and Weapon Protocol. Using <strong>“return self is Fireable” </strong>saves us from setting another instance var and make our protocols flexible to use via protocol extensions.</p><p>And please add these to your playground to see how that works:</p><pre>let longclaw = LongSword(name: &quot;Longclaw&quot;, steel: &quot;Valyrian&quot;)<br>longclaw.canCut // true<br>longclaw.canFire // false<br>longclaw.name</pre><pre>let ak47 = AK47()<br>ak47.canFire  // true <br>ak47.canCut // false</pre><h4>What? Extending Protocols? Inheritance?</h4><p>Yip yip. Protocols are extendable. Lets see it in an example:</p><pre>// I extend Bombable protocol from Fireable. With this new protocol, // I wanted to add maxDistance feature.<br>protocol Bombable: Fireable {<br>    var maxDistance: Double { get }<br>}</pre><pre>// Then I create brand new Weapon, Howitzer<br>struct Howitzer: Weapon, Bombable {<br>    let name = &quot;Howitzer&quot;<br>    let magazineSize = 1<br>    let maxDistance = 1000 // in km<br>}<br>// So this extensibility made my code base more flexible. Consider, // I do not want maxDistance in Fireable but Bombable.</pre><h4>Conclusion</h4><blockquote>Many object-oriented programming languages are plagued with limitations surrounding the resolution of ambiguous extension definitions. Swift handles this quite elegantly through protocol extensions by allowing the programmer to take control where the compiler falls short.</blockquote><p>Swift lets me to my apps using OOP, Protocol OP, Functional Programming. I think, this is the reason why most people love it and also hate it :) Because swift opens up so much space which prevents you from creating a coding standard. However, on the contrary, I am very pleased with swift because of these features offered by it.</p><p>Thanks for reading, feel free to comment. :)</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fupscri.be%2F9b9306%3Fas_embed%3Dtrue&amp;url=https%3A%2F%2Fupscri.be%2F9b9306%2F&amp;image=https%3A%2F%2Fe.enpose.co%2F%3Fkey%3DdRXnS9Gplk%26w%3D700%26h%3D425%26url%3Dhttps%253A%252F%252Fupscri.be%252F9b9306%252F%253Fenpose&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=upscri" width="800" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/e7be8173897dd3691a8b37d80f3b1747/href">https://medium.com/media/e7be8173897dd3691a8b37d80f3b1747/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ad4a647daae2" width="1" height="1" alt=""><hr><p><a href="https://medium.com/nsistanbul/protocol-oriented-programming-in-swift-ad4a647daae2">Protocol Oriented Programming in Swift</a> was originally published in <a href="https://medium.com/nsistanbul">NSIstanbul</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Data serialization formats available in Swift]]></title>
            <link>https://medium.com/nsistanbul/data-serialization-formats-available-in-swift-d0dc2971dbda?source=rss-551323d31445------2</link>
            <guid isPermaLink="false">https://medium.com/p/d0dc2971dbda</guid>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[json]]></category>
            <category><![CDATA[serializing]]></category>
            <category><![CDATA[protobuf]]></category>
            <dc:creator><![CDATA[alicanbatur]]></dc:creator>
            <pubDate>Tue, 10 Oct 2017 10:42:18 GMT</pubDate>
            <atom:updated>2017-12-03T00:21:53.982Z</atom:updated>
            <content:encoded><![CDATA[<p>Hi all,</p><p>In this article, I want to show you there are many alternative ways of JSON serialization. They all have pros and cons but at least you should know a little about them.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f7OPu8ovIdixSErpgbEeiQ.jpeg" /><figcaption>by <a href="https://unsplash.com/@timmccartney">@timmccartney</a></figcaption></figure><h4>What is serialization?</h4><p><em>“In </em><a href="https://en.0wikipedia.org/index.php?q=aHR0cHM6Ly9lbi53aWtpcGVkaWEub3JnL3dpa2kvQ29tcHV0ZXJfc2NpZW5jZQ"><em>computer science</em></a><em>, in the context of data storage, </em><strong><em>serialization</em></strong><em> is the process of translating </em><a href="https://en.0wikipedia.org/index.php?q=aHR0cHM6Ly9lbi53aWtpcGVkaWEub3JnL3dpa2kvRGF0YV9zdHJ1Y3R1cmU"><em>data structures</em></a><em> or </em><a href="https://en.0wikipedia.org/index.php?q=aHR0cHM6Ly9lbi53aWtpcGVkaWEub3JnL3dpa2kvT2JqZWN0Xyhjb21wdXRlcl9zY2llbmNlKQ"><em>object</em></a><em> state into a format that can be stored or transmitted and reconstructed later.” </em>There is also a <strong>deserialization</strong> concept which is reversing serialized data to our custom objects. I already wrote an <a href="https://medium.com/@alicanbatur/object-mapping-in-swift-d9cd7ecd47dd">article</a> about it.</p><h4>Where do we use serialization?</h4><ul><li>Transferring data over the wire.</li><li>Storing data.</li><li>Remote procedure calls. (RPC)</li></ul><p><strong>JSON</strong>, <strong>XML</strong>, <strong>protobuf</strong>, <strong>YAML</strong>, <strong>BSON</strong>, <strong>MessagePack</strong> are examples for data serialization. I guess most known ones are JSON and XML in mobile application development. Most preferred using JSON than XML because JSON is more readable with less size.</p><p><strong>JSON</strong> (JavaScript Object Notation): Its being readable for human and easy to parse and generate by machines is the reason why it is choosen most. But in my opinion, readable response formats is very important to check data types and that makes JSON one step closer. Swift has got lots of 3rd party libraries for serializing&amp;deserializing JSON. You can check them <a href="https://github.com/vsouza/awesome-ios#json">here</a>. And also in <a href="https://medium.com/@alicanbatur/object-mapping-in-swift-d9cd7ecd47dd">my previous article</a> you can see some of examples of them.</p><pre>// Simple JSON format example<br>{<br>    &quot;name&quot;: &quot;Ali Can&quot;<br>    &quot;surname&quot;: &quot;Batur&quot;<br>    &quot;age&quot;: 29<br>}</pre><p><strong>XML</strong> (eXtensible Markup Language): Defines a set of rules for encoding documents in a format that is both human-readable and machine-readable. XML’s being illegible and complex, causes it less preferred. Also parsing it needs more effort than JSON and some others. You can find 3rd party parsers <a href="https://github.com/vsouza/awesome-ios#xml--html">here</a>. Also there is SDK (foundation) support for this <a href="https://developer.apple.com/documentation/foundation/xmlparser">here</a>.</p><pre>&lt;person&gt;<br>  &lt;name&gt;Ali Can&lt;/name&gt;<br>  &lt;surname&gt;Batur&lt;/surname&gt;<br>  &lt;age&gt;29&lt;/age&gt;<br>&lt;/person&gt;</pre><p><strong>protobuf</strong> (Google’s Protocol Buffers): “<em>Protocol buffers are a flexible, efficient, automated mechanism for serializing structured data. You define how you want your data to be structured once, then you can use special generated source code to easily write and read your structured data to and from a variety of data streams and using a variety of languages. You can even update your data structure without breaking deployed programs that are compiled against the “old” format.” </em>says <a href="https://developers.google.com/protocol-buffers/docs/overview">Google</a>. I think in the future, we will not need to write response model objects. One file for both API and client would be enough. Also  itself supports this technology <a href="https://github.com/apple/swift-protobuf">here</a>. I want to write a blog post just about protobufs. Let me hear your opinions about protobuf, pls :)</p><pre>// Example content for an .proto file.<br>message Person {<br>   int32 age = 1;<br>   string name = 2;<br>   string surname = 3;<br>}</pre><p><strong>YAML</strong> (YAML Ain’t Markup Language) : YAML is a readable data serialization standard for all programming languages. No need for brackets nor quotes. Syntax supports relational data. Especially used for viewing / editing of data structures: such as configuration files, dumping during debugging. <a href="https://github.com/behrang/YamlSwift">Here</a> a YAML framework is.</p><pre>- name: Ali Can<br>  surname: Batur<br>  age: 29<br>  devices: <br>    - iPhone 7<br>    - Apple Watch Series 2<br>    - Macbook Pro</pre><p><strong>BSON</strong> (Binary JSON) : It’s a bin­ary-en­coded seri­al­iz­a­tion of JSON-like doc­u­ments. It also con­tains ex­ten­sions that al­low rep­res­ent­a­tion of data types that are not part of the JSON spec. JSON is a plain text format, and while binary data can be encoded in text, this has certain limitations and can make JSON files very big. BSON comes in to deal with these problems. You can find a library <a href="https://github.com/OpenKitten/BSON">here</a>.</p><p><strong>MessagePack: </strong>It’s like JSON but fast and small.<strong> </strong>It’s another binary format serialization. It’s smaller than BSON, supports type-checking(static type). You can find a lib <a href="https://github.com/a2/MessagePack.swift">here</a>.</p><h4>Conclusion</h4><p>In real life examples, JSON is the most choosen one for mobile app development to handle request-response data transfers. I also use JSON for all my projects, because it is being readable speeds up things I do. Other serializing formats are useful where they fits most. As an example, use YAML for your configuration file types. Althought JSON is very handy, I wonder protobuf most. I guess, it will give client-server architecture a new perspective. Btw, protobuf is not new, but I think it will be popular day-by-day.</p><p>Thanks for reading, feel free to comment.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fupscri.be%2F9b9306%3Fas_embed%3Dtrue&amp;url=https%3A%2F%2Fupscri.be%2F9b9306%2F&amp;image=https%3A%2F%2Fe.enpose.co%2F%3Fkey%3DdRXnS9Gplk%26w%3D700%26h%3D425%26url%3Dhttps%253A%252F%252Fupscri.be%252F9b9306%252F%253Fenpose&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=upscri" width="800" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/e7be8173897dd3691a8b37d80f3b1747/href">https://medium.com/media/e7be8173897dd3691a8b37d80f3b1747/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d0dc2971dbda" width="1" height="1" alt=""><hr><p><a href="https://medium.com/nsistanbul/data-serialization-formats-available-in-swift-d0dc2971dbda">Data serialization formats available in Swift</a> was originally published in <a href="https://medium.com/nsistanbul">NSIstanbul</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Object Mapping in Swift]]></title>
            <link>https://medium.com/nsistanbul/object-mapping-in-swift-d9cd7ecd47dd?source=rss-551323d31445------2</link>
            <guid isPermaLink="false">https://medium.com/p/d9cd7ecd47dd</guid>
            <category><![CDATA[mapping]]></category>
            <category><![CDATA[objectmapper]]></category>
            <category><![CDATA[data-conversion]]></category>
            <category><![CDATA[json]]></category>
            <category><![CDATA[swift]]></category>
            <dc:creator><![CDATA[alicanbatur]]></dc:creator>
            <pubDate>Tue, 03 Oct 2017 10:55:26 GMT</pubDate>
            <atom:updated>2017-12-03T00:20:37.448Z</atom:updated>
            <content:encoded><![CDATA[<p>Hi all,</p><p>In this article, we will learn what object mapping is and importance of it. Then we will compare different ways of mapping an object in Swift.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ak94Xh5LGvl2TgtnXPQQhQ.jpeg" /><figcaption>by <a href="https://unsplash.com/@mumolabs">Rayi Christian Wicaksono</a></figcaption></figure><h3>What is mapping?</h3><p>“<em>an operation that associates each element of a given set (the domain) with one or more elements of a second set (the range).</em>” in terminology.</p><h4>Where should we use mapping in real life?</h4><p>Usually, when the request is completed, we receive the data in various formats. I choose JSON in examples below. These data formats should be converted to our models in our app. So that we will be able to use them as we want and in accordance with OOP. And those custom classes will let you code your model businesses in your custom classes.</p><h4>Converting JSON to custom objects is necessary?</h4><p>Yeap! Otherwise, you need to use them as dictionary, or some other data type. Which will make your app non-oop :)</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0350bba6a66739e38bce35f21a74eeac/href">https://medium.com/media/0350bba6a66739e38bce35f21a74eeac/href</a></iframe><h3>Ways of mapping</h3><p>There are many ways to map your objects.</p><p>Let’s start from the worst way, the non-mapping way :)</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/28be7c6cf9b349eba978918ac1dc3ef6/href">https://medium.com/media/28be7c6cf9b349eba978918ac1dc3ef6/href</a></iframe><h4>Swift’s basic way of mapping (Swift 3):</h4><p>We have a person struct in the example above. First, we will add an init method to it.</p><pre>init(with dictionary: [String: Any]?) {<br>  guard let dictionary = dictionary else { return }<br>  name = dictionary[&quot;name&quot;] as? String<br>  surname = dictionary[&quot;surname&quot;] as? String<br>  age = dictionary[&quot;age&quot;] as? Int<br>}</pre><p>Then map your object like this:</p><pre>var data: Data = JSON.data(using: .utf8)!<br>let anyObj = try! JSONSerialization.jsonObject(with: data, options: .allowFragments)<br>let person = Person(with: anyObj!) // Maps here<br>label.text = person.name</pre><p>If you need nilsafety, change models’ optional and set a default value:</p><pre>var name: String?    ==&gt;  var name: String!<br>var surname: String? ==&gt;  var surname: String!<br>var age: Int?        ==&gt;  var age: Int!<br>...<br>name = dictionary[&quot;name&quot;] as? String ?? &quot;&quot; // default value<br>surname = dictionary[&quot;surname&quot;] as? String ?? &quot;&quot;<br>age = dictionary[&quot;age&quot;] as? Int ?? 0</pre><h4>Open source mapping tools</h4><p>Here are nearly all object mapping tool list. But I will show you some of them below. (<a href="https://github.com/vsouza/awesome-ios#json">awesome-ios#JSON</a>)</p><ul><li>tristanhimmelmans’ <a href="https://github.com/Hearst-DD/ObjectMapper">ObjectMapper</a></li></ul><pre>struct Person: Mappable {<br>    var name: String?<br>    var surname: String?<br>    var age: Int?</pre><pre>    init?(map: Map) {<br><br>    }<br><br>    mutating func mapping(map: Map) {<br>        name    &lt;- map[&quot;name&quot;]<br>        surname &lt;- map[&quot;surname&quot;]<br>        age     &lt;- map[&quot;age&quot;]         <br>    }<br>}<br>...<br>let person = Mapper&lt;Person&gt;().map(JSONString: JSONString)<br>// It also supports object to json<br>let JSONString = Mapper().toJSONString(person, prettyPrint: true)<br>// ObjectMapper also supports Alamofire(which I will write another blog about), Realm and a bunch of third parties.<br>// Mapping collections is also easy.</pre><ul><li>utahiosmac’s <a href="https://github.com/utahiosmac/Marshal">Marshal</a></li></ul><pre>struct Person: Unmarshaling {<br>    var name: String<br>    var surname: String<br>    var age: Int<br><br>    init(object: MarshaledObject) throws {<br>        name = try object.value(for: &quot;name&quot;)<br>        surname = try object.value(for: &quot;surname&quot;)<br>        age = try object.value(for: &quot;age&quot;)<br>    }<br>}<br>...<br>let people: [Person] = try json.value(for: &quot;people&quot;) // A collection example</pre><ul><li>hkellaway’s <a href="https://github.com/hkellaway/Gloss">Gloss</a></li></ul><pre>struct Person: Decodable {<br><br>    let name: String?<br>    let surname: String?<br>    let age: Int?</pre><pre>    // MARK: - Deserialization<br><br>    init?(json: JSON) {<br>        self.name = &quot;name&quot; &lt;~~ json<br>        self.surname = &quot;surname&quot; &lt;~~ json<br>        self.age = &quot;age&quot; &lt;~~ json    <br>    }<br><br>}</pre><ul><li>JohnSundell’s <a href="https://github.com/JohnSundell/Unbox">Unbox</a></li></ul><pre>struct Person {<br>    let name: String<br>    let surname: String<br>    let age: Int<br>}<br><br>extension Person: Unboxable {<br>    init(unboxer: Unboxer) throws {<br>        self.name = try unboxer.unbox(key: &quot;name&quot;)<br>        self.surname = try unboxer.unbox(key: &quot;surname&quot;)<br>        self.age = try unboxer.unbox(key: &quot;age&quot;)<br>    }<br>}<br>...<br>let person: Person = try unbox(dictionary: dictionary)</pre><p>There are many more tools that can be used. I wanted to show you some of them as an example.</p><h3>Conclusion</h3><p>Using mapping brings you benefits:</p><ul><li>Domain Model Pattern usage.</li><li>Less code</li><li>Testability</li><li>Reusability</li><li>Single Responsibility. Dividing the model business</li></ul><p>If you ask which one you are using, I will answer with ObjectMapper. Because I make my request calls with Alamofire, and ObjectMapper’s support for Alamofire is really useful. And also it supports realm objects which I choose to use for persistency. I plan to write a blog post about my service calls and mapping structure.</p><p>Please let me know if there is another really useful mapping tool you know with the benefits of it so that I can edit this post with that.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fupscri.be%2F9b9306%3Fas_embed%3Dtrue&amp;url=https%3A%2F%2Fupscri.be%2F9b9306%2F&amp;image=https%3A%2F%2Fe.enpose.co%2F%3Fkey%3DdRXnS9Gplk%26w%3D700%26h%3D425%26url%3Dhttps%253A%252F%252Fupscri.be%252F9b9306%252F%253Fenpose&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=upscri" width="800" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/e7be8173897dd3691a8b37d80f3b1747/href">https://medium.com/media/e7be8173897dd3691a8b37d80f3b1747/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d9cd7ecd47dd" width="1" height="1" alt=""><hr><p><a href="https://medium.com/nsistanbul/object-mapping-in-swift-d9cd7ecd47dd">Object Mapping in Swift</a> was originally published in <a href="https://medium.com/nsistanbul">NSIstanbul</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>