<?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 Enes Karaosman on Medium]]></title>
        <description><![CDATA[Stories by Enes Karaosman on Medium]]></description>
        <link>https://medium.com/@eneskaraosman53?source=rss-f5ccc46e308a------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*iKoUNE3aPbnoqqxT1i_UIw@2x.jpeg</url>
            <title>Stories by Enes Karaosman on Medium</title>
            <link>https://medium.com/@eneskaraosman53?source=rss-f5ccc46e308a------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 16:49:51 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@eneskaraosman53/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[Swift Makrolar]]></title>
            <link>https://medium.com/@eneskaraosman53/swift-makrolar-bdefea00a1d6?source=rss-f5ccc46e308a------2</link>
            <guid isPermaLink="false">https://medium.com/p/bdefea00a1d6</guid>
            <category><![CDATA[swift-macros]]></category>
            <category><![CDATA[swift]]></category>
            <dc:creator><![CDATA[Enes Karaosman]]></dc:creator>
            <pubDate>Sat, 07 Sep 2024 08:30:08 GMT</pubDate>
            <atom:updated>2024-09-07T08:30:08.347Z</atom:updated>
            <content:encoded><![CDATA[<blockquote><em>Derleme zamanında kod generate etmek için makroları kullanın.</em></blockquote><h3>Giriş</h3><p>Makrolar, kaynak kodunuzu derleme sırasında dönüştürerek tekrarlayan kodları elle yazma gereksinimini ortadan kaldırır. Derleme sürecinde, Swift kodunuzu normal bir şekilde derlemeden önce, kodunuzdaki tüm makroları genişletir.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/814/1*kKjvI2UqN7mV_v4VotiJWw.png" /></figure><blockquote>Bir makronun genişletilmesi her zaman ekleyici (additive) bir işlemdir: Makrolar yeni kod ekler, ancak mevcut kodu asla silmez veya değiştirmez.</blockquote><pre>func doThingy() {<br> startDoingThingy()<br> <br> #someUnknownMacro()<br> <br> finishDoingThingy()<br>}</pre><p>#someUnknownMacronun ne iş yaptığını bilmesek bile, finishDoingThingy methodunu silmeyeceğinden ya da farklı bir methoda taşımayacağından emin olabiliriz</p><blockquote># veya @ işareti yoksa makro olmadığına emin olabilirsiniz</blockquote><h3>Makro Rol ve Kategorileri</h3><pre>// Tanımlama;<br><br>@freestanding(expression)<br>public macro stringify&lt;T&gt;(_ value: T) -&gt; (T, String) = <br> #externalMacro(module: &quot;StringifyMacros&quot;, type: &quot;StringifyMacro&quot;)<br> <br>// kategori: freestanding<br>// rol: expression</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VFneGnJ2mfNyKARCpyH-tw.png" /></figure><p>Makronun rolü;</p><ul><li>Nerede kullanılabileceğini</li><li>Ne tür kod expand edileceğini</li><li>Expand edilmiş kodun nereye yerleştirileceğini belirler</li></ul><p>Kategorilere geçmeden önce, names parametresine de hızlıca değinelim;</p><pre>@attached(member, names: named(dictionary), named(init(dictionary:)))<br>macro DictionaryStorage(key: String? = nil)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7_1PAX_pEd3ZOPmUHBf_pg.png" /></figure><h4>#Freestanding</h4><p>İlk kategori, “freestanding macros” olarak adlandırılır ve sembolleri diyez işareti #dir. Bu makrolar bağımsızdır ve ürettikleri kod, tanımlandıkları yere tam olarak yerleştirilir. Bu kategoride iki rol vardır: <em>expression</em> ve <em>declaration </em>makroları.</p><ul><li><strong>#freestanding(expression)</strong></li></ul><p>Value return edebilen makrolardır</p><pre>let url = URL(&quot;http://github.com/eneskaraosman&quot;)!<br><br>// opsionelliği unwrap etmek için kullanılabilen bi makro şöyle yazılabilir;<br><br>let url = #URL(&quot;http://github.com/eneskaraosman&quot;)</pre><p>Yine default makro template’i olarak gelen #stringify makrosu da bu roldeki makroya örnektir.</p><ul><li><strong>#freestanding(declaration)</strong></li></ul><p>Bu makro, expression rolündeki makroya benzer şekilde çalışır, ancak bir type return edemez.</p><p>N boyutlu bir array modeli oluşturan, declaration rolüne sahip makroya örnek;</p><pre>/// Declares an `n`-dimensional array type named `Array&lt;n&gt;D`.<br>/// - Parameter n: The number of dimensions in the array.<br>@freestanding(declaration, names: arbitrary)<br>macro makeArrayND(n: Int)<br><br>#makeArrayND(n: 2)<br><br>// Begin expansion for &quot;#makeArrayND&quot;<br>public struct Array2D&lt;Element&gt;: Collection {<br>    public struct Index: Hashable, Comparable { var storageIndex: Int }<br>    var storage: [Element]<br>    var width1: Int<br>    public func makeIndex(_ i0: Int, _ i1: Int) -&gt; Index {<br>        Index(storageIndex: i0 * width1 + i1)<br>    }<br>    public subscript (_ i0: Int, _ i1: Int) -&gt; Element {<br>        get { self[makeIndex(i0, i1)] }<br>        set { self[makeIndex(i0, i1)] = newValue }<br>    }<br>    public subscript (_ i: Index) -&gt; Element {<br>        get { storage[i.storageIndex] }<br>        set { storage[i.storageIndex] = newValue }<br>    }<br>}<br>// End expansion for &quot;#makeArrayND&quot;</pre><h4>@Attached</h4><p>İkinci kategori, @ sembolü ile tanımlanan “attached macros” olarak bilinir. Freestanding makroların aksine, attached makroların kod üretimi için ilişkilendirilmiş bir varlığa ihtiyacı vardır, yani bitişik (attached) olmalıdır.</p><p>Bu kategoride beş farklı rol bulunur: @member, @memberAttribute, @extension, @peer ve @accessor. Bu makrolar oldukça esnektir ve method, struct, class, enum ve extension gibi geniş bir yelpazede varlıklara uygulanabilir.</p><blockquote>Makrolara birden fazla rol vermek de mümkündür.</blockquote><ul><li><strong>@attached(peer)</strong></li></ul><p>Bir peer macro, yalnızca değişkenler ve fonksiyonlar gibi deklarasyonlara değil, aynı zamanda import ve operator gibi deklarasyonlara da eklenebilir ve bu deklarasyonların yanına yeni deklarasyonlar ekleyebilir.</p><p>Biraz daha somutlaştıralım, async / await kullandığımız bir methoda closure based destek vermek için bir makro yazmak istediğimizi düşünelim;</p><pre>/// Overload an `async` function to add a variant that takes<br>/// a completion handler closure as a parameter.<br>@attached(peer, names: overloaded)<br>macro AddCompletionHandler(parameterName: String = &quot;completionHandler&quot;)<br><br>/// Fetch the avatar for the user with `username`.<br>@AddCompletionHandler(parameterName: &quot;onCompletion&quot;)<br>func fetchAvatar(_ username: String) async -&gt; Image? {<br>    ...<br>}<br><br>    // Begin expansion for &quot;@AddCompletionHandler&quot;<br><br>    /// Fetch the avatar for the user with `username`.<br>    /// Equivalent to ``fetchAvatar(username:)`` with<br>    /// a completion handler.<br>    func fetchAvatar(<br>        _ username: String,<br>        onCompletion: @escaping (Image?) -&gt; Void<br>    ) {<br>        Task.detached {<br>            onCompletion(await fetchAvatar(username))<br>        }<br>    }<br><br>    // End expansion for &quot;@AddCompletionHandler&quot;</pre><ul><li><strong>@attached(accessor)</strong></li></ul><p>Bu makrolar, değişkenlere ve subscript lere eklenebilir ve bunlara get, set, willSet veya didSet gibi accessors (erişimciler) ekleyebilirler.</p><pre>struct Person: DictionaryRepresentable {<br>    init(dictionary: [String: Any]) { self.dictionary = dictionary }<br>    var dictionary: [String: Any]<br>  <br>    var name: String {<br>        get { dictionary[&quot;name&quot;]! as! String }<br>        set { dictionary[&quot;name&quot;] = newValue }<br>    }<br>    var height: Measurement&lt;UnitLength&gt; {<br>        get { dictionary[&quot;height&quot;]! as! Measurement&lt;UnitLength&gt; }<br>        set { dictionary[&quot;height&quot;] = newValue }<br>    }<br>    var birthDate: Date? {<br>        get { dictionary[&quot;birth_date&quot;] as! Date? }<br>        set { dictionary[&quot;birth_date&quot;] = newValue as Any? }<br>    }<br>}</pre><p>Person’ın ilgili alanlarının bir dictionaryden beslendiğini görüyoruz. Bu tekrarlayan kodları accessor rolüne sahip bir makro ile düzenleyebiliriz</p><pre>/// Adds accessors to get and set the value of the specified property<br>/// in a dictionary property called `storage`.<br>@attached(accessor)<br>macro DictionaryStorage(key: String? = nil)<br><br>struct Person: DictionaryRepresentable {<br>    init(dictionary: [String: Any]) { self.dictionary = dictionary }<br>    var dictionary: [String: Any]<br>    <br>    @DictionaryStorage var name: String<br>        // Begin expansion for &quot;@DictionaryStorage&quot;<br>        {<br>            get { dictionary[&quot;name&quot;]! as! String }<br>            set { dictionary[&quot;name&quot;] = newValue }<br>        }<br>        // End expansion for &quot;@DictionaryStorage&quot;<br><br>    @DictionaryStorage var height: Measurement&lt;UnitLength&gt;<br>        // Begin expansion for &quot;@DictionaryStorage&quot;<br>        {<br>            get { dictionary[&quot;height&quot;]! as! Measurement&lt;UnitLength&gt; }<br>            set { dictionary[&quot;height&quot;] = newValue }<br>        }<br>        // End expansion for &quot;@DictionaryStorage&quot;<br><br>    @DictionaryStorage(key: &quot;birth_date&quot;) var birthDate: Date?<br>        // Begin expansion for &quot;@DictionaryStorage&quot;<br>        {<br>            get { dictionary[&quot;birth_date&quot;] as! Date? }<br>            set { dictionary[&quot;birth_date&quot;] = newValue as Any? }<br>        }<br>        // End expansion for &quot;@DictionaryStorage&quot;<br>}</pre><ul><li><strong>@attached(memberAttribute)</strong></li></ul><p>Member Attribute makroları, bir tür (type) veya extension içindeki deklarasyonlara nitelik (attribute) eklemek için tasarlanmıştır. Bu işlevsellik, kodunuzdaki property veya methodları metadata (üst veri) veya belirli derleyici yönergeleri aracılığıyla değiştirmenizi sağlar. Bu makrolar, belirli niteliklerin otomatik olarak eklenmesini sağlayarak, kodunuzun davranışını derleme zamanında etkileme yeteneği sunar.</p><pre>@attached(memberAttribute) &lt;&lt;&lt;<br>@attached(accessor)<br>macro DictionaryStorage(key: String? = nil)<br><br>@DictionaryStorage &lt;&lt;&lt;<br>struct Person: DictionaryRepresentable {<br>    init(dictionary: [String: Any]) { self.dictionary = dictionary }<br>    var dictionary: [String: Any]<br>    <br>        // Begin expansion for &quot;@DictionaryStorage&quot;<br>        @DictionaryStorage<br>        // End expansion for &quot;@DictionaryStorage&quot;<br>    var name: String<br>    <br>        // Begin expansion for &quot;@DictionaryStorage&quot;<br>        @DictionaryStorage<br>        // End expansion for &quot;@DictionaryStorage&quot;<br>    var height: Measurement&lt;UnitLength&gt;<br><br>    @DictionaryStorage(key: &quot;birth_date&quot;) var birthDate: Date?<br>}</pre><ul><li><strong>@attached(member)</strong></li></ul><p>Bir tipe method ya da property ekleyebilmemizi sağlar;</p><pre>@attached(member, names: named(dictionary), named(init(dictionary:)))<br>@attached(memberAttribute)<br>@attached(accessor)<br>macro DictionaryStorage(key: String? = nil)<br><br>// The @DictionaryStorage member macro<br><br>@DictionaryStorage struct Person: DictionaryRepresentable {<br>        // Begin expansion for &quot;@DictionaryStorage&quot;<br>        init(dictionary: [String: Any]) {<br>            self.dictionary = dictionary<br>        }<br>        var dictionary: [String: Any]<br>        // End expansion for &quot;@DictionaryStorage&quot;<br>    <br>    var name: String<br>    var height: Measurement&lt;UnitLength&gt;<br>    @DictionaryStorage(key: &quot;birth_date&quot;) var birthDate: Date?<br>}</pre><ul><li><strong>@attached(extension)</strong> (eskiden <strong>@attached(conformance)</strong> diye geçiyordu)</li></ul><p>Extension makrosu mevcut bir tipe protocol conform etmemizi sağlar</p><pre>@attached(extension) &lt;&lt;&lt;<br>@attached(member, names: named(dictionary), named(init(dictionary:)))<br>@attached(memberAttribute)<br>@attached(accessor)<br>macro DictionaryStorage(key: String? = nil)<br><br>@DictionaryStorage<br>struct Person<br>        // Begin expansion for &quot;@DictionaryStorage&quot;<br>        : DictionaryRepresentable &lt;&lt;&lt;<br>        // End expansion for &quot;@DictionaryStorage&quot;<br>{<br>    var name: String<br>    var height: Measurement&lt;UnitLength&gt;<br>    @DictionaryStorage(key: &quot;birth_date&quot;) var birthDate: Date?<br>}</pre><h3>Swift AST (Abstract Syntax Tree) nedir, nasıl debug edebiliriz?</h3><p>Abstract Syntax Tree (AST), bir programlama dilinin kaynak kodunun söz dizimsel yapısını hiyerarşik bir ağaç yapısında temsil eden veri yapısıdır. AST, derleyici tarafından kaynak kodun çeşitli aşamalarında kullanılır ve kaynak kodun soyut bir şekilde temsil edilmesini sağlar.</p><pre>#stringify(a + b)<br><br>(lldb) po node<br>MacroExpansionExprSyntax<br>├─pound: pound<br>├─macroName: identifier(&quot;stringify&quot;)<br>├─leftParen: leftParen<br>├─arguments: LabeledExprListSyntax<br>│ ╰─[0]: LabeledExprSyntax<br>│   ╰─expression: InfixOperatorExprSyntax<br>│     ├─leftOperand: DeclReferenceExprSyntax<br>│     │ ╰─baseName: identifier(&quot;a&quot;)<br>│     ├─operator: BinaryOperatorExprSyntax<br>│     │ ╰─operator: binaryOperator(&quot;+&quot;)<br>│     ╰─rightOperand: DeclReferenceExprSyntax<br>│       ╰─baseName: identifier(&quot;b&quot;)<br>├─rightParen: rightParen<br>╰─additionalTrailingClosures: MultipleTrailingClosureElementListSyntax</pre><p>Makrolar <a href="https://github.com/swiftlang/swift-syntax">https://github.com/swiftlang/swift-syntax</a> paketini kullanarak kod parse ediyor. Örnek projelerde dependency olarak eklendiğini görebiliriz.</p><p>Kendi makromuzu kodlarken syntax tree ile yakinen çalışmamız gerekiyor, peki bu tree’yi nasıl görebiliriz? Maalesef ki Xcode’u debug modda çalıştırdığımızda macro development kodlarımızdaki breakpointlerde durmuyor (compile time’da çalıştığından).</p><p>Ancak unit testleri çalıştırdığımızda breakpointleri kullanabiliyoruz. (Kod expansion o anda yapılıyor)</p><ul><li>Unit testlerde breakpointte durduğunda ilgili node’u po node ile görebiliriz</li><li>Swift kodunun yapısını çıkaran şöyle bir websitesi var, <a href="https://swift-ast-explorer.com/">https://swift-ast-explorer.com/</a></li></ul><h3>Makro Unit Testleri</h3><p>Unit testleri yine swift-syntax paketinin sunduğu imkanlar ile gerçekleştirebiliriz. Makro paketi oluşturduğumuzda varsayılan olarak gelen test kod bloğu aşağıdaki gibidir;</p><pre>import SwiftSyntax<br>import SwiftSyntaxBuilder<br>import SwiftSyntaxMacros<br>import SwiftSyntaxMacrosTestSupport<br>import XCTest<br><br>// Macro implementations build for the host, so the corresponding module is not available when cross-compiling. Cross-compiled tests may still make use of the macro itself in end-to-end tests.<br>#if canImport(StringifyMacros)<br>import StringifyMacros<br><br>let testMacros: [String: Macro.Type] = [<br>    &quot;stringify&quot;: StringifyMacro.self,<br>]<br>#endif<br><br>final class StringifyTests: XCTestCase {<br>    func testMacro() throws {<br>        #if canImport(StringifyMacros)<br>        assertMacroExpansion(<br>            &quot;&quot;&quot;<br>            #stringify(a + b)<br>            &quot;&quot;&quot;,<br>            expandedSource: &quot;&quot;&quot;<br>            (a + b, &quot;a + b&quot;)<br>            &quot;&quot;&quot;,<br>            macros: testMacros<br>        )<br>        #else<br>        throw XCTSkip(&quot;macros are only supported when running tests for the host platform&quot;)<br>        #endif<br>    }<br><br>    func testMacroWithStringLiteral() throws {<br>        #if canImport(StringifyMacros)<br>        assertMacroExpansion(<br>            #&quot;&quot;&quot;<br>            #stringify(&quot;Hello, \(name)&quot;)<br>            &quot;&quot;&quot;#,<br>            expandedSource: #&quot;&quot;&quot;<br>            (&quot;Hello, \(name)&quot;, #&quot;&quot;Hello, \(name)&quot;&quot;#)<br>            &quot;&quot;&quot;#,<br>            macros: testMacros<br>        )<br>        #else<br>        throw XCTSkip(&quot;macros are only supported when running tests for the host platform&quot;)<br>        #endif<br>    }<br>}</pre><p>Burada assertMacroExpansion methodunu daha yakından inceleyelim;</p><pre>public func assertMacroExpansion(<br>  // makroyu içermesi beklediğimiz source kod<br>  _ originalSource: String,<br><br>  // originalSource&#39;taki makro expand edildikten sonra<br>  // görmeyi beklediğimiz kod<br>  expandedSource expectedExpandedSource: String,<br><br>  // makro expand edilirken herhangi bir diagnostic bekleniyorsa..<br>  diagnostics: [DiagnosticSpec] = [],<br><br>  // test kapsamında expand edilecek makrolar<br>  macros: [String: Macro.Type],<br>  applyFixIts: [String]? = nil,<br>  fixedSource expectedFixedSource: String? = nil,<br><br>  // kalan parametreleri customize etme ihtiyacı pek olmasa gerek :)<br>  testModuleName: String = &quot;TestModule&quot;,<br>  testFileName: String = &quot;test.swift&quot;,<br>  indentationWidth: Trivia = .spaces(4),<br>  file: StaticString = #filePath,<br>  line: UInt = #line<br>)</pre><p>Burada hangi makroyu ve kod bloğunu kullandığımızda nasıl bir kod üretilmesini beklediğimizi sınayabiliriz.</p><p>Buradaki bazı kodlar göz yorabiliyor. #if canImport ve tekrar tekrar makroyu argüman olarak geçmek gibi.. Unit test yazımını kolaylaştıran <a href="https://github.com/pointfreeco/swift-macro-testing">https://github.com/pointfreeco/swift-macro-testing</a> paket de mevcut.</p><p>Bu paketi kullanarak nispeten daha sade olaraktan şöyle bir manzara seyredebiliriz;</p><pre>class StringifyMacroTests: XCTestCase {<br>  override func invokeTest() {<br>    withMacroTesting(<br>      macros: [&quot;stringify&quot;: StringifyMacro.self]<br>    ) {<br>      super.invokeTest()<br>    }<br>  }<br><br>  func testStringify() {<br>    assertMacro {  // 👈 No need to specify the macros being tested<br>      &quot;&quot;&quot;<br>      #stringify(a + b)<br>      &quot;&quot;&quot;<br>    } expansion: {<br>      &quot;&quot;&quot;<br>      (a + b, &quot;a + b&quot;)<br>      &quot;&quot;&quot;<br>    }<br>  }<br><br>  // ...<br>}</pre><h3>Diagnostics</h3><p>Aşağıda sadece structlara uygulanabilen bir makro için, struct olması ön koşulunun nasıl kontrol edilip Xcode üzerinden uyarı/hata gösterebildiğini görebiliriz.</p><pre>import SwiftSyntax<br>import SwiftSyntaxMacros<br>import SwiftSyntaxBuilder<br><br>struct DictionaryStorageMacro: MemberMacro {<br>    static func expansion(<br>        of attribute: AttributeSyntax,<br>        providingMembersOf declaration: some DeclGroupSyntax,<br>        in context: some MacroExpansionContext<br>    ) throws -&gt; [DeclSyntax] {<br>        guard declaration.is(StructDeclSyntax.self) else {<br>            let structError = Diagnostic(<br>                node: attribute,<br>                message: MyLibDiagnostic.notAStruct<br>            )<br>            context.diagnose(structError)<br>            return []<br>        }<br>        return [<br>            &quot;init(dictionary: [String: Any]) { self.dictionary = dictionary }&quot;,<br>            &quot;var dictionary: [String: Any]&quot;<br>        ]<br>    }<br>}<br><br>enum MyLibDiagnostic: String, DiagnosticMessage {<br>    case notAStruct<br><br>    var severity: DiagnosticSeverity { return .error }<br><br>    var message: String {<br>        switch self {<br>        case .notAStruct:<br>            return &quot;&#39;@DictionaryStorage&#39; can only be applied to a &#39;struct&#39;&quot;<br>        }<br>    }<br><br>    var diagnosticID: MessageID {<br>        MessageID(domain: &quot;MyLibMacros&quot;, id: rawValue)<br>    }<br>}</pre><h3>Makro limitasyonları</h3><ul><li>Makronun genişletildiği (expand) lokasyonu değiştirmek mümkün değildir</li><li>Yalnızca kullanıldığı kod bloğundan içeriye doğru erişimi var</li><li>Inherit ettiği bir classın parametrelerine erişemez</li><li>Makrolar, derleme zamanında genişletildiği için, çok sayıda veya karmaşık makrolar kullanıldığında derleyici performansını olumsuz etkileyebilir. Bu, derleme süresinin uzamasına neden olabilir.</li><li>Sadece compiler’ın sağladığı bilgileri kullanın, aksi taktirde, araçlar ne zaman makroyu re-expand yapması gerektiğini bilemez</li><li>Makroların file system ya da network’e erişimi yoktur</li><li>Current time, process ID, or random numbers</li><li>Global değişkenlere bilgi kaydetmemelisiniz</li></ul><h3>Örnek Makro Paketleri</h3><ul><li><a href="https://github.com/EnesKaraosman/LoremSwiftify">GitHub - EnesKaraosman/LoremSwiftify: LoremSwiftify is a Macro that creates lorem ipsum data for your models</a></li><li><a href="https://github.com/LeonardoCardoso/InitMacro">GitHub - LeonardoCardoso/InitMacro</a></li><li><a href="https://github.com/SwiftyLab/MetaCodable">GitHub - SwiftyLab/MetaCodable: Supercharge Swift&#39;s Codable implementations with macros meta-programming.</a></li><li><a href="https://github.com/Kolos65/Mockable">GitHub - Kolos65/Mockable: A Swift macro driven auto-mocking library.</a></li><li><a href="https://github.com/krzysztofzablocki/Swift-Macros">GitHub - krzysztofzablocki/Swift-Macros: A curated list of awesome Swift Macros</a></li></ul><h3>Kaynaklar</h3><ul><li><a href="https://docs.swift.org/swift-book/documentation/the-swift-programming-language/macros/">Documentation</a></li><li><a href="https://wwdcnotes.com/documentation/wwdcnotes/wwdc23-10166-write-swift-macros/">Documentation</a></li><li><a href="https://wwdcnotes.com/documentation/wwdcnotes/wwdc23-10167-expand-on-swift-macros/">Documentation</a></li></ul><p><a href="https://www.youtube.com/watch?v=w29qvXIADFY&amp;t=358s">Apple DeveloperWWDC23: Write Swift macros | Apple</a>​</p><p><a href="https://www.youtube.com/watch?v=juUu0nBJ9Ns">Apple DeveloperWWDC23: Expand on Swift macros | Apple</a>​</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bdefea00a1d6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Enhancing Your Daily Life as a Developer: GitHub Apps and Actions to the Rescue]]></title>
            <link>https://medium.com/etiya/enhancing-your-daily-life-as-a-developer-github-apps-and-actions-to-the-rescue-e46977041ba4?source=rss-f5ccc46e308a------2</link>
            <guid isPermaLink="false">https://medium.com/p/e46977041ba4</guid>
            <category><![CDATA[devops-tool]]></category>
            <category><![CDATA[github-actions]]></category>
            <category><![CDATA[github]]></category>
            <category><![CDATA[github-app]]></category>
            <category><![CDATA[makale]]></category>
            <dc:creator><![CDATA[Enes Karaosman]]></dc:creator>
            <pubDate>Tue, 18 Jul 2023 10:52:12 GMT</pubDate>
            <atom:updated>2023-07-18T10:52:12.022Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WmjvSAXwToEDd3LARFqPhw.png" /></figure><p>Being a developer involves juggling various tasks, from writing efficient code and maintaining code quality to managing dependencies and ensuring seamless integration and deployment processes. With the vast ecosystem of tools and technologies available, it’s essential to leverage the right resources to optimize your daily workflow and enhance productivity.</p><p>In this blog post, we’ll explore the best GitHub apps and actions that can significantly improve your daily life as a developer working on a repository. These tools, spanning areas such as security, code quality, code review, dependency management, CI/CD, and more, provide valuable features to streamline your development processes and boost efficiency.</p><p>By harnessing the power of these tools and integrating them into your GitHub workflow, you can optimize code quality checks, automate tedious tasks, collaborate seamlessly with your team, and ensure a smooth development experience. So, let’s dive in and discover the must-have GitHub apps and actions to enhance your daily life!</p><p><strong>Code Quality:</strong></p><ol><li><a href="https://codecov.io/">Codecov</a>: Codecov is a code coverage tool that integrates with GitHub to provide coverage reports for your codebase. It helps you ensure that your tests are thorough and helps identify areas that lack test coverage. Codecov provides detailed reports and metrics to track your code coverage over time.</li><li><a href="https://sonarcloud.io/">SonarCloud</a>: SonarCloud is a comprehensive code quality and security analysis platform. By integrating with GitHub, it offers insights into your project’s code quality, bugs, vulnerabilities, and code smells. SonarCloud provides detailed reports, code metrics, and actionable insights to help you improve the overall quality and maintainability of your codebase.</li><li><a href="https://codeclimate.com/">CodeClimate</a>: CodeClimate is a static analysis tool that analyzes your codebase for issues related to code quality, maintainability, and best practices. It checks for code complexity, style violations, duplication, and other potential code issues. CodeClimate provides an interactive dashboard, allowing you to prioritize and address code issues efficiently.</li></ol><p><strong>Code Review:</strong></p><ol><li><a href="https://danger.systems/">Danger</a>: Danger automates the code review process by providing additional insights and checks on pull requests. It can analyze code changes, check for formatting, enforce guidelines or conventions, and even integrate with external services or APIs. Danger helps streamline the code review process and ensures that code changes meet the team’s standards.</li><li><a href="https://github.com/marketplace/codacy">Codacy</a>: Codacy is an automated code analysis/quality tool that helps developers ship better software, faster. With Codacy, you get static analysis, cyclomatic complexity, duplication, and code unit test coverage changes in every commit and pull request. You can use Codacy to enforce your code quality standard, save time in code reviews, enforce security best practices, and onboard developers faster. Integrate with your GitHub repositories to get quality analysis of every pull request inside GitHub.</li></ol><p><strong>Dependency Management:</strong></p><ol><li><a href="https://dependabot.com/">Dependabot</a>: Dependabot keeps your dependencies up to date by automatically creating pull requests whenever new versions are released. It scans your project for outdated dependencies and suggests updates based on version constraints. Dependabot helps you stay updated with the latest versions, security patches, and bug fixes of your project’s dependencies.</li><li><a href="https://www.whitesourcesoftware.com/free-developer-tools/renovate/">Renovate</a>: Renovate is a powerful dependency management tool that automates the process of updating dependencies. It scans your project, creates pull requests with updated dependency versions, and provides an extensive set of configuration options to customize the update process. Renovate helps ensure that your project is using the latest and most secure versions of its dependencies.</li><li><a href="https://snyk.io/">Snyk</a>: Snyk focuses on security by scanning your project’s dependencies for known vulnerabilities and providing insights into potential security issues. It integrates with GitHub to automatically test and monitor your project’s dependencies for security vulnerabilities. Snyk helps you identify and mitigate security risks associated with third-party dependencies.</li></ol><p><strong>Continuous Integration/Deployment (CI/CD):</strong></p><p><a href="https://github.com/features/actions">GitHub Actions</a> is a flexible automation platform that allows you to define workflows and automate tasks for building, testing, and deploying your application. It integrates seamlessly with GitHub and offers a wide range of actions and integrations to customize your CI/CD pipeline.</p><ol><li><a href="https://codemagic.io/">Codemagic</a>: Codemagic is a dedicated CI/CD platform specifically built for Mobile. It provides seamless integration with GitHub, allowing you to automate the build, test, and deployment processes for your applications. Codemagic offers advanced features like code signing, caching, parallel workflows, and integration with other tools in the ecosystem.</li><li><a href="https://circleci.com/">CircleCI</a>: CircleCI is a popular CI/CD platform that supports and integrates well with GitHub. It allows you to define customizable workflows for building, testing, and deploying your apps. CircleCI provides various configuration options and integrates with other tools and services to create a robust CI/CD pipeline.</li><li><a href="https://www.bitrise.io/">Bitrise</a>: Bitrise is a mobile CI/CD platform that supports Flutter development. It integrates with GitHub and provides a streamlined workflow for building, testing, and deploying your Flutter apps. Bitrise offers a wide range of integrations, automation capabilities, and customization options to meet your specific CI/CD needs.</li></ol><p><strong>Security:</strong></p><ol><li><a href="https://snyk.io/">Snyk</a>: Snyk is a security-focused tool that scans your project’s dependencies for known vulnerabilities and provides insights into potential security issues. It helps you identify and address security vulnerabilities, ensuring that your app is secure and protected against common threats.</li><li><a href="https://sonarcloud.io/">SonarCloud</a>: SonarCloud not only analyzes code quality but also includes security analysis capabilities. It helps you identify security vulnerabilities, potential security risks, and coding practices that could lead to security breaches. SonarCloud assists in maintaining a secure codebase and following best security practices.</li><li><a href="https://sentry.io/">Sentry</a>: Sentry is an error monitoring and reporting platform that helps you track and fix issues in your app. By integrating with GitHub, it automatically creates issues for new errors reported by your app. This helps you quickly identify and resolve bugs, improving the stability and reliability of your application.</li></ol><p><strong>Release Management:</strong></p><ol><li><a href="https://github.com/marketplace/actions/fastlane-action">Fastlane</a>: Fastlane is a powerful release management tool that automates the deployment process for your app. It handles tasks like code signing, generating release notes, and submitting your app to app stores. By integrating with GitHub, Fastlane allows you to trigger releases based on specific events or conditions, making the release process efficient and reliable.</li><li><a href="https://github.com/marketplace/actions/firebase-app-distribution">Firebase App Distribution</a>: Firebase App Distribution simplifies the distribution of pre-release versions of your app to testers. By integrating with GitHub, you can trigger distribution builds and invite testers directly from your repository. This streamlines the testing and feedback process, making it easier to gather valuable insights from your testing team.</li></ol><p><strong>Error Monitoring and Reporting:</strong></p><ol><li><a href="https://sentry.io/">Sentry</a>: Sentry helps monitor and report errors in your Flutter app. By integrating with GitHub, it creates issues for new errors reported by your app, providing a centralized location for tracking and resolving issues. Sentry’s detailed error reports and crash logs help you debug and fix issues quickly, improving the overall stability of your Flutter application.</li></ol><p><strong>Project Management:</strong></p><ol><li><a href="https://trello.com/">Trello</a>: Trello is a popular project management tool that can be integrated with GitHub. It allows you to link pull requests, issues, or milestones to Trello cards, facilitating better tracking, organization, and collaboration within your development team. Trello provides a visual interface for managing tasks and workflows, enhancing project management for your repository.</li><li><a href="https://github.com/marketplace/slack-github">Slack</a>: Slack integration with GitHub that allows you to receive notifications, updates, and activity alerts from your GitHub repositories directly in your Slack channels, enhancing collaboration and communication within your team.</li><li><a href="https://github.com/marketplace/jira-software-github">Jira</a>: Jira integration with GitHub that enables bidirectional synchronization between Jira issues and GitHub pull requests, improving project management and traceability between development tasks and project tracking.</li></ol><p>These tools offer a wide range of functionalities to improve code quality, code review processes, dependency management, CI/CD pipelines, security, release management, error monitoring, and project management in development.</p><p>Your favorite tool is not listed? Let us know in the comments so that we can investigate as well and add to the list!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e46977041ba4" width="1" height="1" alt=""><hr><p><a href="https://medium.com/etiya/enhancing-your-daily-life-as-a-developer-github-apps-and-actions-to-the-rescue-e46977041ba4">Enhancing Your Daily Life as a Developer: GitHub Apps and Actions to the Rescue</a> was originally published in <a href="https://medium.com/etiya">Etiya</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Flutter Paket Geliştirme]]></title>
            <link>https://medium.com/etiya/flutter-paket-geli%C5%9Ftirme-ad65711e9a73?source=rss-f5ccc46e308a------2</link>
            <guid isPermaLink="false">https://medium.com/p/ad65711e9a73</guid>
            <category><![CDATA[flutter-package]]></category>
            <category><![CDATA[flutter]]></category>
            <dc:creator><![CDATA[Enes Karaosman]]></dc:creator>
            <pubDate>Fri, 10 Sep 2021 15:38:16 GMT</pubDate>
            <atom:updated>2023-07-10T09:57:06.789Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*LnHlbSteVGzgDreL" /><figcaption>Photo by <a href="https://unsplash.com/@nublson?utm_source=medium&amp;utm_medium=referral">Nubelson Fernandes</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Paketin kapsamından bir önceki yazıda da bahsetmiştik (<a href="https://medium.com/@eneskaraosman53/flutter-package-kullan%C4%B1m%C4%B1-6a41484f3b37">Flutter Package kullanımı</a>), kısaca hatırlamak gerekirse modüler olarak kolayca paylaşılabilir kodlar yazmak için kullanıyoruz diyebiliriz.</p><p>Bir paketin paket olabilmesi için pubspec.yaml dosyası ve lib klasörü barındırması gerekiyor.</p><ul><li>lib klasöründe paketimizin kod dosyaları bulunur, genellikle paketten dış kullanıma açılacak kodlar, paket ismine sahip dart dosyası ile yapılıyor. Yani bu (tek) dosya içerisinde ilgili exportlar toplanıyor.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/316/1*ozQ43Rn4SdrmA5gjY2Qbvw.png" /></figure><p>Hatta görselde görüldüğü gibi, lib klasörü içerisinde bir src klasörü altında paket kodlarını barındırmak da community tarafından benimsenmiş bir yaklaşımdır.</p><p>swifty_chat.dart dosyası (paketin ana dosyası) ise şu şekilde olabilir;</p><pre>library swifty_chat;</pre><pre>export &#39;package:swifty_chat_data/swifty_chat_data.dart&#39;;</pre><pre>export &#39;src/chat.dart&#39; show Chat;<br>export &#39;src/chat_input_field.dart&#39;;<br>export &#39;src/extensions/keys.dart&#39;;<br>export &#39;src/message_cell_size_configurator.dart&#39;;<br>export &#39;src/theme/chat_theme.dart&#39;;<br>export &#39;src/theme/default_theme.dart&#39;;</pre><p>Sadece istediğimiz dosyaları, hatta bir dosyanın sadece bir sınıfını dış kullanıma açabiliriz.</p><p>Bu kısıtlamalar ile alakalı <a href="https://dart.dev/guides/language/language-tour#libraries-and-visibility">şu link</a> faydalı olacaktır.</p><blockquote>Flutter core dosyalarından biri olan material.dart dosyasına IDE’nizden gidip bahsettiğimiz yaklaşımı oradan da inceleyebilirsiniz.</blockquote><ul><li>pubspec.yaml dosyasına gelince, bu dosya olmalı ki başka bir paket ya da uygulama tarafından paketimiz eklenebilsin.</li></ul><p>Tekrardan pubspec dosyasının görünümünü hatırlamak istersek;</p><pre>name: package_name<br>description: Package Description here..<br>version: 0.0.1</pre><pre>environment:<br>  sdk: &quot;&gt;=2.12.0 &lt;3.0.0&quot;</pre><pre>dependencies:<br>  flutter:<br>    sdk: flutter<br>    <br>dev_dependencies:<br>  flutter_test:<br>    sdk: flutter</pre><p>kabaca bu şekilde olabilir.</p><h3>Paket türleri</h3><p>Yine önceki yazımızda plugin in de aslında bir paket türü olduğundan bahsetmiştik.</p><p>Dolayısıyla Dart ve Plugin paketleri olarak türlerimizi ikiye ayırabiliriz.</p><h3>1. Paket oluşturma</h3><pre>flutter create --template=package swifty_chat</pre><p>Bu komut swifty_chat isminde bir paket oluşturur, ve bu kapsamda aşağıdaki gibi bazı dosyalar otomatik olarak paketinize eklenecektir, kabaca bunlar hakkında bilgi paylaşalım.</p><ul><li><strong>LICENCE</strong></li></ul><p>Varsayılan olarak boş geliyor, buraya paketin kapsamına göre bir lisans ekleyebilirsiniz. Eğer paketinizi GitHub üzerinde saklayacak olursanız, otomatik olarak templatelerden faydalanabilirsiniz.</p><ul><li><strong>test/swifty_chat_test.dart</strong></li></ul><p>Unit testlerin barındırıldığı dosya.</p><ul><li><strong>swifty_chat.iml &amp; .idea</strong></li></ul><p>IntelliJ IDEleri tarafından kullanılan bir konfigürasyon dosyalarıdır.</p><ul><li><strong>.gitignore</strong></li></ul><p>Hangi dosya ya da klasörün Git kapsamına dahil edilmemesini bildirmemizi sağlayan gizli bir dosyadır.</p><ul><li><strong>.metadata</strong></li></ul><p>IDEler tarafından Flutter projesinin bazı özelliklerini takip için kullanılan gizli bir dosyadır.</p><ul><li><strong>pubspec.yaml</strong></li></ul><p>Paketin bağımlı olduğu başka paketleri ve bir takım özellikleri ayalayabildiğimiz dosyadır.</p><ul><li><strong>README.md</strong></li></ul><p>Paketin amacını özetle izah eden bir markdown dosyasıdır.</p><ul><li><strong>lib/swifty_chat.dart</strong></li></ul><p>Başka paketler tarafından import edilecek şekilde tasarlanan bir dosyadan yukarıda bahsetmiştik, işte bu o dosyadır.</p><ul><li><strong>CHANGELOG.md</strong></li></ul><p>Paketin yeni sürümünü geliştirdikçe ilgili değişikliklerin takibi amacıyla oluşturulmuş bir markdown dosyasıdır.</p><blockquote>analysis_options.yaml dosyasıda Flutter 2.5.0 sürümü ile birlikte varsayılan olarak eklenmektedir, statik kod analizi için eklenen lint kütüphanesinin kullandığı bir konfigürasyon dosyasıdır.</blockquote><p>Bu kısımdan sonrası geliştirmek istediğiniz içeriğe göre yazacağınız kodlardan ibaret, hala nasıl ilerleyeciğiniz konusunda güçlük çekiyorsanız <a href="https://github.com/EnesKaraosman/swifty_chat">https://github.com/EnesKaraosman/swifty_chat</a> şahsi paketimi inceleyebilirsiniz, sorularınız için de GitHub ya da LinkedIn üzerinden irtibata geçebilirsiniz.</p><p>Paket geliştirme aşamasında tavsiye etmeden geçmeyeceğim bir konu da bir example projeyi pakete dahil etmeniz, paketinizi bu projeye local dependency olarak ekleyebilirsiniz. Böylelikle hem geliştirme yapıp hem de bu örnek proje üzerinden geliştirmeleri hızlıca kontrol edebilirsiniz. Paylaştığım örnek repositoryde bu da mevcut.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ad65711e9a73" width="1" height="1" alt=""><hr><p><a href="https://medium.com/etiya/flutter-paket-geli%C5%9Ftirme-ad65711e9a73">Flutter Paket Geliştirme</a> was originally published in <a href="https://medium.com/etiya">Etiya</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Flutter Package kullanımı]]></title>
            <link>https://medium.com/etiya/flutter-package-kullan%C4%B1m%C4%B1-6a41484f3b37?source=rss-f5ccc46e308a------2</link>
            <guid isPermaLink="false">https://medium.com/p/6a41484f3b37</guid>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[flutter-package]]></category>
            <dc:creator><![CDATA[Enes Karaosman]]></dc:creator>
            <pubDate>Fri, 10 Sep 2021 15:36:37 GMT</pubDate>
            <atom:updated>2023-07-10T09:57:36.666Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N2xbMoSeDKxs3nGkUxbTXA.png" /><figcaption>Photo by <a href="https://unsplash.com/@kseegars?utm_source=medium&amp;utm_medium=referral">Kadarius Seegars</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Öncelikle package ve plugin terimlerini ifade etmeye çalışalım, birbirinden ne farkı var?</p><p><strong>Package:</strong> Flutter geliştiriciler olarak çok sık kullandığımız (<a href="https://pub.dev/">pub.dev</a>), bu yazıda da odaklanacağımız package, projemizin pubspec dosyası içerisinden projemize eklediğimiz, geliştiriciler tarafından yazılan dart ya da flutter ile alakalı kodları barındıran paket olarak düşünebilirsiniz.</p><p><strong>Plugin: </strong>Plugin ise platform bazlı (Android için Kotlin, iOS için Swift ile yazılmış olabilir) birtakım kodları projemize dahil etmemizi sağlayacak özel bir <em>package</em> türü gibi düşünebilirsiniz.</p><p>Bu kısa girişten sonra herhangi bir paketi eklemek istediğimiz zaman kullanacağımız pubspec.yaml dosyasından da bahsedelim.</p><blockquote><strong>iOS geliştiriciler <em>Podfile</em> ya da <em>Package.swift</em></strong></blockquote><blockquote><strong>Android geliştiriciler <em>gradle</em> dosyası olarak düşünebilirler.</strong></blockquote><p>Projemizdeki pubspec.yaml dosyasını açalım, aşağıdakine benzer bir dosya ile karşılaşacağız.</p><pre>name: project_name<br>description: Project Description here..<br>version: 0.0.1</pre><pre>environment:<br>  sdk: &quot;&gt;=2.12.0 &lt;3.0.0&quot;</pre><pre>dependencies:<br>  flutter:<br>    sdk: flutter<br>    <br>dev_dependencies:<br>  flutter_test:<br>    sdk: flutter</pre><p><strong>Şimdi projemize nasıl bir paket ekleyebiliriz?</strong></p><blockquote>Paket ekleme işlemini paket geliştirmesi yaparken de kullanabiliriz, yani sadece uygulamalara paket eklenmiyor, eklediğimiz bir paket de birden fazla paketi dependency olarak eklemiş olabilir.</blockquote><h3>Paket ekleme</h3><p>pubspec dosyası içerisinde dependencieskısmına kullanılmak istenen paket eklenir;</p><ul><li>Eğer eklemek istediğimiz paket <a href="https://pub.dev/">https://pub.dev/</a> ortamına publish edilmiş ise doğrudan ismi ile aşağıdaki gibi ekleme yapabiliriz.</li></ul><pre>dependencies:<br>  styled_widget: ^0.3.2</pre><ul><li>Yok eğer yetkimizin olduğu bir repository’de barındırılıyor ise url ile de eklemek mümkün;</li></ul><pre>dependencies:<br>  swifty_chat:<br>    git:<br>      url: <a href="https://github.com/EnesKaraosman/styled_widget.git">https://github.com/EnesKaraosman/swifty_chat.git</a></pre><ul><li>Eğer ilgili paket cihaz lokalinde bulunuyor ise bu ihtimalde de aşağıdaki gibi eklemek mümkün;</li></ul><pre>dependencies:<br>  swifty_chat:<br>    path: ../swifty_chat</pre><p>Android Studio ya da VS Code kullanıyorsanız, pubspecdosyasında düzenleme yaptığınız zaman <strong><em>Packages get</em></strong> ya da <strong><em>Get Packages</em></strong> gibi opsiyonlar beliriyor, bu seçenekler tetiklendiğinde <em>pubspec</em> dosyasının son haline ilgili düzenlemeler yansıtılır, yani paket eklemiş iseniz, ilgili paket otomatik olarak indirilecektir, kaldırma işlemi için de aynı durum geçerlidir.</p><p>Bu tetiklemeyi terminalden yapmak isterseniz de <strong><em>flutter pub get</em></strong> komutu yeterli olacaktır.</p><h3>Paket kullanımı</h3><p>Paketi ekledikten sonra ihtiyaç duyulan yerde ilgili kütüphanenin import işlemi gerçekleştirilir.</p><p>Bunu yaparken IDE’nizin otomatik tamamlama özelliğinden de faydalanabilirsiniz.</p><pre>import &#39;package:&#39;</pre><p>bu ibareyi yazdıktan sonra paketin ismini yazıp kullanımınıza açılmış dosyaları projenize entegre edebilirsiniz.</p><blockquote>Genellikle kullanıma açılan dosyalar tek bir dart dosyası üzerinden paylaşılıyor.</blockquote><h3>Versiyonlar ile alakalı da birkaç not paylaşalım; (<a href="https://dart.dev/tools/pub/dependencies#version-constraints">detay</a>)</h3><p>Dart topluluğu versiyon yönetimi için <a href="https://semver.org/"><em>semantic versioning</em></a><em> </em>kullanıyor.</p><p>Çok kısaca ifade etmek gerekirse 3 haneli versiyon numarası, MAJOR.MINOR.PAT şeklinde bir kapsam ifade ediyor.</p><pre>dependencies:<br>  some_package: ^5.4.0  # İyi, &gt;= 5.4.0 &lt; 6.0.0 aralığında herhangi bir versiyon.<br>  image_picker: &#39;5.4.3&#39; # Kötü, sadece 5.4.3 versiyonu çalışıyor.</pre><ul><li>^1.2.3 ibaresi &gt;=1.2.3 &lt; 2.0.0</li><li>^0.1.2 ibaresi &gt;=0.1.2 &lt; 0.2.0</li></ul><p>olarak düşünülebilir.</p><blockquote>Kullanılan paketler kendi içlerinde ortak başka bir paketi dependency olarak eklemiş ise bir çakışma durumu olabilir, bu tarz riskleri azaltmak için yukarıda da bahsettiğimiz gibi <strong><em>^</em></strong> ile versiyon kullanımı tavsiye edilmektedir.</blockquote><h3>Paket güncelleme</h3><p>flutter pub ugradekomutu ile pubspec dosyamızdaki paketler ilgili versiyonlama durumuna göre uygun üst versiyonlara güncellenir.</p><blockquote>Daha detaylı içerik için resmi flutter <a href="https://flutter.dev/docs/development/packages-and-plugins/using-packages">sitesini</a> ziyaret edebilirsiniz.</blockquote><p><a href="https://medium.com/@eneskaraosman53/flutter-paket-geli%C5%9Ftirme-ad65711e9a73">Flutter Paket geliştirme</a> ile alakalı yazıya da buradan erişebilirsiniz.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6a41484f3b37" width="1" height="1" alt=""><hr><p><a href="https://medium.com/etiya/flutter-package-kullan%C4%B1m%C4%B1-6a41484f3b37">Flutter Package kullanımı</a> was originally published in <a href="https://medium.com/etiya">Etiya</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[GitHub Kişisel Readme Oluşturmak]]></title>
            <link>https://medium.com/etiya/github-ki%C5%9Fisel-readme-olu%C5%9Fturmak-68e7adbeb835?source=rss-f5ccc46e308a------2</link>
            <guid isPermaLink="false">https://medium.com/p/68e7adbeb835</guid>
            <category><![CDATA[github-readme]]></category>
            <category><![CDATA[makale]]></category>
            <category><![CDATA[personal-website]]></category>
            <category><![CDATA[github]]></category>
            <dc:creator><![CDATA[Enes Karaosman]]></dc:creator>
            <pubDate>Mon, 21 Dec 2020 07:40:03 GMT</pubDate>
            <atom:updated>2020-12-21T07:40:03.409Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*E0GFaaxI7sjBVUiE" /><figcaption>Photo by <a href="https://unsplash.com/@acharki95?utm_source=medium&amp;utm_medium=referral">Aziz Acharki</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Arkadaşlar merhabalar, yazılımcıların can dostlarından biri olan GitHub’da şahsi hesabımız için nasıl README dosyası oluşturabiliriz hızlıca bakalım..</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5UYVN_I3z5BLEJrXQJMFxg.png" /><figcaption>github_personal_readme_create</figcaption></figure><p>Yeni repository oluşturma adımlarını takip edelim, akabinde yukarıdaki gibi bir görsel ile karşılaşacağız.</p><p>Github, bu README dosyasını ana ekranımıza koymak istediğimizi anlaması için basitçe birkaç kural bekliyor.</p><ol><li>Repository ismi ile kullanıcı adınız aynı olmalı.</li><li>İsimler eşleşince, resimde de görüldüğü gibi bir bilgilendirme metini bizi karşılıyor. (Doğru yoldayız!)</li><li>Malum, amacımız ana ekranımızın cafcaflı hale gelmesi olduğundan repository’nin de public olması gerekiyor ki insanlar görebilsin.</li><li>Bilgilerimizi README dosyasına koyacağımız için, bu seçeneğin de işaretli olduğuna emin olalım.</li></ol><p>Son olarak yukarıdaki bilgiler ışığında repository’i oluşturabiliriz!</p><p>Default içerik ile beraber kişisel README dosyamız oluştu, hemen profilimize (anasayfamıza) gidip kontrol edebiliriz.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ulTBPIfpRUsIoqwyYCmTXg.png" /></figure><p>Benim kişisel profilim bu şekilde, siz de dosyayı inceleyerek kendiniz için de oluşturabilirsiniz.</p><p><a href="https://github.com/EnesKaraosman">EnesKaraosman - Overview</a></p><p>Ve aşağıdaki repository‘de bir hayli örnek mevcut, inceleyerek ilham alabilirsiniz.</p><p><a href="https://github.com/abhisheknaiidu/awesome-github-profile-readme">GitHub - abhisheknaiidu/awesome-github-profile-readme: 😎 A curated list of awesome GitHub Profile which updates in real time</a></p><p>Vakit ayırdığınız için teşekkürler, siz de çarpıcı bir profil oluşturursanız, listeye dahil edebiliriz!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=68e7adbeb835" width="1" height="1" alt=""><hr><p><a href="https://medium.com/etiya/github-ki%C5%9Fisel-readme-olu%C5%9Fturmak-68e7adbeb835">GitHub Kişisel Readme Oluşturmak</a> was originally published in <a href="https://medium.com/etiya">Etiya</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[SwiftUI ile Chat uygulaması]]></title>
            <link>https://medium.com/etiya/swiftui-ile-chat-uygulamas%C4%B1-7252dea2ddee?source=rss-f5ccc46e308a------2</link>
            <guid isPermaLink="false">https://medium.com/p/7252dea2ddee</guid>
            <category><![CDATA[swiftui]]></category>
            <category><![CDATA[ios]]></category>
            <dc:creator><![CDATA[Enes Karaosman]]></dc:creator>
            <pubDate>Sun, 31 May 2020 12:17:17 GMT</pubDate>
            <atom:updated>2023-07-10T09:57:46.302Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*QehFQr971qmgq4wj" /><figcaption>Photo by <a href="https://unsplash.com/@b620?utm_source=medium&amp;utm_medium=referral">Brazil Topno</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Bir chat uygulaması için temel olarak nelere ihtiyaç duyarız?</p><ul><li>ChatUser</li><li>ChatMessage</li><li>ChatMessageKind</li></ul><p>Yani mesaj yazacak kullanıcı, mesaj ve spesifik mesaj türleri;</p><ul><li>ChatUser</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/226ed73201132cbf1178104cdc0052a9/href">https://medium.com/media/226ed73201132cbf1178104cdc0052a9/href</a></iframe><ul><li>ChatMessageKind</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/88830cb7366ec9c1c4eabc2f33b636b6/href">https://medium.com/media/88830cb7366ec9c1c4eabc2f33b636b6/href</a></iframe><ul><li>ChatMessage</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/dfc24e33ad32ae0b386212cd1d207f1a/href">https://medium.com/media/dfc24e33ad32ae0b386212cd1d207f1a/href</a></iframe><p>Bu 3 struct örneğini girişte de bahsettiğimiz gibi, bir Chat UI görebilmemiz için çok temel düzeyde yeterli olduğundan gözümüzde canlandırabilmek için paylaştım.</p><p>Nihai halinden de birkaç görsel paylaşalım;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lK4Il-MflgNyG2WUyPAxGA.png" /></figure><p>Medium üzerinden uzun kod paylaşımları yapıp yazıyı sıkıcı bir hale getirmek istemedim, dolayısıyla bunları bir repository içinde birleştirip kütüphane olarak takdim edeyim, kendi projenize de hızlıca entegre edebilirsiniz. Repository’de yeterli dokümantasyonu paylaştım.</p><p><a href="https://github.com/EnesKaraosman/SwiftyChat">EnesKaraosman/SwiftyChat</a></p><p>Doyasıya inceleyip, katkıda bulunabilirsiniz.</p><p>Son olarak SwiftUI şu aşamada tam manasıyla dolgun olmadığı için WWDC 20 etkinliğini de bekleyip akabinde kütüphaneyi zenginleştirmeyi düşünüyorum.</p><blockquote>SwiftUI ile ilgili kişisel notlarımı (türkçe) takip etmek ve katkıda bulunmak için bu <a href="https://eneskaraosman53.gitbook.io/swiftui/">gitbook</a> linkini takip edebilirsiniz, öğrendikçe güncel tutmaya çalışacağım.</blockquote><blockquote>Flutter versiyonu için <a href="https://github.com/EnesKaraosman/swifty_chat">https://github.com/EnesKaraosman/swifty_chat</a></blockquote><p>Vakit ayırdığınız için teşekkür ederim, geri bildirimde bulunabilirsiniz.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7252dea2ddee" width="1" height="1" alt=""><hr><p><a href="https://medium.com/etiya/swiftui-ile-chat-uygulamas%C4%B1-7252dea2ddee">SwiftUI ile Chat uygulaması</a> was originally published in <a href="https://medium.com/etiya">Etiya</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[SwiftUI’ da Şekil Çizimi]]></title>
            <link>https://medium.com/etiya/drawing-custom-shapes-in-swiftui-53dd5407190b?source=rss-f5ccc46e308a------2</link>
            <guid isPermaLink="false">https://medium.com/p/53dd5407190b</guid>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[swiftui]]></category>
            <dc:creator><![CDATA[Enes Karaosman]]></dc:creator>
            <pubDate>Thu, 16 Apr 2020 16:15:31 GMT</pubDate>
            <atom:updated>2020-04-16T19:26:54.441Z</atom:updated>
            <content:encoded><![CDATA[<h4>Custom Shape</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*e1KO2OdvZvwBjw6-" /><figcaption>Photo by <a href="https://unsplash.com/@sanderdw?utm_source=medium&amp;utm_medium=referral">Sander Dewerte</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>SwiftUI ile birlikte hazır olarak gelen bazı şekiller mevcut ancak bunlar her zaman işimizi görmeyebilir.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-OZ4yFMcQ6cLKhKyvAtfAA.png" /><figcaption>Built in Shapes</figcaption></figure><p>Kendi şeklimizi oluşturmak isteyebiliriz. Durum böyle ise SwiftUI bizden Shape Protokolünü entegre etmemizi bekliyor.</p><p><strong>Shape Protocol</strong></p><pre><strong>func</strong> path(in rect: <strong>CGRect</strong>) -&gt; <strong>Path</strong></pre><p>Bu basit protokol sadece bu metodu doğrulamamızı bekliyor. Yani belirli bir frame (in rect: CGRect) içinde, bir çizim yapmamız bekleniyor.</p><p>Path çizmek için kullanabileceğimiz metodlara Xcode içerisinden de bakabilirsiniz, bir kısmını buraya yansıtmış olayım ve akabinde işe koyulalım.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/efa6800190a5b1ea491728d069111113/href">https://medium.com/media/efa6800190a5b1ea491728d069111113/href</a></iframe><p>Bu metodlardan bazılarını (meşhurları) kullanarak bir kaç şekil çizelim.</p><ul><li><strong>Pac - Man </strong><em>ᗧ</em></li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8b4f26d861c308691926f8b12daa31c5/href">https://medium.com/media/8b4f26d861c308691926f8b12daa31c5/href</a></iframe><p>rect , bu şekli barındıracak frame i temsil eder.</p><ol><li>move metodu, çizime başlamak istediğimiz noktayı belirlememizi sağlar. Şeklin merkezinden başlayacağımız için, başlangıç noktamızı buraya taşıdık.</li></ol><p>2. addArc metodu ise, parametrelerden de anlayabileceğiniz üzere, belirli bir merkez, yarıçap ve başlangıç, bitiş açılarına göre bir çember çizmemiz için yardımcı olacak.</p><p>3. closeSubpath metodu da, şekil çiziminde, son kaldığımız yer ile başlangıç noktamızı (move diyerek belirlemiştik) birleştirir.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/544/1*Goad7zYl1k22riO3Wj-jEg.png" /><figcaption>PacMan, endAngle: 270˚ &amp; rotation: 45˚</figcaption></figure><p>Böyle bir görsel elde etmek için, 270˚ lik açı verebiliriz ve akabinde 45˚ şeklimizi çevirebiliriz.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b4974ef6ccd7c666b370444c7c272689/href">https://medium.com/media/b4974ef6ccd7c666b370444c7c272689/href</a></iframe><p>Daha iyi anlaşılması açısından, endAngle parametresinin etkisini şu GIF ile takip edebiliriz.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/310/1*XuqkUh4QI2V_bOKjEE6wdQ.gif" /><figcaption>endAngle demo</figcaption></figure><p>GIF’ teki açılar (0, 90..) dikkatinizi çekmiş olabilir, bunlar varsayılan (default) açılar, çizim yaparken bunları dikkate almalısınız (clockwise parametresine göre).</p><ul><li><strong>Balon</strong></li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6ed818ae6e306a3d2cfefd39d5d09b7c/href">https://medium.com/media/6ed818ae6e306a3d2cfefd39d5d09b7c/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/404/1*DfGfdHbrVyxpGfX5mp_wTw.png" /><figcaption>balloon shape</figcaption></figure><blockquote><em>Curve: Kavis, Eğim anlamlarına geliyor.</em></blockquote><p>Balon şekli çiziminde de addCurve metodunu deneyimlemiş olduk. <br><br>Burada özet olarak, bulunduğumuz (başlangıç) noktadan, hedef noktaya ilerlerken, belirlediğimiz 2 kontrol noktasına göre hedefe (to point) varılır. <br>(Balonumuzun biraz daha tombik olması için de bu kontrol noktalarıyla oynayabiliriz.)</p><p>Ek olarak, Path’ in bu kontrol noktalardan geçeceğinin garantisi yok, sadece bu noktalara göre şekillendiğini bilelim. Zaten doğrudan kontrol noktasına gitmesini isteseydik bu amaçla addLine metodunu kullanırdık.</p><p>Şu görsel kavramamız için daha yardımcı olabilir.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/351/1*YVoZRzq2DlqyCwwGR3uv0w.jpeg" /><figcaption><a href="https://developer.apple.com/documentation/uikit/uibezierpath/1624357-addcurve">https://developer.apple.com/documentation/uikit/uibezierpath/1624357-addcurve</a></figcaption></figure><ul><li><strong>Üçgen</strong></li></ul><p>addLine kullanımına da değinmek amacıyla son olarak da üçgen çizelim.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/89fd0bf5e04b19175165e0698f6fe4c8/href">https://medium.com/media/89fd0bf5e04b19175165e0698f6fe4c8/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/382/1*-nLMM6i-o4vEwIKUpTYPAQ.png" /><figcaption>Triangle Shape</figcaption></figure><p>Çizgi (Line) çizimlerinde, sadece nokta belirlememiz yeterli olduğundan en kolay metodun bu olduğunu düşünüyorum.</p><p>Burada ekstra olarak strokedPath metodunu kullandığımız dikkatinizi çekmiştir. Bu da bizden bir StrokeStyle parametresi istiyor, örnek olması açısından bir kaç parametresini doldurdum. Bu parametreler ile oynayarak çizgilerin kesişim noktalarının nasıl değiştiğini gözlemleyebilirsiniz.</p><h4>Border, Fill, Stroke örnekleri</h4><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fb41cc7d0b735727ad730e8aa38b80ff/href">https://medium.com/media/fb41cc7d0b735727ad730e8aa38b80ff/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/620/1*MVI3eAE3eFk-oU4yiheSjQ.png" /><figcaption>border, stroke, fill</figcaption></figure><p>Kod örneğinin çıktısı, sırasıyla görselde paylaşılmıştır.</p><p>fill ve stroke metodlarının Shape ler için olduğunu belirtelim. View leri de kapsamak adına, overlay kullanımının daha tercih edilebilir olduğunu düşünüyorum. <br>Yazıyı uzatmamak adına, ihtiyacınıza binaen yukarıdaki örneklere göre ya da referans olarak aşağıdaki bir kaç siteye de bakabilirsiniz.</p><ul><li><a href="https://dreamcraft.io/posts/swiftui-border">SwiftUI : How to draw borders or strokes in SwiftUI?</a></li><li><a href="https://www.simpleswiftguide.com/how-to-add-borders-to-swiftui-views/">How to add borders to SwiftUI views - Simple Swift Guide</a></li></ul><h3>Ekstra</h3><p>Shape protokolü, Animatable protokolünü de içeriyor.</p><p>Bu protokol ile SwiftUI’ a Shape imizin hangi parametresi (ya da parametreleri) için animasyon konfigürasyonu yapabileceğini söyleyebiliriz.</p><p>PacMan çizimimiz için hızlıca kullanalım, hatırlarsanız endAngle parametresini kullanarak GIF’te hazırlamıştık. PacMan’ e şu kodu eklememiz yeterli.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fff901e1d4847a55da6744dea7e110f5/href">https://medium.com/media/fff901e1d4847a55da6744dea7e110f5/href</a></iframe><p>AnimatableData hakkında şu yazı da faydalı olacaktır.</p><p><a href="https://www.hackingwithswift.com/books/ios-swiftui/animating-complex-shapes-with-animatablepair">Animating complex shapes with AnimatablePair</a></p><p>Aşağıdaki repositoryleri inceleyip, Shape’ ler ile alakalı başka örneklere de göz atabilirsiniz.</p><ul><li><a href="https://github.com/EnesKaraosman/SwiftProgress">EnesKaraosman/SwiftProgress</a></li><li><a href="https://github.com/EnesKaraosman/StarView">EnesKaraosman/StarView</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=53dd5407190b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/etiya/drawing-custom-shapes-in-swiftui-53dd5407190b">SwiftUI’ da Şekil Çizimi</a> was originally published in <a href="https://medium.com/etiya">Etiya</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Display Empty State of a page in iOS]]></title>
            <link>https://medium.com/etiya/display-empty-state-of-a-page-in-ios-aa2430ac7d58?source=rss-f5ccc46e308a------2</link>
            <guid isPermaLink="false">https://medium.com/p/aa2430ac7d58</guid>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[mobile-tech]]></category>
            <dc:creator><![CDATA[Enes Karaosman]]></dc:creator>
            <pubDate>Wed, 26 Feb 2020 14:53:46 GMT</pubDate>
            <atom:updated>2020-02-27T07:27:46.402Z</atom:updated>
            <content:encoded><![CDATA[<p>What do we aim generally in an app?</p><p>We show some screens to users, collect data from users and, if necessary, communicate with a backend to save and reuse data right? This is all we developers mostly do.</p><p>To visualize the topic let me continue by giving an example.</p><p>I bet you all have made at least a network service call and hoped it was success and you do show the data you fetched, we call this a success case.</p><p>As you might guess, this is sort of an optimistic perspective, I mean you can’t always expect that it is alright, so you also need to handle with an error state.</p><p>Then what is an ‘empty state’?</p><p>Before we move on let me tell you how we might define an ‘empty state’,</p><p>We have earlier the mentioned success/error state, in this case we don’t have any errors, service request succeeded, but actually it is not the kind of the success we hoped for, the reason is we don’t have any data to show to the user.</p><p>So how to proceed then? Is it better to show a toast message or present an alert and afterward leave the user with a blank screen?</p><p>It is possible of course to show an alert to the user to inform that we don’t have any data to show you, but this may be considered as <em>laziness </em>in some cases<em>.</em></p><p>I think this is enough, what do you advice to do?</p><p>Here are a couple screenshots that show how some famous app’s chose to apply.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dbmVIDU0fB1kZDXxqIj2Cg.png" /><figcaption>Medium — Slack — Spark</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SpQJHIFCeOxs8WFGZ0I3fQ.png" /><figcaption>Files — Books — Podcasts</figcaption></figure><p>As you see in the images above most famous app’s chose this approach to let their users clearly understand why related page is empty. Better user experience (UX) isn’t it.</p><p>Now let’s continue thinking as a developer, most of us may also facing ‘empty state’ cases in projects.</p><p>So I want to point out something that you may realize while surfing between images. I stared commonly used UI elements;</p><ul><li>Image</li><li>Title Label</li><li>Message Label (a bit detailed information)</li><li>Button</li></ul><p>Almost in an every sample app, I faced, was using one of these elements, or combination of them.</p><p>Then asked myself, why not creating a useful lightweight library?</p><p>Here is the answer, enjoy it using the link below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/318/1*CBoSz0QUMfJVrILusefO0g.gif" /></figure><p><a href="https://github.com/EnesKaraosman/SwiftEmptyState.git">EnesKaraosman/SwiftEmptyState</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=aa2430ac7d58" width="1" height="1" alt=""><hr><p><a href="https://medium.com/etiya/display-empty-state-of-a-page-in-ios-aa2430ac7d58">Display Empty State of a page in iOS</a> was originally published in <a href="https://medium.com/etiya">Etiya</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Settings Bundle on iOS]]></title>
            <link>https://medium.com/etiya/settings-bundle-on-ios-67329d12cff4?source=rss-f5ccc46e308a------2</link>
            <guid isPermaLink="false">https://medium.com/p/67329d12cff4</guid>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[mobile-tech]]></category>
            <dc:creator><![CDATA[Enes Karaosman]]></dc:creator>
            <pubDate>Mon, 27 Jan 2020 11:47:05 GMT</pubDate>
            <atom:updated>2020-01-27T11:57:00.902Z</atom:updated>
            <content:encoded><![CDATA[<h3>Settings Bundle on iOS — iOS üzerinde Bundle Ayarları</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*O_EBgMpDiH6295MrcyJCJw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/316/1*iNxErxaoDtWtEqG6cUvz2g.gif" /></figure><p>Bu yazıda uygulamamız için iOS Ayarlar menüsünden uygulamamızı seçtiğimizde konfigüre edebileceğimiz ayarları nasıl ekleyebiliriz, bu ayarlar ile koddan nasıl haberleşebiliriz (okuma, yazma yapabiliriz). Bundan bahsetmeye çalışacağım.</p><p><strong>Neden kullanalım?</strong></p><p>Gerçek bir örnek vermek gerekirse, geliştirme yaptığımız bir uygulamanın <em>development, preproduction, production</em> gibi farklı ortamlarda test edilmesi ihtiyacı vardı. Bunu da her bir ortam için ayrı ayrı paket (uygulama) oluşturarak yapmak malumunuz oldukça zahmetli olurdu ve de bir hayli vakit kaybettirirdi.</p><p>Tam da bu gibi senaryolar için oldukça uygun olan bu Settings.bundle kullanımını bir de beraber incelemeye ne dersiniz.</p><p>Belki de devam ettikçe sizin uygulamanız için daha uygun olan bir senaryo aklınıza gelir.</p><p>O zaman demo için yeni bir proje oluşturalım ve işe koyulalım.</p><p>Projeyi oluşturduktan sonra yeni dosya oluşturalım (⌘ + N) ve Settings.bundle dosyasını seçelim.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/776/1*v4OY0TquI5tjX5fhS9CBZw.png" /><figcaption>Settings.bundle</figcaption></figure><p>Dosyamızı seçtikten sonra tüm UI bileşenlerini görebilelim diye 6 tanesini de ekledim.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LjsUDkrkz1zzU9plW6rISg.png" /></figure><p>Evet meşhur dosyamız budur (Root.plist), <strong>Preference Items</strong> altında kullanabileceğimiz UI elemanlarını görebiliriz.</p><p>Zaten Xcode otomatik tamamlama ile bize yardımcı oluyor yani elemanların (Item) isimlerini ezberlememize gerek yok.</p><p><strong>UI bileşenlerin listesi</strong></p><ol><li>Group</li><li>Multi Value</li><li>Slider</li><li>Text Field</li><li>Title</li><li>Toggle Switch</li></ol><p>Yazıyı çok da uzatmamak adına tüm bileşenleri incelemeyeceğiz. Zaten uygulama içerisinde aşina olduğunuz bileşenler. (Textfield, Toggle gibi)</p><p>1 ve 2 numaralı bileşeni kullanalım.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mjYJ_DUXtwgbnR2SqmF4oA.png" /></figure><p>Kaçırdığımız bir yer yok ise, telefonun Ayarlar menüsünden uygulamamızı seçtiğimizde aşağıdaki gibi bir görsel elde etmeliyiz.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*p9b2juK3dqDo5_7pdjtduA.png" /></figure><p><strong>Peki bu bileşenler ile uygulama içinden nasıl haberleşebiliriz?</strong></p><p>Bu bileşenlerin <strong><em>identifier </em></strong>isimli bir parametresi var, bu parametreyi kullanarak koddan ilgili arkadaşa erişebiliriz.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2cfb9a6aeb7c7dec7a0188a750ee52eb/href">https://medium.com/media/2cfb9a6aeb7c7dec7a0188a750ee52eb/href</a></iframe><p>Malum örneğimizi network environment ile alakalı seçtiğimizden bunun için uygun kullanım yeri de uygulamamızın başlangıcı yani AppDelegate olsa gerek.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/54784ce7c57355f214d33058a4d0808c/href">https://medium.com/media/54784ce7c57355f214d33058a4d0808c/href</a></iframe><p>Evet buraya kadar takip ettiyseniz seçtiğimiz 2 değer arasında değişiklik yaparak, konsoldan ilgili değeri okuyabilirsiniz.</p><p>Benim de bu yazıyı yazarken farkettiğim, önemli bir detayı da paylaşmak istiyorum. Settings.bundle dosyasının plist’inde setlediğimiz varsayılan değer (Default Value) gösteriş içinmiş, yani yukarıda bahsettiğimiz adımları takip edip ayarlardan uygulamamıza girmedikçe ve <strong>değişiklik yapmadıkça </strong>işletim sistemi UserDefaults’a ilk kaydı yapmıyor, özetle plist’te ki varsayılan değeri değil de koddan setlenilen değeri göz önünde bulundurmalıyız.</p><p>Yine uygulama içinden ilgili identifier kullanılarak bundle’a yazma işlemi de yapabiliriz ancak bu durumla alakalı mantıklı bir senaryo aklıma gelmiyor, sadece mümkün olduğu bilgisini vermek istedim.</p><p><strong>1&#39;den fazla bundle kullanabilir miyim?</strong></p><p>Evet, misalen Release ve Debug paketleri için farklı Bundle dosyaları kullanılabilir.</p><p><strong>Sadece development için bundle kullanabilir miyim?</strong></p><p>Tabii ki, basitçe bir script ile bunu sağlamak mümkün.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iB_0n8GKeTCT7f0onO7lqw.png" /></figure><pre>BUILD_APP_DIR=${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app<br><br>if [ &quot;$CONFIGURATION&quot; == &quot;Release&quot; ]; then<br>rm -Rf $BUILD_APP_DIR/Settings.bundle<br>fi</pre><p>Bundle dosyasını oluştururken kaydettiğiniz konumu da dikkate alarak uygun path i yazdığımıza emin olalım.</p><p>Uygulamayı store için hazırladığımızda bu ayarlar kullanıcıda gözükmemiş olacak.</p><p>Evet vakit ayırdığınız için teşekkür ederim, umarım uygulamanızda kullanabileceğiniz bu ya da farklı senaryolar için faydalı bir yazı olmuştur.</p><p>Projeye de buradan erişebilirsiniz.</p><p><a href="https://github.com/EnesKaraosman/SettingsBundleDemo.git">EnesKaraosman/SettingsBundleDemo</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=67329d12cff4" width="1" height="1" alt=""><hr><p><a href="https://medium.com/etiya/settings-bundle-on-ios-67329d12cff4">Settings Bundle on iOS</a> was originally published in <a href="https://medium.com/etiya">Etiya</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>