<?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 Shubhransh Gupta on Medium]]></title>
        <description><![CDATA[Stories by Shubhransh Gupta on Medium]]></description>
        <link>https://medium.com/@Shubhransh-Gupta?source=rss-cac2f4a35197------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*R7xw9BIT0xa5XwKEQrfI4Q.jpeg</url>
            <title>Stories by Shubhransh Gupta on Medium</title>
            <link>https://medium.com/@Shubhransh-Gupta?source=rss-cac2f4a35197------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 23:21:54 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@Shubhransh-Gupta/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[ What Really Happens When You Archive an iOS App in Xcode?]]></title>
            <link>https://medium.com/@Shubhransh-Gupta/what-really-happens-when-you-archive-an-ios-app-in-xcode-0ed8cda07cfa?source=rss-cac2f4a35197------2</link>
            <guid isPermaLink="false">https://medium.com/p/0ed8cda07cfa</guid>
            <category><![CDATA[ios-app-development]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[xcode]]></category>
            <category><![CDATA[app-store]]></category>
            <category><![CDATA[ios]]></category>
            <dc:creator><![CDATA[Shubhransh Gupta]]></dc:creator>
            <pubDate>Mon, 25 Aug 2025 14:25:27 GMT</pubDate>
            <atom:updated>2025-08-25T14:25:27.031Z</atom:updated>
            <content:encoded><![CDATA[<p>Whether you’re preparing your app for App Store submission, TestFlight testing, or enterprise distribution, the <strong>Archive</strong> process is a crucial step in the iOS development pipeline. But have you ever wondered what actually goes on under the hood when you click <strong>Product &gt; Archive</strong> in Xcode?</p><p>Let’s walk through the process, demystify the files created along the way, and understand why each is important.</p><h3>🚀 What Is “Archiving” in Xcode?</h3><p>In Xcode, <strong>archiving</strong> means packaging your app in a way that it can be signed, validated, and eventually distributed. It’s more than just building the app — it’s preparing it for <strong>distribution-ready delivery</strong>.</p><p>When you choose <strong>Product &gt; Archive</strong>, Xcode creates a self-contained snapshot of your app, which includes:</p><ul><li>A compiled version of your app binary</li><li>Metadata</li><li>dSYMs for crash reporting</li><li>Bitcode (optional)</li><li>Signing information</li></ul><p>This process ensures that your app can be submitted to the App Store or exported for enterprise/internal use.<br>🧩 Key Steps in the Archiving Process</p><p>Here’s what happens under the hood:</p><ol><li><strong>Compilation</strong><br> Xcode compiles your code and resources into a Mach-O binary. This is optimized for the chosen build configuration (typically Release for archives).</li><li><strong>Code Signing</strong><br> Your app is code signed using the appropriate certificate and provisioning profile. This ensures security and verifies that the app hasn’t been tampered with.</li><li><strong>Bundle Creation</strong><br> Xcode assembles all assets, compiled binaries, and Info.plist into a .app bundle.</li><li><strong>Symbol Generation (dSYMs)</strong><br> Xcode generates <strong>debug symbol files</strong> (.dSYM) which are essential for symbolicating crash reports.</li><li><strong>Packaging</strong><br> Finally, everything is bundled into an .xcarchive file – this is your “archive.”<br>📂 What Files Are Created During Archiving?</li></ol><p>Let’s explore what’s inside the .xcarchive file. You can inspect an archive by right-clicking it in the <strong>Organizer</strong> and choosing <strong>&quot;Show in Finder&quot;</strong>, then <strong>&quot;Show Package Contents&quot;</strong>.</p><h4>📁 1. Products/Applications/YourApp.app</h4><ul><li>This is the actual <strong>compiled app binary</strong> ready to be signed and distributed.</li><li>It includes all assets, nibs, compiled Swift/Obj-C code, frameworks, and the Info.plist.</li></ul><blockquote><em>📌 </em><strong><em>Importance:</em></strong><em> This is what gets installed on users’ devices or uploaded to App Store Connect.</em></blockquote><h4>📁 2. dSYMs/YourApp.app.dSYM</h4><ul><li>These are <strong>debug symbol files</strong> used for <strong>crash log symbolication</strong>.</li><li>Without them, crash logs are unreadable gibberish.</li></ul><blockquote><em>📌 </em><strong><em>Importance:</em></strong><em> Essential for debugging and understanding crashes reported by users or TestFlight.</em></blockquote><h4>📁 3. Info.plist</h4><ul><li>Metadata about the archive: bundle ID, version, signing identity, method of distribution, etc.</li></ul><blockquote><em>📌 </em><strong><em>Importance:</em></strong><em> Used by Xcode and Xcode Organizer to display information about the archive. Also required when exporting or validating the archive.</em></blockquote><h4>📁 4. BCSymbolMaps/ (only if using Bitcode)</h4><ul><li>Symbol maps used to symbolicate crash logs when Bitcode is enabled.</li><li>Necessary for the App Store to recompile your app using Bitcode (if enabled).</li></ul><blockquote><em>📌 </em><strong><em>Importance:</em></strong><em> If you don’t include these, App Store crash reports might not be useful.</em></blockquote><h4>📁 5. SCMBlueprint/</h4><ul><li>Metadata about the source control version used during the archive.</li><li>Includes Git commit hashes, branch names, and remote URLs.</li></ul><blockquote><em>📌 </em><strong><em>Importance:</em></strong><em> Useful for tracking which commit/version of your code the archive was built from — great for CI/CD and auditing.</em></blockquote><h4>📁 6. DistributionSummary.plist &amp; Packaging.log</h4><ul><li>Internal logs and metadata generated during the packaging process.</li><li>Help you trace any issues during export or upload.</li></ul><blockquote><em>📌 </em><strong><em>Importance:</em></strong><em> Rarely used in day-to-day dev, but can help debug build/export errors.</em></blockquote><h3>✅ Where Does the Archive Go?</h3><p>By default, archives are stored in:</p><pre>~/Library/Developer/Xcode/Archives/</pre><p>Each archive is timestamped and can be opened from <strong>Xcode &gt; Window &gt; Organizer</strong>.</p><h3>📤 What Happens After Archiving?</h3><p>Once the archive is created, you have a few options via the Organizer:</p><ul><li><strong>Distribute to App Store / TestFlight</strong></li><li><strong>Export for Ad Hoc or Enterprise</strong></li><li><strong>Export as IPA for manual installation</strong></li></ul><p>Depending on the choice, additional files like the .ipa (iOS App file) are created, and Xcode will handle validation, re-signing, and uploading as needed.</p><h3>🔁 Summary: Why Archiving Is More Than Just a Build</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*smYs3Dy7ebBQ1v1AbrWCZg.png" /></figure><p>Archiving is the final gate between development and distribution. Doing it properly ensures you have the tools to <strong>debug</strong>, <strong>track</strong>, and <strong>deliver</strong> your app reliably.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0ed8cda07cfa" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What’s New in WWDC 2024: Exploring Swift Concurrency]]></title>
            <link>https://medium.com/@Shubhransh-Gupta/whats-new-in-wwdc-2024-exploring-swift-concurrency-c39a25806e25?source=rss-cac2f4a35197------2</link>
            <guid isPermaLink="false">https://medium.com/p/c39a25806e25</guid>
            <category><![CDATA[swiftui]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[uikit]]></category>
            <category><![CDATA[swift-concurrency]]></category>
            <dc:creator><![CDATA[Shubhransh Gupta]]></dc:creator>
            <pubDate>Sat, 22 Jun 2024 16:09:40 GMT</pubDate>
            <atom:updated>2024-06-22T16:09:40.736Z</atom:updated>
            <content:encoded><![CDATA[<p>Swift Concurrency has been a hot topic since its initial introduction, and the advancements unveiled at WWDC 2024 have taken it to a whole new level. Apple continues to make it easier for developers to write safe, efficient, and high-performance asynchronous code. In this blog, we’ll dive into the new features and improvements in Swift Concurrency announced at WWDC 2024, with code snippets to illustrate these concepts.</p><h3>Introduction to Swift Concurrency</h3><p>Concurrency in programming allows multiple tasks to run simultaneously, which can significantly improve the performance of applications, especially those with intensive computations or tasks that wait for external resources. Swift Concurrency, first introduced with Swift 5.5, brought async/await, actors, and structured concurrency to make handling asynchronous code more manageable and safe.</p><h3>What’s New in Swift Concurrency (WWDC 2024)</h3><h3>1. Task Groups Enhancements</h3><p>Task Groups allow you to create groups of tasks that run concurrently. The improvements in WWDC 2024 include better error handling and more flexible task management.</p><h4>Code Snippet: Task Groups</h4><pre>import Foundation<br>func fetchAllData() async throws -&gt; [Data] {<br>    var results: [Data] = []<br>    try await withThrowingTaskGroup(of: Data?.self) { group in<br>        for url in [&quot;https://api.example.com/data1&quot;, &quot;https://api.example.com/data2&quot;] {<br>            group.addTask {<br>                guard let url = URL(string: url) else { return nil }<br>                return try? Data(contentsOf: url)<br>            }<br>        }<br>     for try await result in group {<br>            if let data = result {<br>                results.append(data)<br>            }<br>        }<br>    }<br>  return results<br>}</pre><p>In this example, we create a task group to fetch data from multiple URLs concurrently. The withThrowingTaskGroup now better handles errors, allowing for more robust and error-resistant code.</p><h3>2. Async Streams</h3><p>Async Streams simplify the process of handling sequences of asynchronous values, such as live data feeds.</p><h4>Code Snippet: Async Streams</h4><pre>import Foundation<br>func fetchLiveUpdates() -&gt; AsyncStream&lt;String&gt; {<br>    AsyncStream { continuation in<br>        let timer = Timer.scheduledTimer(withTimeInterval: 1.0, repeats: true) { _ in<br>            continuation.yield(&quot;New update at \(Date())&quot;)<br>        }<br>        <br>        continuation.onTermination = { _ in<br>            timer.invalidate()<br>        }<br>    }<br>}<br><br><br>Task {<br>    for await update in fetchLiveUpdates() {<br>        print(update)<br>    }<br>}</pre><p>Here, AsyncStream is used to create a stream of live updates, which emits a new value every second. The continuation.onTermination block ensures the timer is invalidated when the stream ends.</p><h3>3. Improved Actor Model</h3><p>Actors in Swift ensure safe access to shared mutable state in a concurrent environment. The 2024 updates include more efficient data access patterns and interoperability with existing Swift code.</p><h4>Code Snippet: Improved Actors</h4><pre>import Foundation<br><br>actor BankAccount {<br><br>   private(set) var balance: Double = 0.0<br><br><br>   func deposit(amount: Double) {<br>        balance += amount<br>   }<br><br>   func withdraw(amount: Double) -&gt; Bool {<br>        if balance &gt;= amount {<br>            balance -= amount<br>            return true<br>        } else {<br>            return false<br>        }<br>   }<br>}<br><br>let account = BankAccount()<br>Task {<br>    await account.deposit(amount: 100.0)<br>    let success = await account.withdraw(amount: 50.0)<br>    print(&quot;Withdrawal successful: \(success), balance: \(await account.balance)&quot;)<br>}</pre><p>In this example, we define a BankAccount actor to handle deposits and withdrawals safely. The await keyword ensures that each operation completes before the next one starts, maintaining data integrity.</p><h3>4. Task Cancellation Improvements</h3><p>Task cancellation is crucial for managing resources and improving app responsiveness. The latest enhancements provide better control and more predictable behavior when canceling tasks.</p><h4>Code Snippet: Task Cancellation</h4><pre>import Foundation<br><br>func performTask() async {<br>    let task = Task {<br>        for i in 1...10 {<br>            if Task.isCancelled {<br>                print(&quot;Task was cancelled&quot;)<br>                return<br>            }<br>            print(&quot;Task running: \(i)&quot;)<br>            try await Task.sleep(nanoseconds: 1_000_000_000)<br>        }<br>    }<br><br>    // Simulate a cancellation<br>    await Task.sleep(nanoseconds: 3_000_000_000)<br>    task.cancel()<br>}<br><br>Task {<br>    await performTask()<br>}</pre><p>In this code, a task runs a loop, printing a message every second. If the task is canceled (simulated here after 3 seconds), it checks for cancellation and exits gracefully.</p><h3>5. Enhanced Error Handling</h3><p>Improved error handling in Swift Concurrency helps create more robust applications by offering better mechanisms to handle and propagate errors in asynchronous code.</p><h4>Code Snippet: Enhanced Error Handling</h4><pre>import Foundation<br>enum DataError: Error {<br>    case invalidURL<br>    case requestFailed<br>}<br>func fetchData(from urlString: String) async throws -&gt; Data {<br>    guard let url = URL(string: urlString) else {<br>        throw DataError.invalidURL<br>    }<br>    do {<br>        let (data, _) = try await URLSession.shared.data(from: url)<br>        return data<br>    } catch {<br>        throw DataError.requestFailed<br>    }<br>}<br><br>Task {<br>    do {<br>        let data = try await fetchData(from: &quot;https://api.example.com/data&quot;)<br>        print(&quot;Data received: \(data)&quot;)<br>    } catch {<br>        print(&quot;Failed to fetch data: \(error)&quot;)<br>    }<br>}</pre><p>This example demonstrates how to handle errors more effectively in asynchronous functions, using Swift’s error handling mechanisms with async/await.</p><h3>Conclusion</h3><p>The enhancements to Swift Concurrency introduced at WWDC 2024 make it even easier for developers to write efficient and safe asynchronous code. With improvements in task groups, async streams, the actor model, task cancellation, and error handling, Swift continues to evolve as a powerful language for modern application development.</p><p>By incorporating these new features into your projects, you can create more responsive and robust applications. As always, keep experimenting and exploring the capabilities of Swift Concurrency to fully leverage its power in your development workflow. Happy Coding!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2fU05SjR3xv4SnN4SBFeQw.png" /><figcaption><a href="https://www.linkedin.com/in/shubhransh-gupta/">https://www.linkedin.com/in/shubhransh-gupta/</a></figcaption></figure><p>For Quick Connects:</p><p><a href="https://www.linkedin.com/in/shubhransh-gupta/">https://www.linkedin.com/in/shubhransh-gupta</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c39a25806e25" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Introducing Swift Testing: The Future of Testing for iOS Developers]]></title>
            <link>https://medium.com/@Shubhransh-Gupta/introducing-swift-testing-the-future-of-testing-for-ios-developers-80eac02d75d4?source=rss-cac2f4a35197------2</link>
            <guid isPermaLink="false">https://medium.com/p/80eac02d75d4</guid>
            <category><![CDATA[swiftui]]></category>
            <category><![CDATA[ios-app-development]]></category>
            <category><![CDATA[wwdc]]></category>
            <category><![CDATA[testing]]></category>
            <category><![CDATA[ios]]></category>
            <dc:creator><![CDATA[Shubhransh Gupta]]></dc:creator>
            <pubDate>Sun, 16 Jun 2024 07:09:01 GMT</pubDate>
            <atom:updated>2024-06-16T07:15:50.014Z</atom:updated>
            <content:encoded><![CDATA[<p><em>At WWDC 2024, Apple unveiled a groundbreaking new framework for iOS developers: Swift Testing. This new framework offers a host of advantages over the traditional XCTest, making it easier, faster, and more efficient to write and manage tests. Here’s a detailed look at what makes Swift Testing a game-changer for developers.</em></p><h3>Advantages of Swift Testing Over XCTest</h3><h3>1. Clear, Expressive API</h3><p>Swift Testing introduces a highly expressive API that simplifies test declarations using macros. This results in less boilerplate code and more readable tests. The #expect API captures evaluated values directly, making it easier to understand test failures.</p><p><strong>Example with Swift Testing:</strong></p><pre>import Testing<br>@Test func testExample() throws {<br>    try #require(value == expectedValue)<br>}</pre><p><strong>Example with XCTest:</strong></p><pre>import XCTest<br>class ExampleTests: XCTestCase {<br>    func testExample() {<br>        XCTAssertEqual(value, expectedValue)<br>    }<br>}</pre><p>The use of macros in Swift Testing reduces verbosity and enhances clarity, which is especially beneficial for complex test scenarios.</p><h3>2. Parameterized Tests</h3><p>Swift Testing allows for parameterized tests, enabling developers to run the same test with different sets of values. This feature reduces code duplication and increases test coverage.</p><p><strong>Example:</strong></p><pre>import Testing<br>@Test(arguments: [&quot;A Beach&quot;, &quot;By the Lake&quot;, &quot;Camping in the Woods&quot;])<br>func mentionedContinents(videoName: String) async throws {<br>    let videoLibrary = try await VideoLibrary()<br>    let video = try #require(await videoLibrary.video(named: videoName))<br>    #expect(video.mentionedContinents.count &lt;= 3)<br>}</pre><p>In contrast, XCTest requires more boilerplate to achieve the same effect, typically involving manual looping or separate test cases.</p><h3>3. Custom Test Behaviors</h3><p>With Swift Testing, you can customize the behavior of tests or entire test suites using traits. This includes specifying runtime conditions like device types, OS versions, or execution time limits for continuous integration.</p><p><strong>Example:</strong></p><pre>import Testing<br>@Test(.enabled(if: AppFeatures.isCommentingEnabled))<br>func videoCommenting() async throws {<br>    let video = try #require(await videoLibrary.video(named: &quot;A Beach&quot;))<br>    #expect(video.comments.contains(&quot;So picturesque!&quot;))<br>}</pre><p>Custom traits streamline the testing process by making tests more adaptable to different conditions, something that requires more setup in XCTest.</p><h3>4. Easy and Flexible Organization</h3><p>Swift Testing provides multiple ways to organize tests, including hierarchical groups, subgroups, and tags. This allows for flexible management and execution of tests.</p><p><strong>Example:</strong></p><pre>import Testing<br>@Test(&quot;Check video metadata&quot;, .tags(.metadata))<br>func videoMetadata() {<br>    let video = Video(fileName: &quot;By the Lake.mov&quot;)<br>    let expectedMetadata = Metadata(duration: .seconds(90))<br>    #expect(video.metadata == expectedMetadata)<br>}</pre><p>This structure improves the maintainability of large test suites compared to XCTest, which uses a more rigid class-based structure.</p><h3>5. Seamless Integration with Xcode</h3><p>Swift Testing integrates seamlessly with Xcode 16, offering rich inline presentations of test results and support for parallel test execution. Tests can also be run from the command line using the Swift Package Manager.</p><h3>6. Open Source and Cross-Platform</h3><p>Swift Testing is open-source and supports all major platforms, including iOS, macOS, Linux, and Windows. This ensures consistent test behavior across different environments, making it easier to maintain cross-platform projects.</p><h3>7. Compatibility with XCTest</h3><p>One of the key benefits of Swift Testing is its compatibility with XCTest. Developers can run Swift Testing and XCTest side-by-side, allowing for an incremental migration to the new framework without disrupting existing tests.</p><h3>8. Enhanced Concurrency Support</h3><p>Swift Testing integrates seamlessly with Swift Concurrency, allowing tests to run in parallel by default. This makes it easier to write and manage asynchronous tests, improving test execution times.</p><p><strong>Example:</strong></p><pre>import Testing<br>@Test func fetchData() async throws {<br>    let data = try await fetchDataFromServer()<br>    #expect(data.isValid)<br>}</pre><blockquote><strong>Tests in Swift Testing run in parallel by default, taking full advantage of modern multi-core processors. This parallel execution significantly reduces the time required to run large test suites, improving development productivity. Parallel execution ensures that the batch processing and validation run concurrently, speeding up the overall test execution time.</strong></blockquote><blockquote>In contrast, XCTest requires more boilerplate to handle asynchronous tests, typically involving expectations and wait methods.</blockquote><h3>Conclusion</h3><p>Swift Testing represents a significant leap forward in testing for iOS developers. Its expressive API, support for parameterized tests, custom test behaviors, and enhanced concurrency make it a powerful tool for modern app development. With seamless integration into Xcode and compatibility with XCTest, transitioning to Swift Testing can be smooth and gradual.</p><p>To explore Swift Testing further, check out the <a href="https://developer.apple.com/xcode/swift-testing/">official documentation</a> and start experimenting with the new framework in Xcode 16. Happy testing!</p><p>By adopting Swift Testing, you can streamline your testing process, improve code quality, and reduce development time. If you haven’t started using it yet, now is the perfect time to dive in and take your testing to the next level.</p><figure><img alt="https://www.linkedin.com/in/shubhransh-gupta/" src="https://cdn-images-1.medium.com/max/1024/1*n5dd70QnnQXVTk2vHJdUUQ.jpeg" /></figure><p><a href="https://www.linkedin.com/in/shubhransh-gupta/">linkedin.com/in/shubhransh-gupta/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=80eac02d75d4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Highlights from WWDC 2024: What’s New in SwiftUI]]></title>
            <link>https://medium.com/@Shubhransh-Gupta/highlights-from-wwdc-2024-whats-new-in-swiftui-6f31866086bc?source=rss-cac2f4a35197------2</link>
            <guid isPermaLink="false">https://medium.com/p/6f31866086bc</guid>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[apple]]></category>
            <category><![CDATA[swiftui]]></category>
            <category><![CDATA[wwdc]]></category>
            <category><![CDATA[wwdc-2024]]></category>
            <dc:creator><![CDATA[Shubhransh Gupta]]></dc:creator>
            <pubDate>Sat, 15 Jun 2024 06:04:38 GMT</pubDate>
            <atom:updated>2024-06-15T06:08:15.219Z</atom:updated>
            <content:encoded><![CDATA[<p><em>At WWDC 2024, Apple introduced a slew of exciting updates to SwiftUI that promise to make app development more efficient and powerful. Here’s a breakdown of the major changes, explained in simple terms with practical examples and details on the required iOS versions.</em></p><h3>1. Observable and Bindable Macros</h3><h3>Simplifying State Management</h3><p><strong>Available in: iOS 17, macOS 14. <br>Before:</strong> Traditionally, managing state in SwiftUI involved using ObservableObject and @Published. This meant a lot of boilerplate code and sometimes inefficient updates.</p><pre>class User: ObservableObject {<br>    @Published var age: Int = 0<br>    @Published var name: String = &quot;&quot;<br>}</pre><p><strong>After:</strong> Now, with the @Observable macro, you can simplify your state management. The new @Bindable property wrapper makes it easier to create bindings.</p><pre>import Observation<br>@Observable class User {<br>    var age: Int = 0<br>    var name: String = &quot;&quot;<br>}<br>// Usage in a SwiftUI view<br>struct ContentView: View {<br>    @Bindable var user: User<br>    <br>    var body: some View {<br>        Text(&quot;Age: \(user.age)&quot;)<br>        TextField(&quot;Name&quot;, text: $user.name)<br>    }<br>}</pre><blockquote><strong>This new approach ensures that only the necessary parts of the UI update, improving performance and reducing unnecessary code.</strong></blockquote><h3>2. Enhanced List and Table Features</h3><h3>Adding Swipe Actions to Lists</h3><p><strong>Available in: iOS 17, macOS 14<br>New Feature:</strong> SwiftUI now supports swipeActions, which lets you add actions that appear when you swipe an item in a list.</p><pre>List {<br>    ForEach(items) { item in<br>        Text(item.name)<br>            .swipeActions {<br>                Button(&quot;Delete&quot;) {<br>                    // Action<br>                }.tint(.red)<br>            }<br>    }<br>}</pre><h3>Creating Tables</h3><p><strong>Available in: iOS 17, macOS 14<br>New Feature:</strong> SwiftUI introduces a Table view for handling tabular data more efficiently.</p><pre>struct ContentView: View {<br>    var data = [<br>        (&quot;Apple&quot;, 50),<br>        (&quot;Banana&quot;, 30),<br>        (&quot;Cherry&quot;, 20)<br>    ]<br>    <br>    var body: some View {<br>        Table(data, id: \.0) { item in<br>            TableColumn(&quot;Fruit&quot;, value: \.0)<br>            TableColumn(&quot;Quantity&quot;, value: \.1)<br>        }<br>    }<br>}</pre><p>Tables support sorting, selection, and more, making it easier to present and manipulate data in your app.</p><h3>3. Chart Improvements</h3><h3>Creating Interactive Pie Charts</h3><p><strong>Available in: iOS 17, macOS 14<br></strong>SwiftUI Charts have been enhanced with new features, including SectorMark for interactive pie charts.</p><pre>struct DonutChart: View {<br>    var salesData = [(&quot;Apple&quot;, 50), (&quot;Banana&quot;, 30), (&quot;Cherry&quot;, 20)]<br>    <br>    var body: some View {<br>        Chart(data: salesData, id: \.0) { element in<br>            SectorMark(<br>                angle: .value(&quot;Sales&quot;, element.1),<br>                innerRadius: .ratio(0.6)<br>            ).foregroundStyle(by: .value(&quot;Fruit&quot;, element.0))<br>        }<br>    }<br>}</pre><p>This makes it easier to visualize data in a more engaging way.</p><h3>4. State and Environment Enhancements</h3><h3>Passing State into Environment</h3><p><strong>Available in: iOS 17, macOS 14<br></strong>You can now pass @State properties into the environment, which streamlines how state is shared across views.</p><pre>@main<br>struct MyApp: App {<br>    @State private var currentUser: User?<br>    <br>    var body: some Scene {<br>        WindowGroup {<br>            ContentView()<br>                .environment(currentUser)<br>        }<br>    }<br>}<br><br>struct ContentView: View {<br>    @Environment(User.self) private var currentUser: User?<br>    <br>    var body: some View {<br>        if let user = currentUser {<br>            Text(&quot;Welcome, \(user.name)&quot;)<br>        } else {<br>            Text(&quot;Please log in&quot;)<br>        }<br>    }<br>}</pre><p>This enhancement simplifies the process of passing state through the view hierarchy.</p><h3>5. SF Symbols and Graphics</h3><h3>New SF Symbols and Rendering Modes</h3><p><strong>Available in: iOS 17, macOS 14<br></strong>Apple added many new SF Symbols and introduced hierarchical and palette rendering modes, which improve the visual quality and customization of icons in your app.</p><pre>Image(systemName: &quot;star.fill&quot;)<br>    .symbolRenderingMode(.hierarchical)<br>    .foregroundStyle(.blue)</pre><h3>Using Materials for Blurry Backgrounds</h3><p><strong>Available in: iOS 17, macOS 14<br></strong>You can now use materials to create blurry, translucent backgrounds, adding depth to your UI.</p><pre>Text(&quot;Hello, World!&quot;)<br>    .background(.ultraThinMaterial)</pre><h3>6. StoreKit Integration</h3><h3>SubscriptionStoreView for In-App Purchases</h3><p><strong>Available in: iOS 17, macOS 14<br></strong>SwiftUI now includes a SubscriptionStoreView to simplify presenting in-app purchase options.</p><pre>import StoreKit<br>struct ContentView: View {<br>    var body: some View {<br>        SubscriptionStoreView(groupID: &quot;com.example.app.subscriptions&quot;) {<br>            Text(&quot;Subscribe for more features!&quot;)<br>        }<br>    }<br>}</pre><p>This makes it easier to implement and customize subscription-based features in your app.</p><p>These updates to SwiftUI, introduced at WWDC 2024, promise to make app development faster, more efficient, and more enjoyable. By leveraging these new features, you can create more responsive and visually appealing apps with less code and complexity. Happy coding!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*n5dd70QnnQXVTk2vHJdUUQ.jpeg" /></figure><p><a href="https://www.linkedin.com/in/shubhransh-gupta/">https://www.linkedin.com/in/shubhransh-gupta/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6f31866086bc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Clean Code: A Summary]]></title>
            <link>https://medium.com/@Shubhransh-Gupta/clean-code-a-summary-386220364a5e?source=rss-cac2f4a35197------2</link>
            <guid isPermaLink="false">https://medium.com/p/386220364a5e</guid>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[clean-code]]></category>
            <category><![CDATA[clean-architecture]]></category>
            <dc:creator><![CDATA[Shubhransh Gupta]]></dc:creator>
            <pubDate>Sat, 08 Jun 2024 06:32:13 GMT</pubDate>
            <atom:updated>2024-06-08T06:32:13.727Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>“Clean Code” by Robert C. Martin (Uncle Bob)</strong> is a must-read for software developers aiming to write clean, maintainable, and efficient code. Here are the key takeaways:</p><h4>1. Meaningful Names</h4><ul><li><strong>Descriptive</strong>: Use names that clearly describe what the variable, function, or class does.</li><li><strong>Consistent</strong>: Stick to naming patterns so that names are predictable.</li></ul><h4>2. Small Functions</h4><ul><li><strong>Single Purpose</strong>: Each function should only do one thing.</li><li><strong>Descriptive Names</strong>: Name functions so their purpose is obvious.</li></ul><h4>3. Comments</h4><ul><li><strong>Good Comments</strong>: Explain why the code does something, not what it does.</li><li><strong>Self-Explanatory Code</strong>: Write code that doesn’t need extra comments to be understood.</li></ul><h4>4. Formatting</h4><ul><li><strong>Consistency</strong>: Use the same formatting rules throughout your code.</li><li><strong>Readable Layout</strong>: Organize code visually for easy reading.</li></ul><h4>5. Objects and Data Structures</h4><ul><li><strong>Encapsulation</strong>: Keep data hidden inside objects, exposing only necessary behavior.</li><li><strong>Use Appropriately</strong>: Use objects to model behaviors and data structures to manage data.</li></ul><h4>6. Error Handling</h4><ul><li><strong>Use Exceptions</strong>: Prefer exceptions over error codes for handling errors.</li><li><strong>Fail Fast</strong>: Catch and handle errors early in the code.</li></ul><h4>7. Boundaries</h4><ul><li><strong>Isolate Third-Party Code</strong>: Keep external code separate to minimize dependency issues.</li><li><strong>Learning Tests</strong>: Write tests to understand how third-party code works.</li></ul><h4>8. Unit Tests</h4><ul><li><strong>TDD</strong>: Write tests before writing the code that will implement the functionality.</li><li><strong>Clean Tests</strong>: Ensure tests are easy to read and fast to run.</li></ul><h4>9. Classes</h4><ul><li><strong>Single Responsibility</strong>: Each class should have one clear purpose.</li><li><strong>Small and Focused</strong>: Keep classes small and ensure they only handle related tasks.</li></ul><h4>10. Systems</h4><ul><li><strong>Separate Construction from Use</strong>: Create objects separately from where they are used.</li><li><strong>Dependency Injection</strong>: Pass dependencies into a class rather than creating them inside.</li></ul><h4>11. Emergence</h4><ul><li><strong>Simple Design</strong>: Follow simple rules to create clean and effective designs.</li></ul><ol><li>All tests should run.</li><li>No duplicate code.</li><li>Clear intent in code.</li><li>Few classes and methods.</li></ol><h4>12. Concurrency</h4><ul><li><strong>Simple and Focused</strong>: Keep concurrent code simple and focused on one task.</li><li><strong>Thorough Testing</strong>: Make sure to test concurrent code thoroughly to avoid issues.</li></ul><h4>13. Refactoring</h4><ul><li><strong>Continuous Improvement</strong>: Regularly improve code without changing its functionality.</li><li><strong>Eliminate Code Smells</strong>: Continuously identify and fix problematic areas in the code.</li></ul><h3>Conclusion</h3><p>“Clean Code” teaches how to write clear, readable, and maintainable code. Following these principles helps create code that is easy to work with and extend.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*n5dd70QnnQXVTk2vHJdUUQ.jpeg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=386220364a5e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Make Arrays and Data Structures Thread-Safe in Swift]]></title>
            <link>https://medium.com/@Shubhransh-Gupta/how-to-make-arrays-and-data-structures-thread-safe-in-swift-2e6c7743c5a3?source=rss-cac2f4a35197------2</link>
            <guid isPermaLink="false">https://medium.com/p/2e6c7743c5a3</guid>
            <category><![CDATA[swiftui]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[ios-development]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[uikit]]></category>
            <dc:creator><![CDATA[Shubhransh Gupta]]></dc:creator>
            <pubDate>Fri, 07 Jun 2024 05:41:59 GMT</pubDate>
            <atom:updated>2024-06-07T05:41:59.979Z</atom:updated>
            <content:encoded><![CDATA[<p>Concurrency is a critical aspect of modern programming, especially when developing applications that perform multiple tasks simultaneously. In Swift, managing data structures like arrays in a thread-safe manner ensures that your application runs smoothly without data corruption or crashes. This blog post will guide you through various techniques to make arrays and other data structures thread-safe in Swift.</p><p><em>In a multithreaded environment, multiple threads can access and modify shared data simultaneously. Without proper synchronization, this can lead to data races, where the outcome depends on the unpredictable timing of thread execution. Ensuring thread safety means preventing these data races and ensuring that your data remains consistent and reliable.</em></p><h4>Techniques for Thread-Safe Arrays</h4><h4>1. Using a Serial Dispatch Queue</h4><p><em>A serial dispatch queue ensures that only one thread can access the array at a time, making it a straightforward way to achieve thread safety.</em></p><pre>import Foundation<br><br>class ThreadSafeArray&lt;T&gt; {<br>    private var array = [T]()<br>    private let queue = DispatchQueue(label: &quot;com.example.threadSafeArrayQueue&quot;)<br><br>    func append(_ item: T) {<br>        queue.sync {<br>            array.append(item)<br>        }<br>    }<br><br>    func remove(at index: Int) -&gt; T? {<br>        return queue.sync {<br>            guard array.indices.contains(index) else { return nil }<br>            return array.remove(at: index)<br>        }<br>    }<br><br>    func get(at index: Int) -&gt; T? {<br>        return queue.sync {<br>            guard array.indices.contains(index) else { return nil }<br>            return array[index]<br>        }<br>    }<br><br>    var count: Int {<br>        return queue.sync {<br>            return array.count<br>        }<br>    }<br>}</pre><h4>2. Using NSLock</h4><p><em>NSLock provides a simple way to lock and unlock critical sections of your code.</em></p><pre>import Foundation<br><br>class ThreadSafeArray&lt;T&gt; {<br>    private var array = [T]()<br>    private let lock = NSLock()<br><br>    func append(_ item: T) {<br>        lock.lock()<br>        array.append(item)<br>        lock.unlock()<br>    }<br><br>    func remove(at index: Int) -&gt; T? {<br>        lock.lock()<br>        defer { lock.unlock() }<br>        guard array.indices.contains(index) else { return nil }<br>        return array.remove(at: index)<br>    }<br><br>    func get(at index: Int) -&gt; T? {<br>        lock.lock()<br>        defer { lock.unlock() }<br>        guard array.indices.contains(index) else { return nil }<br>        return array[index]<br>    }<br><br>    var count: Int {<br>        lock.lock()<br>        defer { lock.unlock() }<br>        return array.count<br>    }<br>}</pre><h4>3. Using DispatchSemaphore</h4><p><em>DispatchSemaphore is another synchronization tool that can control access to resources by using signals.</em></p><pre>import Foundation<br><br>class ThreadSafeArray&lt;T&gt; {<br>    private var array = [T]()<br>    private let semaphore = DispatchSemaphore(value: 1)<br><br>    func append(_ item: T) {<br>        semaphore.wait()<br>        array.append(item)<br>        semaphore.signal()<br>    }<br><br>    func remove(at index: Int) -&gt; T? {<br>        semaphore.wait()<br>        defer { semaphore.signal() }<br>        guard array.indices.contains(index) else { return nil }<br>        return array.remove(at: index)<br>    }<br><br>    func get(at index: Int) -&gt; T? {<br>        semaphore.wait()<br>        defer { semaphore.signal() }<br>        guard array.indices.contains(index) else { return nil }<br>        return array[index]<br>    }<br><br>    var count: Int {<br>        semaphore.wait()<br>        defer { semaphore.signal() }<br>        return array.count<br>    }<br>}</pre><h4>4. Using NSRecursiveLock</h4><p><em>NSRecursiveLock allows the same thread to acquire the lock multiple times, which can be useful if your synchronization code might call itself recursively.</em></p><pre>import Foundation<br><br>class ThreadSafeArray&lt;T&gt; {<br>    private var array = [T]()<br>    private let lock = NSRecursiveLock()<br><br>    func append(_ item: T) {<br>        lock.lock()<br>        array.append(item)<br>        lock.unlock()<br>    }<br><br>    func remove(at index: Int) -&gt; T? {<br>        lock.lock()<br>        defer { lock.unlock() }<br>        guard array.indices.contains(index) else { return nil }<br>        return array.remove(at: index)<br>    }<br><br>    func get(at index: Int) -&gt; T? {<br>        lock.lock()<br>        defer { lock.unlock() }<br>        guard array.indices.contains(index) else { return nil }<br>        return array[index]<br>    }<br><br>    var count: Int {<br>        lock.lock()<br>        defer { lock.unlock() }<br>        return array.count<br>    }<br>}</pre><blockquote>For more advanced and performant solutions, you might consider using third-party libraries like SwiftConcurrentCollections. These libraries offer thread-safe collections out-of-the-box, which can save you time and effort.</blockquote><p>Ensuring thread safety is crucial for developing robust and reliable applications. By using serial dispatch queues, NSLock, DispatchSemaphore, or NSRecursiveLock, you can effectively manage concurrent access to arrays and other data structures in Swift. Choose the method that best fits your needs and start building safer, more reliable code today!</p><p>Feel free to modify this guide as needed to fit your style and add any additional insights you have on the topic. Happy coding!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*n5dd70QnnQXVTk2vHJdUUQ.jpeg" /></figure><p>Catch me:</p><p><a href="https://www.linkedin.com/in/shubhransh-gupta/">https://www.linkedin.com/in/shubhransh-gupta/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2e6c7743c5a3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Importing UIKit Views into SwiftUI: A Comprehensive Guide]]></title>
            <link>https://medium.com/@Shubhransh-Gupta/importing-uikit-views-into-swiftui-a-comprehensive-guide-50819024fd3b?source=rss-cac2f4a35197------2</link>
            <guid isPermaLink="false">https://medium.com/p/50819024fd3b</guid>
            <category><![CDATA[uikit]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[ios-development]]></category>
            <category><![CDATA[swiftui]]></category>
            <category><![CDATA[apple]]></category>
            <dc:creator><![CDATA[Shubhransh Gupta]]></dc:creator>
            <pubDate>Thu, 06 Jun 2024 17:14:16 GMT</pubDate>
            <atom:updated>2024-06-06T17:15:55.589Z</atom:updated>
            <content:encoded><![CDATA[<p>SwiftUI is Apple’s modern framework for building user interfaces across all Apple platforms. It offers a declarative syntax and integrates seamlessly with existing UIKit components. This blog post will guide you through the process of importing UIKit views, like UITextField, into SwiftUI. We will cover several examples to ensure you can incorporate various UIKit views into your SwiftUI projects effortlessly.</p><h3>Introduction</h3><p>While SwiftUI is powerful and versatile, there are times when you might need to use a UIKit component due to its advanced functionality or because it is not yet available in SwiftUI. In such cases, you can integrate UIKit views into your SwiftUI app using UIViewRepresentable. This protocol provides a bridge for presenting UIKit views in a SwiftUI context.</p><h3>Setting Up Your SwiftUI Project</h3><p>Before we dive into examples, let’s ensure you have a basic SwiftUI project set up. Open Xcode and create a new SwiftUI project.</p><h3>Example: Importing UITextField</h3><p>Let’s start with a simple example of importing a UITextField into SwiftUI.</p><h3>Step 1: Create a UIViewRepresentable Struct</h3><p>Create a new Swift file in your project and name it UITextFieldRepresentable.swift. In this file, define a struct that conforms to UIViewRepresentable.</p><pre>import SwiftUI<br>import UIKit<br><br>struct UITextFieldRepresentable: UIViewRepresentable {<br>    @Binding var text: String<br><br>    class Coordinator: NSObject, UITextFieldDelegate {<br>        var parent: UITextFieldRepresentable<br><br>        init(parent: UITextFieldRepresentable) {<br>            self.parent = parent<br>        }<br><br>        func textFieldDidChangeSelection(_ textField: UITextField) {<br>            parent.text = textField.text ?? &quot;&quot;<br>        }<br>    }<br><br>    func makeCoordinator() -&gt; Coordinator {<br>        Coordinator(parent: self)<br>    }<br><br>    func makeUIView(context: Context) -&gt; UITextField {<br>        let textField = UITextField()<br>        textField.delegate = context.coordinator<br>        textField.borderStyle = .roundedRect<br>        return textField<br>    }<br><br>    func updateUIView(_ uiView: UITextField, context: Context) {<br>        uiView.text = text<br>    }<br>}</pre><pre>struct ContentView: View {<br>    @State private var text: String = &quot;&quot;<br><br>    var body: some View {<br>        VStack {<br>            UITextFieldRepresentable(text: $text)<br>                .padding()<br>                .frame(height: 50)<br>            <br>            Text(&quot;You typed: \(text)&quot;)<br>                .padding()<br>        }<br>        .padding()<br>    }<br>}</pre><h3>What is a Coordinator?</h3><p>In UIViewRepresentable, the Coordinator class serves as a bridge for handling delegate methods, target-action mechanisms, and other interactions that need to be communicated between the UIKit view and SwiftUI. The coordinator is responsible for:</p><ul><li>Handling user interactions with the UIKit view.</li><li>Updating SwiftUI state based on those interactions.</li><li>Managing the lifecycle and state synchronization of the UIKit view.</li></ul><blockquote><strong>Dev Corner:</strong><br>Inside UITextFieldRepresentable, we define a nested Coordinator class. This class conforms to NSObject and UITextFieldDelegate.</blockquote><blockquote>The makeCoordinator() method instantiates the Coordinator and provides it with a reference to the UITextFieldRepresentable instance. This allows the Coordinator to access and modify the SwiftUI state.</blockquote><blockquote>In the Coordinator class, we implement delegate methods to handle user interactions with the UITextField. Here, the textFieldDidChangeSelection method is called whenever the text changes. Inside this method, we update the text property of the UITextFieldRepresentable struct, which is a binding to the SwiftUI state.</blockquote><blockquote>In the makeUIView(context:) method, we create the UITextField and set its delegate to the Coordinator instance. This step is crucial because it connects the UIKit view&#39;s delegate methods to our custom Coordinator.</blockquote><blockquote>The updateUIView(_:context:) method is responsible for synchronizing the state of the UIKit view with the SwiftUI view. Whenever the SwiftUI state changes, this method updates the UITextField to reflect the new state.</blockquote><p>Hence In this way, one can import UIKit Views in SwiftUI very easily.</p><p>Happy coding!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*n5dd70QnnQXVTk2vHJdUUQ.jpeg" /></figure><p>Catch me :</p><p><a href="https://www.linkedin.com/in/shubhransh-gupta">https://www.linkedin.com/in/shubhransh-gupta</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=50819024fd3b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Swift | OTA or Over-The-Air distribution of any iOS Application]]></title>
            <link>https://medium.com/@Shubhransh-Gupta/swift-ota-or-over-the-air-distribution-of-any-ios-application-e95aca415daf?source=rss-cac2f4a35197------2</link>
            <guid isPermaLink="false">https://medium.com/p/e95aca415daf</guid>
            <category><![CDATA[uikit]]></category>
            <category><![CDATA[ota]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[ios-development]]></category>
            <category><![CDATA[swift]]></category>
            <dc:creator><![CDATA[Shubhransh Gupta]]></dc:creator>
            <pubDate>Sat, 03 Jun 2023 07:26:48 GMT</pubDate>
            <atom:updated>2023-06-03T07:26:48.966Z</atom:updated>
            <content:encoded><![CDATA[<p>Without relying on the AppStore or TestFlight, Apple permits you to deploy an archive of your application to up to 100 distinct devices for testing reasons only. You only need to set up an Ad Hoc distribution profile that allows your iOS app to operate on a select group of devices.<br>Create an archive of your app in Xcode to use the ad hoc distribution. It will launch the Organiser with the selected archive. To make things easier, we should let Xcode handle the signature automatically. It is critical that you enter the UDID of the device that will execute your prototype in the Certificates, Identifiers, and Profiles area of your Apple Developer account. Xcode will re-sign the archive with that device list for Ad Hoc distribution so that the system can validate the device and accept it for installation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*C_KJkZLaEEC5u_9L9pZj3g.png" /><figcaption>Organizer panel of Xcode</figcaption></figure><p>Hit the <strong><em>Distribute App</em></strong> button to export the archive. Don’t forget to select the option “<em>Include manifest for over-the-air installation</em>”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/764/1*IrdQi-tEC4J38lNXt7Y7tA.png" /></figure><p>The manifest is basically a .plist file with the necessary information for the app installation. Here is an example:</p><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;items&lt;/key&gt;<br> &lt;array&gt;<br>  &lt;dict&gt;<br>   &lt;key&gt;assets&lt;/key&gt;<br>   &lt;array&gt;<br>    &lt;dict&gt;<br>     &lt;key&gt;kind&lt;/key&gt;<br>     &lt;string&gt;software-package&lt;/string&gt;<br>     &lt;key&gt;url&lt;/key&gt;<br>     &lt;string&gt;https://whitesmith.co/apps/mealcard-beta.ipa&lt;/string&gt;<br>    &lt;/dict&gt;<br>    &lt;dict&gt;<br>     &lt;key&gt;kind&lt;/key&gt;<br>     &lt;string&gt;display-image&lt;/string&gt;<br>     &lt;key&gt;url&lt;/key&gt;<br>     &lt;string&gt;https://whitesmith.co/apps/mealcard-57x57.png&lt;/string&gt;<br>    &lt;/dict&gt;<br>    &lt;dict&gt;<br>     &lt;key&gt;kind&lt;/key&gt;<br>     &lt;string&gt;full-size-image&lt;/string&gt;<br>     &lt;key&gt;url&lt;/key&gt;<br>     &lt;string&gt;https://whitesmith.co/apps/mealcard-512x512.png&lt;/string&gt;<br>    &lt;/dict&gt;<br>   &lt;/array&gt;<br>   &lt;key&gt;metadata&lt;/key&gt;<br>   &lt;dict&gt;<br>    &lt;key&gt;bundle-identifier&lt;/key&gt;<br>    &lt;string&gt;co.whitesmith.mealcard&lt;/string&gt;<br>    &lt;key&gt;bundle-version&lt;/key&gt;<br>    &lt;string&gt;3.9.0&lt;/string&gt;<br>    &lt;key&gt;kind&lt;/key&gt;<br>    &lt;string&gt;software&lt;/string&gt;<br>    &lt;key&gt;platform-identifier&lt;/key&gt;<br>    &lt;string&gt;com.apple.platform.iphoneos&lt;/string&gt;<br>    &lt;key&gt;title&lt;/key&gt;<br>    &lt;string&gt;Mealcard&lt;/string&gt;<br>   &lt;/dict&gt;<br>  &lt;/dict&gt;<br> &lt;/array&gt;<br>&lt;/dict&gt;<br>&lt;/plist&gt;</pre><p>The <strong>manifest</strong> file is the key to OTA distribution. It contains the path of the .ipa file that needs to be installed.</p><p>Since Xcode 10, the manifest file can be generated directly in the Organizer during the export process. You need to fill the form with the path of the .ipa file, a display image of 57x57, and a full-size image of 512x512, both images in .png. This .ipa should be hosted and accessible.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/772/1*XyLLaUS6CvuMyJBFSPxpPA.png" /></figure><p>You can change the manifest later after the export succeeds by editing the manifest.plist file, so don’t worry if you don’t know where to host the .ipa. Continue the export by hitting next and choosing “<em>Automatically manage signing</em>”. Export!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YiNiZLPwasVRbbYJyZTWUQ.png" /></figure><p>After the succeeded export, open the folder that has been created. You can see the manifest.plist and the .ipa file. Those are the files you need to upload in your defined host to be available with a public link. You should change the name of the manifest.plist file to match the name of your .ipa file. I usually upload them using an FTP client and I put them together in the same location, something like:</p><pre>Upload your .ipa file and plist file to a SSL enabled server. <br>If you don’t have an SSL enabled server, you can upload the .plist file <br>to your DropBox account while keeping the .ipa file on your non-SSL enabled <br>server.</pre><p>Now, you just need to send a link to the person who needs to check your prototype, something like this: itms-services://?action=download-manifest&amp;url=https://whitesmith.co/apps/mealcard-beta.plist. This link needs to be open in the iPhone/iPad. Safari will interpret the download action and install the app. You can also make a static webpage and put the above itms link on press a\of any button or tap of any text under href= “” .</p><pre>&lt;p&gt;Open this in your iPhone/iPad!&lt;/p&gt;<br>&lt;a href=&quot;itms-services://?action=download-manifest&amp;url=YOUR-UPLOADED-PLIST-FILE.plist&quot;&gt;<br>Click here&lt;/a&gt;.</pre><p>Thanks!</p><p>Refer: <a href="https://blog.ricardopereira.eu/2020/05/07/EN-distribute-iOS-app-using-public-link/">https://blog.ricardopereira.eu/2020/05/07/EN-distribute-iOS-app-using-public-link/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e95aca415daf" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Add Home Screen Quick Action Menu in iOS | Xcode | StoryBoard |Swift]]></title>
            <link>https://medium.com/@Shubhransh-Gupta/add-home-screen-quick-action-menu-in-ios-xcode-storyboard-swift-4553dd450d77?source=rss-cac2f4a35197------2</link>
            <guid isPermaLink="false">https://medium.com/p/4553dd450d77</guid>
            <category><![CDATA[ios-app-development]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[xcode]]></category>
            <category><![CDATA[ios-development]]></category>
            <category><![CDATA[ios]]></category>
            <dc:creator><![CDATA[Shubhransh Gupta]]></dc:creator>
            <pubDate>Sun, 10 Jul 2022 10:25:26 GMT</pubDate>
            <atom:updated>2022-07-10T10:50:40.133Z</atom:updated>
            <content:encoded><![CDATA[<p>Hi Folks! I recently implemented Quick Actions for an app and I was very interested in the home screen quick actions feature of Apple if it can be a good way to improve user experience.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/386/1*vLjgNa709k03Kb-oUDSMZA.png" /></figure><p>On the Home screen of a device running iOS 13 or later, apps can display Home Screen quick actions when users to touch and hold the app icon (on a 3D Touch device, users press briefly on the icon). Each Home Screen quick action includes a title, an icon on the left or right (depending on your app’s position on the Home Screen), and an optional subtitle. Define quick actions statically at build time from the app’s Info.plist or dynamically configured at runtime.</p><blockquote>Note : Every app can provide a maximum of four quick actions. If it exceeds four, then the first four quick actions only visible to the user. Each app has its default system quick action like “Edit Home Screen”, “Remove App”.</blockquote><h3><strong>Getting Started :</strong></h3><p>Step 1: Open <a href="https://developer.apple.com/xcode/">Xcode</a> and create a new project or you can implement it in your existing projects also.</p><p>Step 2: To create a new Quick Action: opening the Info.plist<strong><em> </em></strong>file add a new element named UIApplicationShortcutItemsAfter hitting enter you will see its name like <em>Home Screen Shortcut Items.</em> Set “Array” as type. Under this element create an item for each Quick Action you want to add to your app and set the item as “Dictionary.” In this item you need to add all or some of the following keys as shown below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CZ-uQJaNus220_IUXYCd-Q.png" /></figure><ul><li>UIApplicationShortcutItemType<strong> </strong>(required): A unique string that identifies the Quick Action. For example: com.11team.Category1or Category1</li><li>UIApplicationShortcutItemTitle (required):<strong> </strong>The Quick Action title is displayed to the user.</li><li>UIApplicationShortcutItemSubtitle (optional): The Quick Action’s subtitle.</li><li>UIApplicationShortcutItemIconType (optional):<strong> </strong>Here you can set a <a href="https://developer.apple.com/documentation/uikit/uiapplicationshortcuticon/icontype">predefined icon</a> made by Apple.</li><li>UIApplicationShortcutItemIconFile (optional):<strong> </strong>Use to set a custom icon.</li><li>UIApplicationShortcutItemUserInfo (optional):<strong> </strong>A dictionary to save data.</li></ul><p>If you launch the app you should see Quick Actions like this, but right now if you tap on any of these nothing happens.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/280/1*3_LmpRywZwN9FfK9HSxqCg.png" /></figure><p><strong>Handling Tap Gesture :</strong></p><p>Add below code of lines in SceneDelegate.swift. SceneDelegate.swift gets invoked when the user taps on Quick Actions from the home screen. Then, we need to check which Action is called and execute our code logic. In this example, I will show you an alert with the Quick Action type identifier.</p><pre><strong>func</strong> windowScene(_ windowScene: UIWindowScene, performActionFor shortcutItem: UIApplicationShortcutItem, completionHandler: <strong>@escaping</strong> (Bool) -&gt; Void) {</pre><pre><strong>let</strong> alert = UIAlertController(title: &quot;Quick Actions Pressed&quot;, message: &quot;Quick Action Identifier: \(shortcutItem.type)&quot;, preferredStyle: .alert)</pre><pre><strong>let</strong> action = UIAlertAction(title: &quot;OK&quot;, style: .default, handler: <strong>nil</strong>)</pre><pre>alert.addAction(action)</pre><pre><strong>switch</strong> shortcutItem.type {</pre><pre><strong>case</strong> &quot;Category1&quot;:</pre><pre>DispatchQueue.main.async {</pre><pre><strong>self</strong>.window!.rootViewController?.present(alert, animated: <strong>true</strong>, completion: <strong>nil</strong>)</pre><pre>}</pre><pre><strong>break</strong></pre><pre><strong>case</strong> &quot;Category2&quot;:</pre><pre>// Using storyboard</pre><pre><strong>let</strong> mainStoryboard = UIStoryboard.init(name: &quot;Main&quot;, bundle: Bundle.main)</pre><pre><strong>let</strong> reqVC = mainStoryboard.instantiateViewController(withIdentifier: &quot;ViewController&quot;) <strong>as</strong>! ViewController</pre><pre><strong>if</strong> <strong>let</strong> homeVC = <strong>self</strong>.window?.rootViewController <strong>as</strong>? UINavigationController {</pre><pre>// Push the new view controller</pre><pre>homeVC.pushViewController(reqVC, animated: <strong>true</strong>)</pre><pre>// Call the method</pre><pre>reqVC.showMessage()</pre><pre>}</pre><pre><strong>default</strong>:</pre><pre><strong>break</strong></pre><pre>}</pre><pre>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mLPM-PqLn-7bPmkArhmXvw.png" /></figure><p>I have added a showMessage() method inside ViewController and that fun is getting invoked when user taps on Category2.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iNXNRORFJOzw3r3tJViBFw.png" /></figure><p><strong>Finally, the moment of truth comes :</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/298/1*Q57vuvPKvz1x3ioon_Dwtw.png" /><figcaption>When 11chats [Category1] gets tapped</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/362/1*rQhZRHgYWxm9vBnslXFo6w.png" /><figcaption>When 11calls [Category2] get clicked</figcaption></figure><p>If you like my content do not forget to clap. For more such brewed content subscribe to me on medium and catch me on <a href="https://www.linkedin.com/in/shubhransh-gupta/">LinkedIn</a> .</p><p>References :</p><ul><li><a href="https://benoitpasquier.com/adding-home-screen-action-swift/">Why and how to add home screen shortcut for your iOS app</a></li><li><a href="https://developer.apple.com/documentation/uikit/menus_and_shortcuts/add_home_screen_quick_actions">Add Home Screen Quick Actions | Apple Developer Documentation</a></li></ul><p>Catch me here :</p><p><a href="https://www.linkedin.com/in/shubhransh-gupta/">Shubhransh Gupta - SDE 1 | Flutter | iOS Dev - Nuclei | LinkedIn</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4553dd450d77" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[iOS | SSL Pinning with Alamofire | Making iOS App More Secured]]></title>
            <link>https://medium.com/@Shubhransh-Gupta/ios-ssl-pinning-with-alamofire-making-ios-app-more-secured-400023cce917?source=rss-cac2f4a35197------2</link>
            <guid isPermaLink="false">https://medium.com/p/400023cce917</guid>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[man-in-the-middle-attack]]></category>
            <category><![CDATA[ssl-pinning]]></category>
            <category><![CDATA[ios-app-development]]></category>
            <category><![CDATA[ios]]></category>
            <dc:creator><![CDATA[Shubhransh Gupta]]></dc:creator>
            <pubDate>Sun, 12 Jun 2022 18:30:23 GMT</pubDate>
            <atom:updated>2022-06-12T18:37:03.816Z</atom:updated>
            <content:encoded><![CDATA[<p>Hello folks! Today we are going to see how to actually implement SSL Pinning in any iOS App. Before continuing first, we should have a basic understanding of why SSL Pinning is required.</p><p>Nowadays, almost all apps require network calls to retrieve or store some information on the server. <strong>SSL pinning -</strong> one of the popular ways to inspect HTTPS requests in iOS Apps is the Man-in-the-middle (MITM) attack. This involves having a trusted server’s keys added to your iOS app and some additional code to ensure that the app only communicates with servers using that particular certificate.</p><p><strong>Why it is needed :</strong></p><p>When an app tries to establish a connection to a server, it doesn’t know which certificates to trust and which not to. The app relies entirely on the certificates provided by the iOS Trust Store provides or Android CA’s by Google. The problem that arises is an attacker can generate a self-signed certificate and include it in the iOS Trust Store or hack a root CA certificate. This allows such an attacker to set up a <a href="https://en.wikipedia.org/wiki/Man-in-the-middle_attack">man-in-the-middle attack</a> (MITM) and capture the transmitted data moving to and from the app.</p><p>Thus through SSL Pinning, we can actually add a public key/certificate of authenticated server in our app, and during the run-time network call can authenticate the server by matching either public key or SecKey against the certificate.</p><p><strong>Types of SSL Pinning :</strong></p><ul><li><strong>Pin the certificate</strong> — You can download the server’s certificate and bundle them in the app. At the runtime, the app compares the server certificate to the ones that you have embedded.</li><li><strong>Pin the public key</strong> — You can retrieve the public key of the certificate in the code as a string. At the runtime, the application compares the certificate’s public key to one which is hard-coded in the code.</li></ul><blockquote>Note:- If you choose the first option, you will have to upload the app when the server changes its certificate or it will stop working. When choosing the second option, you might violate the key rotation policy as the public key won’t change.</blockquote><p><strong>Implementation:</strong></p><p>We are going to implement SSL Pinning in iOS with the help of Alamofire by setting a custom delegate class for SessionDelegate and overriding the didReceive challengedelegate method</p><pre>urlSession(_ session: URLSession,<br>                         task: URLSessionTask,<br>                         didReceive challenge:    URLAuthenticationChallenge,<br>                         completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -&gt; Void) {</pre><pre>}</pre><p>Steps to implement:</p><p>1- Create a CustomSessionDelegate class conforming to SessionDelegate and override the didReceive challenge method. Import Alamofire also. Something like the below:</p><pre><strong>import</strong> Foundation</pre><pre><strong>import</strong> Alamofire</pre><pre><strong>public</strong> <strong>class</strong> CustomSessionDelegate: SessionDelegate {</pre><pre><strong>public</strong> <strong>static</strong> <strong>var</strong> sharedInstance = CustomSessionDelegate()<br></pre><pre><strong>public</strong> <strong>override</strong> <strong>func</strong> urlSession(_ session: URLSession,</pre><pre>task: URLSessionTask,</pre><pre>didReceive challenge: URLAuthenticationChallenge,</pre><pre>completionHandler: <strong>@escaping</strong> (URLSession.AuthChallengeDisposition, URLCredential?) -&gt; Void) {<br>if let serverTrust = challenge.protectionSpace.serverTrust {</pre><pre>/* do pinning validation (your pinning logic should come here. As discussed above you can either * Pin the Certificate / * Pin the public keys) */</pre><pre>if pinningSucceeded {<br>completionHandler(.useCredential, URLCredential(trust:serverTrust))<br>} else {<br>/* The entire request will be canceled; the credential parameter is ignored. */<br>completionHandler(.cancelAuthenticationChallenge, <strong>nil</strong>)<br>}<br>return <br>}<br>// Pinning failed<br>completionHandler(.cancelAuthenticationChallenge, <strong>nil</strong>)</pre><pre>}</pre><pre>}</pre><p>2- Create an instance of CustomSessionManager Class so that you can access it throughout the app. (The best place is either AppDelegate.swift)</p><pre><strong>static</strong> <strong>var</strong> customSessionManager: Alamofire.<strong>SessionManager</strong> = <br>Alamofire.<strong>SessionManager</strong>(configuration: <strong>CustomSessionDelegate.</strong>sharedInstance<strong>.returnUrlSessionConfiguration()</strong>, delegate: <strong>CustomSessionDelegate.</strong>sharedInstance, serverTrustPolicyManager: <strong>ServerTrustPolicyManager(policies: [:])</strong>)</pre><blockquote>Initializes the `ServerTrustPolicyManager` instance with the given policies. Since different servers and web services can have different leaf certificates, intermediate and even root certificates, it is important to have the flexibility to specify evaluation policies on a per-host basis. This allows for scenarios such as using default evaluation for host1, certificate pinning for host2, public key pinning for host3, and disabling evaluation for host4. <strong>parameter</strong> policies: A dictionary of all policies mapped to a particular host.</blockquote><blockquote>configuration : The configuration used to construct the managed session. `URLSessionConfiguration.default` by default. Incase you want to modify the configurations you can follow this. Inside customSessionDelegate.<strong>sharedDelegate.returnUrlSessionConfiguration() </strong>you can set your own configurations for Network Request for example if you want to set a timeoutInterval for request then:</blockquote><pre><strong>static</strong> <strong>func</strong> returnURLSessionConfiguration() -&gt; URLSessionConfiguration {</pre><pre><strong>let</strong> configuration = URLSessionConfiguration.default</pre><pre>configuaration.timeoutIntervalForRequest = 4 * 60.0</pre><pre>configuration.timeoutIntervalForResource = 4 * 60 // 4 mins</pre><pre><strong>return</strong> configuration</pre><pre>}</pre><p>Put the above snippet inside CustomSessionManager Class and using sharedInstance you can call as called in the snippet.</p><p>3- The final step is while calling any API instead of creating a new instance of SessionManager, we are going to use our customSessionManager which supports SSL pinning. Like in my case I want to upload some content on server so I followed,</p><pre>AppDelegate.customSessionManager.upload(</pre><pre>multipartFormData: { multipartFormData <strong>in</strong></pre><pre>multipartFormData.append(videoData, withName: &quot;video&quot;, fileName: &quot;myVideo.mp4&quot;, mimeType: &quot;video/mp4&quot;)</pre><pre>},</pre><pre>usingThreshold: .max,</pre><pre>to: // put the API end points with complete base URL here,</pre><pre>method: .post,</pre><pre>headers: headers,</pre><pre>encodingCompletion: { (encodingResult) <strong>in</strong></pre><pre><strong>switch</strong> encodingResult {</pre><pre><strong>case</strong> .success(<strong>let</strong> upload, _, _):</pre><pre>upload.responseJSON { response <strong>in</strong></pre><pre><strong>if</strong> <strong>let</strong> error = response.error <strong>as</strong> NSError? { </pre><pre>//handle network errors here</pre><pre>}</pre><pre>print(&quot;printing header with Alamofire&quot;)</pre><pre>print(response.response?.allHeaderFields)</pre><pre><strong>if</strong> <strong>let</strong> dataInString = String(data: response.data, encoding: .utf8), !dataInString.isEmpty {</pre><pre>print(&quot;printing response with Alamofire&quot;)<br>print(dataInString)</pre><pre>}</pre><pre>}<strong>else</strong> {</pre><pre>// handle API onError case</pre><pre>}</pre><pre>}</pre><pre>upload.uploadProgress(closure: { progress <strong>in</strong></pre><pre>print(progress.fractionCompleted)</pre><pre>})</pre><pre><strong>case</strong> .failure(<strong>let</strong> encodingError):</pre><pre>print(encodingError)</pre><pre>}</pre><pre>})</pre><p>TaDa !!! You have just now set up the SSL Pinning on your iOS App using Alamofire. Hope you enjoyed understanding the concept, Stay connected for more fresh content. Till then, Good Bye! Take Care!!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*YTE4QRE-AP-0B_t3" /><figcaption>Photo by <a href="https://unsplash.com/@jaimespaniol?utm_source=medium&amp;utm_medium=referral">Jaime Spaniol</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>References:</p><ul><li><a href="https://tech.groww.in/ssl-pinning-in-android-part-1-d23a01d51fd6">SSL Pinning in Android Part 1</a></li><li><a href="https://appinventiv.com/blog/ssl-pinning-in-ios-app/">How to Perform SSL Pinning in iOS Apps</a></li><li><a href="https://infinum.com/blog/how-to-make-your-ios-apps-more-secure-with-ssl-pinning/">How to Make Your iOS Apps More Secure with SSL Pinning</a></li></ul><p>Catch me here:</p><p><a href="https://www.linkedin.com/in/shubhransh-gupta/">Shubhransh Gupta - SDE 1 | Flutter | iOS Dev - Nuclei | LinkedIn</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=400023cce917" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>