<?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 Mahendra Patel on Medium]]></title>
        <description><![CDATA[Stories by Mahendra Patel on Medium]]></description>
        <link>https://medium.com/@mahendra-patel?source=rss-273e4be0d927------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*dmbNkD5D-u45r44go_cf0g.png</url>
            <title>Stories by Mahendra Patel on Medium</title>
            <link>https://medium.com/@mahendra-patel?source=rss-273e4be0d927------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 15:19:29 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mahendra-patel/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[SwiftUI Performance Best Practices for iOS Apps]]></title>
            <link>https://mahendra-patel.medium.com/swiftui-performance-best-practices-for-ios-apps-d792630179cb?source=rss-273e4be0d927------2</link>
            <guid isPermaLink="false">https://medium.com/p/d792630179cb</guid>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[performance-management]]></category>
            <category><![CDATA[swift-programming]]></category>
            <category><![CDATA[swiftui]]></category>
            <dc:creator><![CDATA[Mahendra Patel]]></dc:creator>
            <pubDate>Fri, 19 Dec 2025 04:48:56 GMT</pubDate>
            <atom:updated>2025-12-19T04:48:56.036Z</atom:updated>
            <content:encoded><![CDATA[<p>The performance of an application is a critical part of the app development lifecycle. Ensuring your app runs smoothly not only improves usability but also keeps users engaged and satisfied.</p><p>When developing an iOS app, there are several best practices you should keep in mind to maintain optimal performance.</p><p>Here are some key ones to consider…</p><h3><strong>1. Minimize View Recomputation</strong></h3><p>SwiftUI re-renders when state changes, but unnecessary recomputation kills FPS.</p><p><strong>Use @StateObject instead of @ObservedObject</strong></p><p>@StateObject ensures the object is created <strong>once</strong>.</p><pre>class ViewModel: ObservableObject {}<br><br>struct ContentView: View {<br>    @StateObject var vm = ViewModel()<br>}</pre><p><strong>Why View Recomputation Happens?</strong></p><p>SwiftUI recreates your View structs very frequently - even on small UI updates.</p><p>This is normal and part of how SwiftUI works.</p><p>But…</p><p>If your <strong>view model</strong> gets recreated every time the view is recreated, then…</p><ul><li>All your state resets</li><li>API calls re-trigger</li><li>Published properties emit again</li><li>The entire view hierarchy refreshes</li></ul><p>This is where property wrappers matter.</p><p><strong>@ObservedObject RE-CREATES the object when the view refreshes</strong></p><pre>struct ContentView: View {<br>    @ObservedObject var vm = ViewModel()   // ❌ BAD: recreated on every body refresh<br>}</pre><p>When ContentView recomputes its body, SwiftUI <strong>creates a new ContentView struct</strong>, which means a <strong>new ViewModel()</strong> is created every time too.</p><p>This causes:</p><ul><li>Lost state</li><li>Cancelled tasks</li><li>Duplicate network calls</li><li>Excessive UI updates</li></ul><h3><strong>2. Avoid Heavy Work in </strong><strong>body</strong></h3><p>Never calculate data in the body. Because whenever view’s state changes, body of the view recomputed to be in sync with latest state.</p><p><strong>Avoid:</strong></p><pre>var body: some View {<br>    let sorted = items.sorted() // heavy work!<br>    List(sorted) { ... }<br>}</pre><p><strong>Good:</strong></p><pre>var sorted: [Item] {<br>    items.sorted()<br>}</pre><p>and the better approach could be pre-calculate in ViewModel.</p><h3><strong>3. Move Business Logic Out of Views</strong></h3><p>SwiftUI Views should be <em>dumb</em>. Those are only responsible to show data to the user. It should not contains any business logic as well.</p><p>The business logic always preferred to be in ViewModels or UseCases.</p><ul><li>Views stay fast</li><li>Rendering work reduces</li><li>Less invalidation chains</li><li>Better testability</li></ul><h3><strong>4. Reduce State Granularity</strong></h3><p>Whenever state changes/updates it triggers view reloads.</p><p>Don’t use one big @State object. Always use light weight state variable inside view and heavy property should be moved to view model.</p><p>For eg.</p><pre>@State var isLoading = false<br>@State var errorMessage: String?</pre><p>Each small state causes fewer invalidations.</p><h3><strong>5. Use .drawingGroup() Carefully</strong></h3><p>This offloads drawing to Metal - amazing for complex shapes.</p><p>But, it increases memory usage.</p><ul><li>Use for: heavy animations, gradients, vector art</li><li>Avoid for: lists, text, images</li></ul><h3><strong>6. Avoid Recreating Identical Views</strong></h3><p>If you create expensive child views inside loops, SwiftUI redraws them.</p><p>Use @ViewBuilder + caching patterns when possible.</p><h3><strong>7. Leverage EquatableView</strong></h3><p>Use when your view should NOT update if input hasn’t changed.</p><pre>EquatableView(content: {<br>    MyRow(item: item)<br>})</pre><p>Or adopt:</p><pre>struct MyRow: Equatable { ... }</pre><p>Huge improvement for lists.</p><h3><strong>8. Use LazyVStack / LazyHStack Instead of Non-Lazy</strong></h3><p>Example:</p><p><strong>VStack inside ScrollView: </strong>It will render ALL children at once irrespective of what is visible on the screen. It is a memory killer. Poor user experience.</p><p><strong>LazyVStack:</strong> It will render only what’s visible on the screen. Smooth scrolling and better user experience.</p><h3><strong>9. Optimize Image Loading</strong></h3><p>Use:</p><ul><li><strong>AsyncImage (iOS 15+):</strong> Leverage AsyncImgae to load images asynchronously. It will useful where images need to be fetched from server.</li><li><strong>Downscaling: </strong>Compress the image if required before showing to the user.</li><li><strong>Caching: </strong>Use caching machanism wherever possible to load resources faster. It will improve user experience (e.g., using SDWebImageSwiftUI)</li></ul><p>Also the following modifiers can be used:</p><pre>.resizable()<br>.interpolation(.medium)</pre><p>Avoid heavy decoding because it blocks UI.</p><h3><strong>10. Avoid Global Animations</strong></h3><p>Animations on parent views animate the entire tree.</p><p>Instead animate only the element that needs it.</p><h3><strong>11. Use Instruments: SwiftUI Template</strong></h3><p>Xcode’s <strong>SwiftUI Performance</strong> instruments template helps detect:</p><ul><li>Excessive diffing</li><li>Slow body recomputations</li><li>View graph explosions</li><li>Layout bottlenecks</li></ul><p>Run it regularly when the UI becomes complex.</p><h3><strong>12. Don’t Abuse GeometryReader</strong></h3><p>GeometryReader is powerful, but it often introduces <strong>unexpected layout behavior</strong> and <strong>performance issues</strong> if not used carefully.</p><p><strong>a. It expands to take all available space</strong></p><p>GeometryReader behaves like a <em>flexible container</em> that wants to take up the entire space of its parent.</p><p>This can lead to:</p><ul><li>Views stretching unexpectedly</li><li>Layouts breaking</li><li>Misalignment issues</li></ul><p>Most beginners expect it to size itself to its content — but it does the opposite.</p><p><strong>b. It causes complex and expensive layout calculations</strong></p><p>Placing GeometryReader deep inside a view hierarchy increases SwiftUI’s layout work because:</p><ul><li>SwiftUI must re-measure everything inside it</li><li>Changes propagate up and down the layout tree</li><li>Recalculations happen more frequently</li></ul><p>This can slow down scrolling or animations.</p><p><strong>c. Using it inside a List or ScrollView is costly</strong></p><p>GeometryReader inside dynamic content (like rows in a List) triggers:</p><ul><li>Frequent re-layouts</li><li>More diffing</li><li>Unnecessary view updates</li></ul><p>This is especially bad when used for things like detecting scroll position.</p><p><strong>d. It often leads to view invalidation loops</strong></p><p>If your GeometryReader updates a @State based on size or position, it can cause:</p><ul><li>Continuous re-renders</li><li>Janky animations</li><li>Infinite loops (in worst cases)</li></ul><p><strong>When to use it?</strong></p><p>Use GeometryReader when you <em>truly</em> need layout information:</p><ul><li>Parallax effects</li><li>Custom animations</li><li>Dynamic sizing based on container size</li><li>Reading safe area / screen bounds</li></ul><p>But keep it lightweight and isolated. Use it only when needed.</p><h3><strong>13. Prefer structs for Models (Value Types)</strong></h3><p>SwiftUI works best with value types - avoids reference invalidation chains.</p><p>Always create model classes as <em>struct.</em></p><h3><strong>Bonus: List Performance Tips</strong></h3><ul><li><strong>Give Rows Stable IDs</strong></li></ul><pre>List(items, id: \.id) { item in … }</pre><ul><li><strong>Avoid Complex Row Layouts</strong></li></ul><p>Compose small views instead of one giant dynamic row.</p><ul><li><strong>Avoid using ForEach(0..&lt;…)</strong></li></ul><p>Use identifiable models or values.</p><p>So these are the points a developer need to be remember or follow while working on SwiftUI applications. Considering these points will indeed improve the overall SwiftUI app’s performance.</p><p>Thanks for reading and Follow for more such articles.</p><p>You can connect me on <a href="https://www.linkedin.com/in/mahendragpatel">LinkedIn</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d792630179cb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[VIPER architecture in iOS App]]></title>
            <link>https://mahendra-patel.medium.com/viper-architecture-in-ios-app-4eea10a27098?source=rss-273e4be0d927------2</link>
            <guid isPermaLink="false">https://medium.com/p/4eea10a27098</guid>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[clean-architecture]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[viper-architecture]]></category>
            <category><![CDATA[mobile-app-development]]></category>
            <dc:creator><![CDATA[Mahendra Patel]]></dc:creator>
            <pubDate>Wed, 10 Dec 2025 06:51:07 GMT</pubDate>
            <atom:updated>2025-12-10T06:51:07.267Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>What is VIPER Architecture?</strong></h3><p><strong>VIPER</strong> is a <strong>clean, modular architecture pattern</strong> used in iOS development to improve code separation, maintainability, testability, and scalability — especially for large and complex apps.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/681/1*BxCsrqF-fWr6Y4jGRA-bUQ.jpeg" /></figure><p><strong>VIPER</strong> stands for:</p><p><strong>V (View):</strong></p><p>Displays information to the user and receives user interactions.</p><ul><li>Contains no business logic.</li><li>Communicates only with the <strong>Presenter</strong>.</li></ul><p><strong>I (Interactor):</strong></p><p>Contains the <strong>business logic</strong>, independent of UI.</p><ul><li>Fetches data from APIs, database, or services.</li><li>Returns data back to the <strong>Presenter</strong>.</li></ul><p><strong>P (Presenter):</strong></p><p>Acts as the “middleman.”</p><ul><li>Gets inputs from View</li><li>Requests data from Interactor</li><li>Formats data for the View</li><li>Tells Router when to navigate</li><li><strong>Thin View + Thin Interactor + Presenter orchestrates everything</strong></li></ul><p><strong>E (Entity):</strong></p><p>Represents data models (structs/classes).</p><p>· Should be pure data models</p><p>· It should not contain any logic</p><p><strong>R (Router):</strong></p><p>Handles navigation and module creation.</p><ul><li>Push/pop/present ViewControllers</li><li>Builds the VIPER module</li><li>Eliminates navigation logic from View and Presenter</li></ul><h3><strong>How VIPER is Implemented in iOS?</strong></h3><p>VIPER is usually implemented <strong>per screen or feature</strong>, where each module contains:</p><pre>ModuleName/<br>     ├── View/<br>     ├── Presenter/<br>     ├── Interactor/<br>     ├── Router/<br>     ├── Entity/</pre><p><strong>Create Protocols for Each Layer</strong></p><p>Using protocols ensures clean boundaries and avoids tight coupling.</p><pre>protocol HomeViewProtocol: AnyObject {<br>    func showData(_ data: [String])<br>}<br><br>protocol HomePresenterProtocol {<br>    func viewDidLoad()<br>}<br><br>protocol HomeInteractorProtocol {<br>    func fetchItems()<br>}<br><br>protocol HomeRouterProtocol {<br>    static func createModule() -&gt; UIViewController<br>}</pre><p><strong>Implement the View</strong></p><p>The ViewController talks only to the Presenter.</p><pre>class HomeViewController: UIViewController, HomeViewProtocol {<br>    var presenter: HomePresenterProtocol!<br><br>    override func viewDidLoad() {<br>        super.viewDidLoad()<br>        presenter.viewDidLoad()<br>    }<br><br>    func showData(_ data: [String]) {<br>        print(data)<br>    }<br>}</pre><p><strong>Implement the Interactor</strong></p><p>Contains business and data logic.</p><pre>protocol HomeInteractorOutputProtocol: AnyObject {<br>    func didFetchItems(_ items: [String])<br>}<br><br>class HomeInteractor: HomeInteractorProtocol {<br>    weak var presenter: HomeInteractorOutputProtocol?<br><br>    func fetchItems() {<br>        let items = [&quot;One&quot;, &quot;Two&quot;, &quot;Three&quot;]  // e.g., from API or DB<br>        presenter?.didFetchItems(items)<br>    }<br>}</pre><p><strong>Implement the Router</strong></p><p>Creates the module and handles navigation.</p><pre>class HomeRouter: HomeRouterProtocol {<br>    static func createModule() -&gt; UIViewController {<br>        let view = HomeViewController()<br>        let presenter = HomePresenter()<br>        let interactor = HomeInteractor()<br>        let router = HomeRouter()<br><br>        view.presenter = presenter<br>        presenter.view = view<br>        presenter.router = router<br>        presenter.interactor = interactor<br>        interactor.presenter = presenter<br><br>        return view<br>    }<br>}</pre><h3><strong>Benefits of VIPER:</strong></h3><ul><li><strong>High testability</strong> (each layer is isolated) - Easy unit testing (Presenter/Interactor tests are straightforward)</li><li><strong>Scalability - </strong>New features/module can be easily added</li><li><strong>Very modular - </strong>ideal for large apps</li><li><strong>Strict separation of concerns - </strong>Separate actor for each task like (Interactor, Presenter, Router, etc.)</li><li>Easy to plug-in / modify components</li><li>Simplifies team collaboration (each member can work on different layers)</li></ul><p>Follow me on LinkedIn: <a href="https://www.linkedin.com/in/mahendragpatel/">Mahendra Patel</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4eea10a27098" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Basics of Combine]]></title>
            <link>https://mahendra-patel.medium.com/basics-of-combine-10dc48bd10f4?source=rss-273e4be0d927------2</link>
            <guid isPermaLink="false">https://medium.com/p/10dc48bd10f4</guid>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[asynchronous-programming]]></category>
            <category><![CDATA[swiftui]]></category>
            <category><![CDATA[combine-framework]]></category>
            <dc:creator><![CDATA[Mahendra Patel]]></dc:creator>
            <pubDate>Tue, 14 Oct 2025 05:56:02 GMT</pubDate>
            <atom:updated>2025-10-14T05:56:02.101Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>What is Combine?</strong></p><ul><li><strong>Combine</strong> is Apple’s <strong>reactive programming framework</strong> introduced in <strong>iOS 13</strong>.</li><li>Provides a <strong>declarative APIs</strong> for processing asynchronous events over time.</li><li>Helps developers to manage <strong>asynchronous data streams</strong> (for eg. user input, network responses, system notifications, etc.)</li><li>We can <strong>build a pipeline</strong> for the <strong>complex tasks</strong> which handles the asynchronous operations with ease</li></ul><h3><strong>Backbone of Combine</strong></h3><p>There are 3 main components of Combine framework. <strong>Publisher,</strong> <strong>Subscriber</strong>, <strong>Operator</strong> (and ofcourse <strong>Subject</strong>)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/887/1*MRhT0kt6b_k7qIY9EmMO3g.png" /></figure><h3><strong>Publisher:</strong></h3><ul><li>It is a <strong>core component</strong> that represents a <strong>stream of values</strong> that are emitted over time.</li><li>It defines <strong>how and when values or errors are delivered</strong> to a <strong>Subscriber</strong>.</li><li>A <strong>Publisher</strong> is a type that <strong>produces a sequence of values</strong> or <strong>completes with an error</strong>. It doesn’t start emitting values until a <strong>Subscriber</strong> subscribes to it.</li></ul><p><strong>Key Characteristics:</strong></p><ul><li>Emits <strong>zero or more values</strong> over time.</li><li>Ends with either <strong>completion</strong> or <strong>failure</strong>.</li><li>Works with various operators to transform or filter values.</li><li>Can be created from various sources: <strong>URLSession</strong>, <strong>NotificationCenter</strong>, <strong>Timers</strong>, etc.</li></ul><p><strong>Popular Publishers are…</strong></p><ul><li>Just: Emits a single value, then finishes.</li><li>Empty: Emits no values and immediately finishes.</li><li>Fail: Immediately terminates with an error.</li><li>Future: Emits a single value asynchronously.</li><li>PassthroughSubject / CurrentValueSubject: Subjects that can manually emit values.</li></ul><p><strong>Publisher Protocol</strong></p><p>Publisher is a protocol in the Combine framework which has <strong>Output</strong> and <strong>Failure</strong>(Error) as an associated type.</p><pre>public protocol Publisher&lt;Output, Failure&gt; {<br>  associatedtype Output<br>  associatedtype Failure: Error<br><br>  func receive&lt;S&gt;(subscriber: S) where S: Subscriber,<br>                                  Self.Failure == S.Failure, <br>                                  Self.Output == S.Input<br>}</pre><p>Here,</p><p><strong>Output: </strong>a kind of value can be published by Publisher.</p><p><strong>Failure: </strong>a kind of errors a publisher might publish. <strong>Never</strong> is used if the publisher <strong>never emit an error</strong>.</p><p>for eg.</p><pre>import Combine<br><br>//Just publisher that emits a single value<br>let publisher = Just(&quot;Hello, Combine!&quot;)<br>publisher<br>    .sink { completion in<br>        print(&quot;Completed: \(completion)&quot;)<br>    } receiveValue: { value in<br>        print(&quot;Received value: \(value)&quot;)<br>    }<br><br>//Output<br>//Received value: Hello, Combine!<br>//Completed: finished</pre><h3><strong>Subscriber:</strong></h3><ul><li>It is the <strong>counterpart to a Publisher</strong> — it <strong>receives and reacts</strong> to values or completion events emitted by a publisher.</li><li>It <strong>subscribe to publishers</strong> to start receiving data, and they control how much data they want through <strong>backpressure</strong>.</li><li>Ultimately it is a type that <strong>receives values, errors, and completion events</strong> from a <strong>Publisher</strong>.</li></ul><p><strong>Responsibilities of a Subscriber:</strong></p><ul><li><strong>Subscribes</strong> to a publisher.</li><li><strong>Handles incoming values</strong> via receive(_:).</li><li><strong>Handles completion or errors</strong> via receive(completion:).</li><li><strong>Controls demand</strong> (how many values it wants) using backpressure.</li></ul><p><strong>Popular Subscriber are..</strong></p><ul><li><strong>sink</strong>: A lightweight subscriber for handling values and completions.</li><li><strong>assign(to:on:)</strong>: Binds published values directly to a property.</li></ul><p><strong>Subscriber Protocol:</strong></p><p>Subscriber is a protocol in the Combine framework which has <strong>Input</strong> and <strong>Failure</strong> as an associated type.</p><pre>protocol Subscriber {<br>    associatedtype Input<br>    associatedtype Failure: Error<br><br>    func receive(subscription: Subscription)<br>    func receive(_ input: Input) -&gt; Subscribers.Demand<br>    func receive(completion: Subscribers.Completion&lt;Failure&gt;)<br>}</pre><p>Here,</p><p><strong>Input:</strong> a kind of values subscriber can receive.</p><p><strong>Failure: </strong>a kind of error subscriber might receive. <strong>Never</strong> is used if subscriber can not receive errors.</p><pre>import Combine<br><br>let publisher = Just(&quot;Hello, Combine!&quot;)<br><br>let cancellable = publisher<br>    .sink { completion in. // sink is a built-in subscriber in Combine<br>        print(&quot;Completed: \(completion)&quot;)<br>    } receiveValue: { value in<br>        print(&quot;Received value: \(value)&quot;)<br>    }<br><br>//Output<br>//Received value: Hello, Combine!<br>//Completed: finished</pre><h3><strong>Operators:</strong></h3><ul><li>These are <strong>building blocks</strong> in Combine that let you define how data flows from publishers to subscribers in a <strong>declarative and chainable</strong> way.</li><li>An <strong>Operator</strong> is a <strong>method</strong> you call on a <strong>Publisher</strong> to <strong>transform, filter, combine, or otherwise process the data</strong> it emits before it reaches a Subscriber.</li></ul><p><strong>Role of Operators in Combine</strong></p><ul><li>Operators are <strong>functions on publishers</strong>.</li><li>They help you build <strong>data pipelines</strong> in a clean, declarative style.</li><li>Each operator <strong>returns a new publisher</strong>, so you can <strong>chain</strong> them.</li></ul><p>Operators let you:</p><ul><li><strong>Transform</strong> data (using map, compactMap)</li><li><strong>Filter</strong> values (using filter, removeDuplicates)</li><li><strong>Combine</strong> multiple publishers (using merge, combineLatest, zip)</li><li><strong>Handle errors</strong> (using catch, replaceError)</li><li><strong>Control timing</strong> (using debounce, delay, throttle)</li><li><strong>Manage events</strong> (using handleEvents, print)</li></ul><pre>import Combine<br><br>let numbers = [1, 2, 3, 4, 5]<br>let publisher = numbers.publisher<br><br>let cancellable = publisher<br>    .filter { $0 % 2 == 0 }      // Only even numbers<br>    .map { &quot;Number: \($0)&quot; }     // Transform to string<br>    .sink { value in<br>        print(value)<br>    }<br><br>//Output<br>//Number: 2<br>//Number: 4</pre><p><strong>Most Popular Combine Operators are…</strong></p><p>map: Transforms each value using a closure.</p><p>compactMap: Transforms and removes nil results.</p><p>filter: Emits only values that match a condition.</p><p>merge: Combines multiple publishers into one stream.</p><p>combineLatest: Emits combined latest values from multiple publishers.</p><p>zip: Pairs values from multiple publishers sequentially.</p><p><em>There will be a separate article in detail on Operators.</em></p><p><strong>How Combine works in Swift?</strong></p><ul><li>The publisher emits the event or a value</li><li>The operators are used to transform, filter, manipulate or combine the values emitted by upstream publisher and then passed to downstream</li><li>The subscriber has the subscription to the publisher. Subscriber received the updated or modified values from up stream.</li><li>The subscriber also receive the completion send by Publisher i.e. finished (success) or failure</li><li>If an error occurred in the pipeline, the subscriber will receive the status in sink’s completion block.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S-564MdE29BTj0bFI6_KvQ.png" /></figure><h3><strong>Subject:</strong></h3><ul><li>a <strong>Subject</strong> is a special type of <strong>Publisher</strong> that you can <strong>manually control. </strong>It lets you <strong>inject values</strong> into a Combine pipeline <strong>imperatively</strong>, unlike typical publishers which emit values based on external events or data sources.</li><li>It can be both a <strong>Publisher</strong> and a <strong>Subscriber</strong>.</li><li>You can <strong>send values</strong>, <strong>send errors</strong>, or <strong>complete</strong> the stream manually.</li><li>Useful for bridging non-Combine code (like delegates or callbacks) into Combine.</li></ul><p><strong>Types of Subjects</strong></p><p><strong>PassthroughSubject: </strong>Doesn’t retain any value. Emits only new values to subscribers.</p><p><strong>CurrentValueSubject: </strong>Stores and re-emits the <strong>most recent value</strong> to new subscribers.</p><pre>import Combine<br><br>let subject = PassthroughSubject&lt;String, Never&gt;()<br><br>let cancellable = subject.sink { value in<br>    print(&quot;Received: \(value)&quot;)<br>}<br><br>subject.send(&quot;Hello&quot;)<br>subject.send(&quot;World&quot;)<br><br>//Output<br>//Received: Hello  <br>//Received: World</pre><h4><strong>Summary</strong></h4><p><strong>Combine</strong> is Apple’s declarative reactive framework introduced in iOS 13, designed to simplify handling of asynchronous events and data streams using a consistent, composable API.</p><p>At its core, Combine works with <strong>Publishers</strong>, which emit values over time, and <strong>Subscribers</strong>, which receive and respond to those values. Developers can transform or manipulate these data streams using <strong>Operators</strong> such as map, filter, combineLatest, and debounce, allowing for clean and readable code.</p><p><strong>Subjects</strong> are special publishers that also act as subscribers, enabling manual value injection into a stream</p><p>Combine is particularly useful for tasks like UI bindings, handling user input, networking, timers, and bridging legacy code to a modern, reactive workflow.</p><p>Please share your thoughts in comments below.</p><p>Thank you for reading. Happy Learning :)</p><p>Connect with me on <a href="https://www.linkedin.com/in/mahendragpatel">LinkedIn</a>.</p><p>Follow me for such more articles.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=10dc48bd10f4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Publish iOS app On Firebase App Distribution using Github action]]></title>
            <link>https://mahendra-patel.medium.com/publish-ios-app-on-firebase-app-distribution-using-github-action-1f7105a99fb3?source=rss-273e4be0d927------2</link>
            <guid isPermaLink="false">https://medium.com/p/1f7105a99fb3</guid>
            <dc:creator><![CDATA[Mahendra Patel]]></dc:creator>
            <pubDate>Tue, 15 Jul 2025 10:50:26 GMT</pubDate>
            <atom:updated>2025-07-15T10:50:26.608Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Publish iOS app On Firebase App Distribution using Github action</strong></p><p>In today’s fast-paced development landscape, mastering <strong>Continuous Integration and Continuous Delivery (CI/CD)</strong> for application deployment and distribution has become an essential skill for every developer.</p><p>Automating these processes is crucial for efficiency, consistency, and rapid iteration. While various robust CI/CD platforms are available, such as Azure DevOps, Bitrise, and Jenkins, among others, each offering unique strengths, this discussion will focus specifically on <strong>publishing iOS applications using GitHub Actions</strong>.</p><p><strong>What is Github Actions?</strong></p><p>GitHub Actions is a continuous integration and continuous delivery (CI/CD) platform that is built directly into GitHub. It allows you to automate, customize, and execute your software development workflows directly from your GitHub repository.</p><p>In simple words, you just need to configure a pipeline in such a way that when you run/ trigger it, you just need to wait until it is deployed to your configured place. It automate the entire process of build distribution.</p><p><strong>Benefits of GitHub Actions:</strong></p><ul><li><strong>Automation:</strong> Automates repetitive tasks, saving time and reducing manual errors.</li><li><strong>CI/CD:</strong> Streamlines the build, test, and deployment process.</li><li><strong>Integrated:</strong> Seamlessly integrated with GitHub, providing a unified development experience.</li><li><strong>Customizable:</strong> Highly flexible with YAML configurations, allowing you to define complex workflows.</li><li><strong>Extensible:</strong> A vast marketplace of pre-built actions, and the ability to create your own.</li><li><strong>Scalable:</strong> Runs on GitHub’s infrastructure or your own, supporting various project sizes and needs.</li></ul><p>With the foundational understanding established, it’s time to transition from theory to hands-on implementation! The main goal for this section is to guide you through the process of automating <strong>iOS app distribution to Firebase App Distribution </strong>using GitHub Actions.</p><p>To follow along effectively, please ensure you meet these prerequisites:</p><ul><li><strong>Apple Developer Program:</strong> You’ll need an active <strong>Apple distribution certificate</strong> and an <strong>Ad Hoc provisioning profile</strong> for your application.</li><li><strong>Firebase Project:</strong> A <strong>Firebase app</strong> configured and ready within your Firebase console.</li><li><strong>GitHub Repository:</strong> Your iOS project source code hosted on a <strong>GitHub repository</strong>.</li></ul><p>Once these essentials are covered, we’ll proceed with setting up the required GitHub secrets.</p><p><strong>Signing certificate:</strong></p><p>First either you need to create a certificate or if you’ve already one then just export it from Keychain with private key.</p><p>Select both of the certificate and private key.</p><p>Right click and select “Export 2 items” option.</p><figure><img alt="export certificate from keychain" src="https://cdn-images-1.medium.com/max/1024/1*sH0fYRZrPuE2O1gkxBJ4-A.png" /></figure><p>Give name as you like. For eg. “Distribution_certificate” and click ok.</p><p>It will ask for a password. You can set any password. For eg. <a href="/service/mailto:abc@123">abc@123</a> and click ok.</p><p>The .p12 file is exported.</p><p><strong>Provisioning Profile:</strong></p><p>You need to download it from Apple developer account portal. If you have already then just navigate to the provisioning profile location and copy it and paste it to desktop for conveniency.</p><p>In my case the file was at this location: <em>~/Library/MobileDevice/Provisioning\ Profiles</em></p><p>Now lets save the secrets on repo’s settings page.</p><p><strong>1. Securely Storing Your iOS Signing Certificate</strong></p><p>To enable GitHub Actions to sign your iOS application, you need to provide your <strong>Apple Distribution Certificate</strong> in a secure manner. We will encode the certificate to Base64 and store it as a GitHub secret.</p><p><strong>Step-by-Step Instructions:</strong></p><p><strong>a. Encode Your Distribution Certificate:</strong> Open your terminal and execute the following command:</p><pre>base64 -i /path/to/your/distribution.p12 | pbcopy</pre><ul><li><strong>Replace </strong>&lt;path/to/your/distribution.p12&gt; with the actual file path to your .p12 distribution certificate.</li><li>This command will convert your certificate into a Base64 string and automatically copy it to your clipboard.</li></ul><p><strong>b. Add to GitHub Repository Secrets:</strong> Navigate to your GitHub repository in your web browser, then follow these steps:</p><ul><li>Go to <strong>Settings</strong> (usually found in the top navigation bar of your repository).</li><li>In the left sidebar, click on <strong>Secrets and variables</strong>, then select <strong>Actions</strong>.</li><li>Click the <strong>“New repository secret”</strong> button.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d8tnOfOlLx0cyJ28emsy7Q.png" /></figure><p>Now here give name <strong>CERTIFICATE_ADHOC_BASE64</strong> to the secret and paste the value of last command.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FvEf-jIrBvVr2wLktKui6A.png" /></figure><p><strong>2. Adding password:</strong></p><p>Add password of your signing certificate. You set it while exporting. For eg. <a href="/service/mailto:abc@123">abc@123</a>.</p><p>So, just add new secret and save password with name <strong>P12_PASSWORD</strong></p><p><strong>3. Securely Storing Your iOS Provisioning Profile:</strong></p><p>Similar to the distribution certificate, your <strong>Ad Hoc Provisioning Profile</strong> needs to be encoded and stored as a GitHub secret for your workflow to use during the build and signing process.</p><p><strong>Step-by-Step Instructions:</strong></p><p><strong>a. Encode Your Provisioning Profile:</strong> Open your terminal and execute the following command:</p><pre>base64 -i /path/to/your/profile.mobileprovision | pbcopy</pre><ul><li><strong>Replace </strong>&lt;path/to/your/profile.mobileprovision&gt; with the actual file path to your .mobileprovision file.</li><li>This command will convert your provisioning profile into a Base64 string and copy it to your clipboard.</li></ul><p><strong>b. Add to GitHub Repository Secrets:</strong></p><ul><li>Still within the <strong>Secrets and variables &gt; Actions</strong> section of your GitHub repository settings, click the <strong>“New repository secret”</strong> button again.</li><li>For the <strong>Name</strong>, enter PROVISIONING_PROFILE_BASE64.</li><li>For the <strong>Value</strong>, paste the Base64 string that you copied to your clipboard from the previous command.</li></ul><p><strong>4. Setting Your Keychain Password</strong></p><p>For the GitHub Actions runner to securely handle your signing assets, we’ll define a password for a temporary keychain that will be created during the workflow run.</p><p><strong>Step-by-Step Instructions:</strong></p><p><strong>a. Add New Repository Secret:</strong></p><ul><li>In the same <strong>Secrets and variables &gt; Actions</strong> section of your GitHub repository settings, click the <strong>“New repository secret”</strong> button.</li><li>For the <strong>Name</strong>, enter KEYCHAIN_PASSWORD.</li><li>For the <strong>Value</strong>, enter any strong password you prefer. For example, xyz@123.</li></ul><p>This password will be used to create and unlock a temporary keychain on the GitHub Actions runner, allowing it to access your certificate and provisioning profile during the build process.</p><p><strong>5. Firebase iOS app Id:</strong></p><p>Add a new secret which contains the your id of the iOS app created on Firebase console.</p><p>Set the name as <strong>IOS_FIREBASE_APP_ID_QA</strong> and paste the value copied from firebase console.<em>(I’m deploying for QA environment so I’ve gave name like this.)</em></p><p>The Firebase App Id will look like this:</p><blockquote>1:xx:xxxxxxxx:ios:xxxxxxxxxxxx</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vTjBxd1I5uwEtwRYE3E1dQ.png" /></figure><p><strong>6. Firebase credentials file content:</strong></p><p>First you need to create a service account on google cloud console.</p><p>Link: <a href="https://cloud.google.com/iam/docs/service-accounts-create">https://cloud.google.com/iam/docs/service-accounts-create</a></p><p>Once it is done then you need to create a service account and a key.</p><p>Add new key with name <strong>FIREBASE_CREDENTIAL_FILE_CONTENT</strong> and copy the content of the file you downloaded from <em>console.cloud.google.com</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5PplCWVWHM8CoTNYdVLMng.png" /></figure><p><strong>Create the </strong><strong>ExportOptions.plist File</strong></p><p>To define how your iOS application should be exported (e.g., for Ad Hoc distribution), you need an ExportOptions.plist file. This file specifies various export-related settings.</p><p><strong>Step-by-Step Instructions:</strong></p><ol><li><strong>Create the File:</strong> In the root directory of your iOS project , create a new file named ExportOptions.plist.</li><li><strong>Add the Content:</strong> Copy and paste the following XML content into your newly created ExportOptions.plist file:</li></ol><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;<br>&lt;!DOCTYPE plist PUBLIC &quot;-//Apple//DTD PLIST 1.0//EN&quot; &quot;http://www.apple.com/DTDs/PropertyList-1.0.dtd&quot;&gt;<br>&lt;plist version=&quot;1.0&quot;&gt;<br>&lt;dict&gt;<br>  &lt;key&gt;method&lt;/key&gt;<br>  &lt;string&gt;enterprise&lt;/string&gt; &lt;!-- release-testing, app-store, development, enterprise --&gt;<br>  &lt;key&gt;teamID&lt;/key&gt;<br>  &lt;string&gt;YOUR_TEAM_ID&lt;/string&gt;<br>  &lt;key&gt;signingStyle&lt;/key&gt;<br>  &lt;string&gt;manual&lt;/string&gt;<br>  &lt;key&gt;signingCertificate&lt;/key&gt;<br>  &lt;string&gt;NAME_OF_SIGNING_CERTIFICATE&lt;/string&gt;<br>  &lt;key&gt;provisioningProfiles&lt;/key&gt;<br>  &lt;dict&gt;<br>    &lt;key&gt;APPS_BUNDLE_IDENTIFIER&lt;/key&gt;<br>    &lt;string&gt;PROVISIONING_PROFILE_NAME&lt;/string&gt;<br>  &lt;/dict&gt;<br>&lt;/dict&gt;<br>&lt;/plist&gt;</pre><p><strong>Important Customization:</strong></p><ul><li>NAME_OF_SIGNING_CERTIFICATE: it is a name of the signing certificate. <em>For eg. iPhone Distribution: XXX Pvt Ltd</em></li><li>YOUR_TEAM_ID: Crucially, replace this placeholder with your actual 10-character<strong> Apple Developer Team ID.</strong>You can find your Team ID in your Apple Developer account under &quot;Membership&quot; or within Xcode&#39;s &quot;Signing &amp; Capabilities&quot; section of your project settings. <em>For eg. ASVDD9ZPH6</em></li><li>APPS_BUNDLE_IDENTIFIER: Replace this with the exact Bundle Identifier of your iOS application. <em>For eg. com.abc.app.xx</em></li><li>PROVISIONING_PROFILE_NAME: Replace this with the exact name of your Ad Hoc Provisioning Profile (as seen in your Apple Developer account or Xcode). This is the <em>name</em> of the profile, not its UUID.</li></ul><p>This ExportOptions.plist file will guide Xcode during the archive and export process within your GitHub Actions workflow</p><p><strong>The CI/CD Workflow file</strong></p><p>All preparatory steps are now complete! Let’s shift our focus to the next crucial phase: exploring and understanding the <strong>CI/CD workflow file</strong> that will orchestrate your iOS app’s build and distribution via GitHub Actions.</p><pre>name: QA-Firebase-Distribution<br><br>on:<br>  workflow_dispatch:<br><br>jobs:<br>  build-ios:<br>    runs-on: macos-15<br>    steps:<br>      - name: Checkout Repository<br>        uses: actions/checkout@v4<br>        <br>      - name: Select Xcode version 16.4<br>        run: sudo xcode-select -switch /Applications/Xcode_16.4.app<br><br>      - name: Install the Apple certificate and provisioning profile<br>        env:<br>          BUILD_CERTIFICATE_BASE64: ${{ secrets.CERTIFICATE_ADHOC_BASE64 }}<br>          P12_PASSWORD: ${{ secrets.P12_PASSWORD }}<br>          BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.PROVISIONING_PROFILE_BASE64 }}<br>          KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}<br>        run: |<br>          # create variables<br>          CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12<br>          PP_PATH=$RUNNER_TEMP/build_pp.mobileprovision<br>          KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db<br><br>          # import certificate and provisioning profile from secrets<br>          echo -n &quot;$BUILD_CERTIFICATE_BASE64&quot; | base64 --decode --output $CERTIFICATE_PATH<br>          echo -n &quot;$BUILD_PROVISION_PROFILE_BASE64&quot; | base64 --decode --output $PP_PATH<br><br>          # create temporary keychain<br>          security create-keychain -p &quot;$KEYCHAIN_PASSWORD&quot; $KEYCHAIN_PATH<br>          security set-keychain-settings -lut 21600 $KEYCHAIN_PATH<br>          security unlock-keychain -p &quot;$KEYCHAIN_PASSWORD&quot; $KEYCHAIN_PATH<br><br>          # import certificate to keychain<br>          security import $CERTIFICATE_PATH -P &quot;$P12_PASSWORD&quot; -A -t cert -f pkcs12 -k $KEYCHAIN_PATH<br>          security list-keychain -d user -s $KEYCHAIN_PATH<br><br>          # apply provisioning profile<br>          mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles<br>          cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles<br>          <br>      - name: Build xArchive<br>        run: |<br>          xcodebuild -project MyApp.xcodeproj -scheme &quot;QA-MyApp&quot; -configuration &quot;Release-QA&quot; DEVELOPMENT_TEAM=&quot;ASVDD9ZPH6&quot; -sdk &#39;iphoneos&#39; -destination &#39;generic/platform=iOS&#39; -archivePath build-output/MyApp.xcarchive PROVISIONING_PROFILE=&quot;f45d22c3-rb81–41c7–96a2-re4ecbdefcfc&quot; clean archive CODE_SIGN_IDENTITY=&quot;iPhone Distribution: xxx Pvt Ltd&quot;<br><br>      - name: Export ipa<br>        run: |<br>          xcodebuild -exportArchive -archivePath build-output/MyApp.xcarchive -exportPath build-output/ios -exportOptionsPlist ExportOptions_QA.plist<br>          <br>      - name: Upload application<br>        uses: actions/upload-artifact@v4<br>        with:<br>          name: MyApp.ipa<br>          path: build-output/ios/MyApp.ipa<br>          retention-days: 1<br>          if-no-files-found: error<br>          <br>      - name: Clean up keychain and provisioning profile<br>        if: ${{ always() }}<br>        run: |<br>          security delete-keychain $RUNNER_TEMP/app-signing.keychain-db<br>          rm ~/Library/MobileDevice/Provisioning\ Profiles/build_pp.mobileprovision<br><br>  distribute-ios:<br>    needs: build-ios<br>    runs-on: ubuntu-latest<br>    steps:<br>      - uses: actions/checkout@v2<br>      - uses: actions/download-artifact@v4<br>        with:<br>          name: MyApp.ipa<br><br>      - name: Firebase App Distribution<br>        uses: wzieba/Firebase-Distribution-Github-Action@v1.7.1<br>        with:<br>          appId: ${{secrets.IOS_FIREBASE_APP_ID_QA}}<br>          serviceCredentialsFileContent: ${{secrets.FIREBASE_CREDENTIAL_FILE_CONTENT}}<br>          groups: internal-team  #created tester group on firebase app distribution<br>          file: MyApp.ipa<br>          releaseNotesFile: releaseNotes.txt</pre><p>In above code, you need to replace the value of <strong>DEVELOPMENT_TEAM</strong>, <strong>PROVISIONING_PROFILE</strong> and <strong>CODE_SIGN_IDENTITY</strong>.</p><p>Before we examine the workflow file, let’s clarify a few important aspects:</p><p>A. releaseNotes.txt<strong> </strong>for App Distribution:</p><ul><li>For comprehensive and user-friendly release notes when distributing your app, we’ll utilize a file named releaseNotes.txt.</li><li>You should create this file in your project’s root directory (or a designated location) and populate it with the desired release notes for the current build.</li><li><strong>Fallback Behavior:</strong> If the releaseNotes.txt file is not present or is empty, the workflow is configured to automatically use the last Git commit&#39;s message and author details as the release notes. While convenient, providing a dedicated releaseNotes.txt is highly recommended for clarity and control over your app&#39;s release information.</li></ul><p>B. xcodebuild<strong> </strong>Command for Archiving:</p><ul><li>The workflow will leverage the xcodebuild command-line tool, which is Apple&#39;s primary interface for building Xcode projects.</li><li>Specifically, it will use the archive action to build and prepare your iOS application for distribution, referencing your .xcworkspace file (if your project uses CocoaPods or Swift Package Manager dependencies) to ensure all components are properly compiled. You can refer to Apple&#39;s xcodebuild documentation for detailed usage.</li></ul><p><strong>C. On-Demand Workflow Trigger (</strong><strong>workflow_dispatch):</strong></p><ul><li>This GitHub Actions workflow is designed to be triggered manually.</li><li>By incorporating the workflow_dispatch event, users with appropriate permissions can initiate the build and distribution process directly from the &quot;Actions&quot; tab within your GitHub repository. This provides flexibility, allowing you to control precisely when a new build is distributed, rather than relying solely on code pushes or pull requests.</li></ul><p><strong>Explanation of above yaml file:</strong></p><p>Understanding the on: Section and workflow_dispatch</p><p>The on: keyword in a GitHub Actions workflow YAML file defines the <strong>events that trigger the workflow to run</strong>.</p><pre>on:<br>  workflow_dispatch:</pre><p>workflow_dispatch<strong> </strong>Event<strong>:</strong></p><p>This specific event configures your workflow to be triggered <strong>manually</strong> by a user. When workflow_dispatch: is included in your workflow file:</p><ul><li>A <strong>“Run workflow” button</strong> will appear on the “Actions” tab of your GitHub repository.</li><li>It allows for flexible, controlled execution of your CI/CD process, independent of code pushes or pull requests, which is ideal for scenarios like manual app releases or testing specific configurations.</li></ul><p>This trigger provides a convenient way for developers or release managers to distribute a new build whenever needed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cvkVkq93_MdwQXdqvPjfog.png" /><figcaption>Workflow trigger button</figcaption></figure><pre>jobs:<br>  build-ios:<br>  runs-on: macos-15</pre><p>The jobs can be scheduled over here. Here the job is to build ios and distribute iOS (at end of the file).</p><p>And it runs on MacOS 15 (there are other OS available like ubuntu, windows, etc.).</p><p>These following are the steps used for building and archiving iOS app.</p><pre>steps:<br>  - name: Checkout Repository<br>  uses: actions/checkout@v4</pre><p>The above step will checkout the repository</p><pre>- name: Select Xcode version 16.4<br>  run: sudo xcode-select -switch /Applications/Xcode_16.4.app</pre><p>The above will select the Xcode which will be used to build the app.</p><pre>      - name: Install the Apple certificate and provisioning profile<br>        env:<br>          BUILD_CERTIFICATE_BASE64: ${{ secrets.CERTIFICATE_ADHOC_BASE64 }}<br>          P12_PASSWORD: ${{ secrets.P12_PASSWORD }}<br>          BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.PROVISIONING_PROFILE_BASE64 }}<br>          KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}<br>        run: |<br>          # create variables<br>          CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12<br>          PP_PATH=$RUNNER_TEMP/build_pp.mobileprovision<br>          KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db<br><br>          # import certificate and provisioning profile from secrets<br>          echo -n &quot;$BUILD_CERTIFICATE_BASE64&quot; | base64 --decode --output $CERTIFICATE_PATH<br>          echo -n &quot;$BUILD_PROVISION_PROFILE_BASE64&quot; | base64 --decode --output $PP_PATH<br><br>          # create temporary keychain<br>          security create-keychain -p &quot;$KEYCHAIN_PASSWORD&quot; $KEYCHAIN_PATH<br>          security set-keychain-settings -lut 21600 $KEYCHAIN_PATH<br>          security unlock-keychain -p &quot;$KEYCHAIN_PASSWORD&quot; $KEYCHAIN_PATH<br><br>          # import certificate to keychain<br>          security import $CERTIFICATE_PATH -P &quot;$P12_PASSWORD&quot; -A -t cert -f pkcs12 -k $KEYCHAIN_PATH<br>          security list-keychain -d user -s $KEYCHAIN_PATH<br><br>          # apply provisioning profile<br>          mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles<br>          cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles</pre><p>This step will install the profile and certificate. We have already stored it in “Secret and Variables” section in repo.</p><pre>- name: Build xArchive<br>  run: |<br>    xcodebuild -project MyApp.xcodeproj -scheme &quot;QA-MyApp&quot; -configuration &quot;Release-QA&quot; DEVELOPMENT_TEAM=&quot;ASVDD9ZPH6&quot; -sdk &#39;iphoneos&#39; -destination &#39;generic/platform=iOS&#39; -archivePath build-output/MyApp.xcarchive PROVISIONING_PROFILE=&quot;f45d22c3-rb81–41c7–96a2-re4ecbdefcfc&quot; clean archive CODE_SIGN_IDENTITY=&quot;iPhone Distribution: XXX Pvt Ltd&quot;</pre><p>This will use xcodebuild command to build archive for the ios app.</p><pre>- name: Export ipa<br>  run: |<br>    xcodebuild -exportArchive -archivePath build-output/MyApp.xcarchive -exportPath build-output/ios -exportOptionsPlist ExportOptions_QA.plist</pre><p>The above command will export .ipa file.</p><pre>- name: Upload application<br>  uses: actions/upload-artifact@v4<br>  with:<br>    name: MyApp.ipa<br>    path: build-output/ios/MyApp.ipa<br>    retention-days: 1<br>    if-no-files-found: error</pre><p>The above command will upload the .ipafile to Github you will see it like below on your repo page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7Fw5tU5zMS7fXLNQcBYAAg.png" /></figure><pre>- name: Clean up keychain and provisioning profile<br>  if: ${{ always() }}<br>  run: |<br>    security delete-keychain $RUNNER_TEMP/app-signing.keychain-db<br>    rm ~/Library/MobileDevice/Provisioning\ Profiles/build_pp.mobileprovision</pre><p>The above command will do the clean up. It will remove the certificate and .mobileprovision file as it is no longer needed.</p><pre>  distribute-ios:<br>    needs: build-ios<br>    runs-on: ubuntu-latest<br>    steps:<br>      - uses: actions/checkout@v2<br>      - uses: actions/download-artifact@v4<br>        with:<br>          name: MyApp.ipa<br><br>      - name: Firebase App Distribution<br>        uses: wzieba/Firebase-Distribution-Github-Action@v1.7.1<br>        with:<br>          appId: ${{secrets.IOS_FIREBASE_APP_ID_QA}}<br>          serviceCredentialsFileContent: ${{secrets.FIREBASE_CREDENTIAL_FILE_CONTENT}}<br>          groups: internal-team<br>          file: MyApp.ipa<br>          releaseNotesFile: releaseNotes.txt</pre><p>In the above command, it will download the artifact on the ubuntu machine and then upload to .ipafile to firebase console.</p><p>It will identify the iOS app by the <strong>IOS_FIREBASE_APP_ID_QA</strong> key and authenticate the firebase account using <strong>FIREBASE_CREDENTIAL_FILE_CONTENT</strong> store in repository secrets.</p><p>On Firebase app distribution page, you will see the published app like below image.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MN6BforBpPbDTnhXEthg3w.png" /></figure><p><strong>Conclusion</strong></p><p>Integrating GitHub Actions for iOS app distribution to Firebase App Distribution offers a <strong>streamlined, automated, and highly efficient CI/CD pipeline</strong>.</p><p>By securely managing signing assets and leveraging customizable workflows, developers can significantly reduce manual overhead, accelerate testing cycles, and ensure consistent, reliable delivery of their applications to testers.</p><p>This approach empowers faster feedback loops and ultimately, quicker, more confident releases.</p><p>Feel feee to connect with me on <a href="https://www.linkedin.com/in/mahendragpatel">LinkedIn</a></p><p>Follow me for such more articles.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1f7105a99fb3" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>