<?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 Midlaj on Medium]]></title>
        <description><![CDATA[Stories by Midlaj on Medium]]></description>
        <link>https://medium.com/@midhlag55?source=rss-e09f5db58866------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*geJATQ-xvf9mjY5HCV6Y8g.jpeg</url>
            <title>Stories by Midlaj on Medium</title>
            <link>https://medium.com/@midhlag55?source=rss-e09f5db58866------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 23:15:42 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@midhlag55/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[API Caching in Swift: Faster Apps Without Missing Updates]]></title>
            <link>https://medium.com/@midhlag55/api-caching-in-swift-faster-apps-without-missing-updates-6a7784594d97?source=rss-e09f5db58866------2</link>
            <guid isPermaLink="false">https://medium.com/p/6a7784594d97</guid>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[swift-programming]]></category>
            <category><![CDATA[ios-development]]></category>
            <category><![CDATA[api-development]]></category>
            <category><![CDATA[api-caching]]></category>
            <dc:creator><![CDATA[Midlaj]]></dc:creator>
            <pubDate>Wed, 02 Dec 2026 14:49:58 GMT</pubDate>
            <atom:updated>2026-12-02T14:49:58.607Z</atom:updated>
            <content:encoded><![CDATA[<p>A practical guide to making iOS apps faster, using less data, and still showing users the latest information.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IsYN9uw6G7mjZElKFfJlgA.png" /></figure><p>Every mobile app depends on APIs. A news app loads articles, an e-commerce app loads products, and a social app loads posts. If an app makes the same API call repeatedly, it can feel slow, consume mobile data, and add unnecessary load to the server.</p><p>API caching is a simple way to improve this experience. It means saving an API response temporarily and reusing it when the app needs the same data again.</p><p>But caching does <strong>not</strong> mean showing old data forever. With the right setup, an app can display saved data immediately and then check the server for changes in the background.</p><h3>What is API caching?</h3><p>Think of a cache as a temporary local copy of data.</p><p><strong>Without caching</strong>Open screen → call API → wait → show data</p><p><strong>With caching</strong>Open screen → show saved data immediately → check API in the background → update only if data changed</p><p>This approach is often called <strong>stale-while-revalidate</strong>. The user sees useful content quickly, while the app quietly checks whether a newer version exists.</p><h3>Why cache API responses?</h3><ol><li><strong>Faster user experience.</strong> Previously downloaded data can appear immediately.</li><li><strong>Less mobile-data usage.</strong> The app does not download the same response again and again.</li><li><strong>Lower server cost and load.</strong> Fewer full requests reach the backend.</li><li><strong>Better experience on slow networks.</strong> Users can still see recently saved content while the connection is weak.</li><li><strong>Reduced battery use.</strong> Fewer network requests generally require less device work.</li><li><strong>Fewer rate-limit problems.</strong> Avoiding duplicate requests helps stay within API limits.</li></ol><h3>The main risk: stale data</h3><p>The main drawback is stale data: the server has new information, but the user sees an older saved copy. For example, a product price may change, a profile may be edited, or a new post may be published.</p><p>The answer is not to remove caching. The answer is to use a clear refresh strategy.</p><h3>The best solution: ETag-based cache validation</h3><p>The most efficient standard approach is to use HTTP <strong>ETag</strong> headers. An ETag is a small identifier for a specific version of a response.</p><p>For example, a server can return:</p><pre>HTTP/1.1 200 OK<br>Cache-Control: max-age=300, must-revalidate<br>ETag: &quot;user-42-v8&quot;<br>Content-Type: application/json</pre><p>Here, max-age=300 means the response can be reused for five minutes. When that time has passed, the app asks the server whether its saved version changed:</p><pre>GET /users/42<br>If-None-Match: &quot;user-42-v8&quot;</pre><p>The server can respond in two useful ways:</p><ul><li><strong>304 Not Modified:</strong> Nothing changed. The app keeps its saved data and does not download the full JSON again.</li><li><strong>200 OK:</strong> The data changed. The app downloads the new response and replaces the cache.</li></ul><p>This is efficient because a 304 response is much smaller than downloading the entire response again.</p><h3>Swift integration with URLCache</h3><p>URLCache is built into Apple’s Foundation framework. It can store HTTP responses in memory and on disk.</p><h3>1. Create a cached URLSession</h3><pre>import Foundation</pre><pre>let urlCache = URLCache(<br>    memoryCapacity: 20 * 1024 * 1024, // 20 MB<br>    diskCapacity: 100 * 1024 * 1024,  // 100 MB<br>    diskPath: &quot;api-cache&quot;<br>)</pre><pre>let configuration = URLSessionConfiguration.default<br>configuration.urlCache = urlCache<br>configuration.requestCachePolicy = .useProtocolCachePolicy</pre><pre>let session = URLSession(configuration: configuration)</pre><h3>2. Fetch data normally</h3><pre>struct User: Decodable {<br>    let id: Int<br>    let name: String<br>}</pre><pre>func fetchUser(id: Int) async throws -&gt; User {<br>    let url = URL(string: &quot;https://api.example.com/users/\(id)&quot;)!</pre><pre>    var request = URLRequest(url: url)<br>    request.cachePolicy = .useProtocolCachePolicy</pre><pre>    let (data, _) = try await session.data(for: request)<br>    return try JSONDecoder().decode(User.self, from: data)<br>}</pre><p>If the backend sends proper Cache-Control and ETag headers, URLSession can follow standard HTTP cache rules automatically.</p><h3>When URLCache is enough</h3><p>Use URLCache when your API has normal read-only GET requests, the backend sends good cache headers, and you want a standard, low-maintenance solution.</p><p>Do not treat write requests the same way. After a POST, PUT, PATCH, or DELETE request changes data on the server, invalidate or refetch the related cached GET data.</p><h3>Other ways to identify updates</h3><h3>Last-Modified and If-Modified-Since</h3><p>The server sends a last-modified date, and the app later asks whether content changed after that date. This works, although ETags are usually more precise.</p><h3>Version or updatedAt fields</h3><p>The API can include a version number or updatedAt timestamp. The app compares that value with its saved version. This is useful, but it usually requires downloading JSON before making the comparison.</p><h3>Polling</h3><p>The app checks every few minutes. It is easy to implement, but can waste battery, data, and server capacity when data rarely changes. Poll only while the relevant screen is active and use a sensible interval.</p><h3>WebSockets, Server-Sent Events, or push notifications</h3><p>The server tells the app when something changes, and the app refetches that item. This works well for chat, live tracking, and collaborative apps, but adds more complexity.</p><h3>Merits, demerits, and how to reduce the risks</h3><h3>Performance versus freshness</h3><p><strong>Merit:</strong> Screens load faster. <strong>Risk:</strong> A cached response may be old. <strong>Reduce it:</strong> Use a suitable expiry time, ETags, and a background refresh.</p><h3>Offline access versus old content</h3><p><strong>Merit:</strong> Recent data is available offline. <strong>Risk:</strong> It can become very old. <strong>Reduce it:</strong> Show a “Last updated” time and refresh when connectivity returns.</p><h3>Less server load versus missing critical changes</h3><p><strong>Merit:</strong> The server sends fewer full responses. <strong>Risk:</strong> Bad cache rules can hide important updates. <strong>Reduce it:</strong> Do not cache critical real-time data for long; validate it often or use real-time updates.</p><h3>Convenience versus data privacy</h3><p><strong>Merit:</strong> Public content can be reused safely. <strong>Risk:</strong> Private data can remain on the device. <strong>Reduce it:</strong> Avoid caching sensitive responses and use Cache-Control: no-store for tokens, payment details, and highly private information unless you have a deliberate secure-storage design.</p><h3>Recommended strategy for most Swift apps</h3><ol><li>Use URLCache for API GET responses.</li><li>Ask the backend team to return Cache-Control and ETag headers.</li><li>Show cached data when it is useful, then validate it in the background.</li><li>Keep the cache when the server returns 304 Not Modified.</li><li>Replace the cache and update the UI when the server returns 200 OK with new data.</li><li>Invalidate or refetch related data after write operations.</li><li>Use push notifications, WebSockets, or SSE only when immediate updates are genuinely needed.</li></ol><p><strong>Final thought:</strong> API caching is not only a performance feature. Used well, it makes an app faster, reduces costs and data use, and still keeps users up to date. The key is balance: use the cache for speed, ETags for accuracy, and refresh rules that match how important fresh data is for each screen.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6a7784594d97" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building FormForge: A Dynamic JSON-Driven Form Engine in SwiftUI]]></title>
            <link>https://medium.com/@midhlag55/building-formforge-a-dynamic-json-driven-form-engine-in-swiftui-debf72af1d31?source=rss-e09f5db58866------2</link>
            <guid isPermaLink="false">https://medium.com/p/debf72af1d31</guid>
            <category><![CDATA[json]]></category>
            <category><![CDATA[ios-development]]></category>
            <category><![CDATA[backend-driven-ui]]></category>
            <category><![CDATA[swiftui]]></category>
            <category><![CDATA[software-engineering]]></category>
            <dc:creator><![CDATA[Midlaj]]></dc:creator>
            <pubDate>Mon, 08 Jun 2026 08:38:32 GMT</pubDate>
            <atom:updated>2026-06-08T08:38:32.841Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*m5th91wqTtFPtSXtZxkr_A.jpeg" /></figure><h3>Introduction</h3><p>Modern applications frequently require forms for onboarding, surveys, campaign creation, profile management, checkout flows, and administrative dashboards. Traditionally, every form is manually built using UI components, making maintenance expensive and slowing down feature delivery.</p><p>To solve this challenge, I built FormForge, a JSON-driven dynamic form engine in SwiftUI that generates entire forms from a configuration file. Instead of writing a new screen for every form, developers can define fields, validation rules, themes, and behaviors in JSON, and the application automatically renders the interface.</p><p>The result is a flexible, scalable, and maintainable solution that significantly reduces development effort while improving consistency across applications.</p><h3>The Problem</h3><p>Imagine managing multiple forms across an application:</p><p>- Campaign Creation Forms<br>- User Registration Forms<br>- Feedback Forms<br>- Product Configuration Forms<br>- Survey Screens<br>- Internal Administrative Tools</p><p>Every time a business requirement changes, developers typically need to:</p><p>1. Modify SwiftUI layouts<br>2. Update validation logic<br>3. Adjust styling<br>4. Release a new application build</p><p>This approach becomes difficult to maintain as the number of forms grows.</p><p>The key question becomes:</p><blockquote>What if forms could be described as data instead of code?</blockquote><p>That question became the foundation of FormForge.</p><h3>What is FormForge?</h3><p>FormForge is a configurable form framework built using SwiftUI that:</p><p>- Reads form definitions from JSON<br>- Dynamically renders UI fields<br>- Supports multiple field types<br>- Applies runtime validation<br>- Handles form state management<br>- Supports theming through configuration<br>- Allows forms to evolve without rebuilding UI screens</p><p>The engine separates:</p><h4><strong>Form Definition</strong></h4><p>Stored in JSON.</p><h4><strong>Form Rendering</strong></h4><p>Handled by reusable SwiftUI components.</p><h4><strong>Validation Logic</strong></h4><p>Managed centrally through the ViewModel.</p><p>This separation makes the system highly reusable.</p><h3>Architecture Overview</h3><p>The architecture follows the MVVM pattern.</p><h4>Components</h4><h4>1. JSON Configuration</h4><p>The form structure is defined in a JSON file.</p><p>Example:</p><pre>{<br>  &quot;form_title&quot;: &quot;Comprehensive Campaign Setup&quot;,<br>  &quot;fields&quot;: [<br>    {<br>      &quot;id&quot;: &quot;campaign_name&quot;,<br>      &quot;type&quot;: &quot;TEXT&quot;,<br>      &quot;label&quot;: &quot;Campaign Name&quot;,<br>      &quot;required&quot;: true<br>    }<br>  ]<br>}</pre><p>The JSON acts as the single source of truth.</p><h4>2. Model Layer</h4><p>The project contains models such as:</p><p>- FormResponse<br>- FormTheme<br>- TextField<br>- DropdownField<br>- ToggleField<br>- CheckboxField</p><p>These models decode the JSON into strongly typed Swift structures.</p><p>Benefits:</p><p>- Type safety<br>- Better maintainability<br>- Easier testing</p><h4>3. JSON Loader</h4><p>The JSON loader is responsible for:</p><p>- Reading form configuration<br>- Parsing JSON<br>- Converting data into models<br>- Handling loading errors</p><p>This abstraction allows future support for:</p><p>- Remote APIs<br>- CMS systems<br>- Backend-driven forms</p><p>without changing the UI layer.</p><h4>4. ViewModel Layer</h4><p>The FormViewModel acts as the central state manager.</p><p>Responsibilities include:</p><h4>Form State</h4><pre>@Published var textValues<br>@Published var dropdownValues<br>@Published var toggleValues<br>@Published var checkboxValues</pre><h4>Validation</h4><p>The ViewModel validates:</p><p>- Required fields<br>- Character limits<br>- Regex rules<br>- Dropdown selections<br>- Checkbox acceptance</p><h4>Error Handling</h4><p>Validation errors are tracked centrally and displayed in the UI.</p><h4>5. Dynamic UI Renderer</h4><p>The UI is generated through reusable SwiftUI views.</p><p>The rendering pipeline:</p><pre>JSON<br> ↓<br>Decoded Models<br> ↓<br>FormViewModel<br> ↓<br>FormFieldView<br> ↓<br>Specific Field Components</pre><p>Each field type maps to its own view implementation.</p><h3>Supported Field Types</h3><h4>Text Input</h4><p>Supports:</p><p>- Plain text<br>- Numeric input<br>- Secure fields<br>- URL input</p><p>Use Cases:</p><p>- Name<br>- Email<br>- Budget<br>- Website URL<br>- Password</p><h4>Dropdown</h4><p>Supports:</p><p>- Single selection<br>- Multi-selection</p><p>Use Cases:</p><p>- Country selection<br>- Category selection<br>- Marketing channels<br>- User roles</p><h4>Toggle</h4><p>Boolean controls.</p><p>Use Cases:</p><p>- Notifications<br>- AI Features<br>- Marketing Preferences<br>- Feature Flags</p><h4>Checkbox</h4><p>Agreement and consent handling.</p><p>Use Cases:</p><p>- Terms &amp; Conditions<br>- Privacy Policy<br>- Legal Agreements</p><h4>Color Picker</h4><p>Allows users to select colors.</p><p>Use Cases:</p><p>- Branding<br>- Theme customization<br>- Product personalization</p><h3>Runtime Validation Engine</h3><p>One of the strongest features of FormForge is its centralized validation system.</p><p>Validation rules include:</p><h4>Required Fields</h4><pre>{<br>  &quot;required&quot;: true<br>}</pre><h4>Maximum Length</h4><pre>{<br>  &quot;max_length&quot;: 20<br>}</pre><h4>Pattern Validation</h4><p>Regex-based validation can be applied to fields.</p><p>Examples:</p><p>- Email validation<br>- Phone validation<br>- Custom identifiers<br>- Password complexity</p><h4>Selection Validation</h4><p>Ensures dropdowns contain valid selections.</p><h4>Consent Validation</h4><p>Prevents submission unless required checkboxes are accepted.</p><h3>Dynamic Theming</h3><p>FormForge supports runtime theming.</p><p>Theme values are defined in JSON:</p><pre>{<br>  &quot;background_color&quot;: &quot;#121212&quot;,<br>  &quot;text_color&quot;: &quot;#E0E0E0&quot;,<br>  &quot;border_color&quot;: &quot;#333333&quot;,<br>  &quot;error_color&quot;: &quot;#CF6679&quot;<br>}</pre><p>The application converts these values into SwiftUI colors.</p><p>Benefits:</p><p>- White-label applications<br>- Brand customization<br>- Dark mode support<br>- Client-specific themes</p><p>without modifying UI code.</p><h3>Real-World Use Cases</h3><h4>Marketing Campaign Builder</h4><p>The sample project demonstrates a campaign creation workflow.</p><p>Fields include:</p><p>- Campaign Name<br>- Daily Budget<br>- Destination URL<br>- Ad Networks<br>- Billing Account<br>- Brand Color<br>- AI Optimization</p><p>This closely mirrors platforms like advertising dashboards.</p><h4>SaaS Administration Panels</h4><p>Instead of hardcoding admin forms, configuration can drive:</p><p>- User management<br>- Permissions<br>- Feature toggles<br>- Account settings</p><h4>Survey Platforms</h4><p>Questions can be delivered dynamically through JSON.</p><p>Examples:</p><p>- Customer feedback<br>- Employee engagement<br>- Market research</p><h4>E-Commerce Product Configuration</h4><p>Create forms for:</p><p>- Product customization<br>- Warranty selection<br>- Delivery preferences<br>- Checkout experiences</p><h4>Enterprise Internal Tools</h4><p>Business teams can update forms without requiring engineering effort for every change.</p><h3>Why This Approach Scales</h3><p>Traditional Approach:</p><pre>New Form<br>   ↓<br>New Screen<br>   ↓<br>New Validation<br>   ↓<br>New Release</pre><p>FormForge Approach:</p><pre>New JSON<br>   ↓<br>Automatic Rendering<br>   ↓<br>Automatic Validation<br>   ↓<br>Ready</pre><p>This dramatically reduces development time.</p><h3>Technical Highlights</h3><h4>SwiftUI First</h4><p>The entire solution is built using modern SwiftUI architecture.</p><p>Benefits:</p><p>- Declarative UI<br>- Better maintainability<br>- Less boilerplate code</p><h4>MVVM Architecture</h4><p>Separation of concerns:</p><p>- Models<br>- Views<br>- ViewModels</p><p>Improves:</p><p>- Testability<br>- Scalability<br>- Maintainability</p><h4>State Management</h4><p>Uses:</p><pre>@StateObject<br>@Published<br>ObservableObject</pre><p>for reactive updates.</p><h4>Asynchronous Validation</h4><p>Validation is executed using Swift Concurrency.</p><p>Benefits:</p><p>- Better responsiveness<br>- Cleaner code<br>- Future support for server-side validation</p><h4>Accessibility Support</h4><p>The project includes accessibility identifiers, making automated testing easier.</p><h3>Future Enhancements</h3><p>Potential roadmap items:</p><h4>Backend-Driven Forms</h4><p>Load form definitions directly from APIs.</p><h4>Conditional Logic</h4><p>Example:</p><pre>If Country = USA<br>Show State Field</pre><h4>Nested Sections</h4><p>Support grouped form structures.</p><h4>File Upload Fields</h4><p>Allow image and document uploads.</p><h4>Date &amp; Time Pickers</h4><p>Support scheduling and booking flows.</p><h4>Offline Persistence</h4><p>Save drafts locally before submission.</p><h4>Analytics Tracking</h4><p>Measure:</p><p>- Form completion rate<br>- Drop-off points<br>- Validation failures</p><h3>Lessons Learned</h3><p>Building FormForge reinforced several important principles:</p><p>1. Configuration is often more scalable than hardcoded UI.<br>2. Dynamic rendering significantly reduces maintenance costs.<br>3. Centralized validation improves consistency.<br>4. JSON-driven architectures enable faster product iteration.<br>5. SwiftUI provides an excellent foundation for building reusable UI systems.</p><h3>Conclusion</h3><p>FormForge demonstrates how SwiftUI can be used to build a powerful, configurable form engine capable of generating entire user experiences from JSON.</p><p>By separating form definitions from UI implementation, the system becomes more flexible, scalable, and maintainable. Whether used for marketing platforms, SaaS dashboards, enterprise tools, surveys, or e-commerce applications, the same rendering engine can power countless form experiences with minimal code changes.</p><p>As applications continue moving toward backend-driven UI architectures, solutions like FormForge provide a practical blueprint for building adaptable and future-proof interfaces.</p><p>Source code: <a href="https://github.com/MidlajMc/FormForge.git">https://github.com/MidlajMc/FormForge.git</a></p><p>Linkedin: <a href="https://www.linkedin.com/in/midlaj-mc-833a93227/">https://www.linkedin.com/in/midlaj-mc-833a93227/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=debf72af1d31" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Advanced Navigation in SwiftUI]]></title>
            <link>https://medium.com/@midhlag55/advanced-navigation-in-swiftui-0dc786968a6c?source=rss-e09f5db58866------2</link>
            <guid isPermaLink="false">https://medium.com/p/0dc786968a6c</guid>
            <category><![CDATA[swift-programming]]></category>
            <category><![CDATA[swiftui]]></category>
            <category><![CDATA[advanced]]></category>
            <category><![CDATA[latest]]></category>
            <category><![CDATA[navigation]]></category>
            <dc:creator><![CDATA[Midlaj]]></dc:creator>
            <pubDate>Sat, 09 May 2026 03:51:00 GMT</pubDate>
            <atom:updated>2026-05-09T03:51:00.703Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GxoOu8b1whI4fjf4Av1wNw.jpeg" /></figure><h3>Building a Scalable Navigation Architecture Using NavigationStack and Router Pattern</h3><p>Modern SwiftUI applications require more than simple screen transitions. As applications grow, navigation becomes one of the most critical parts of architecture design.</p><p>In production-level apps, navigation should be:</p><ul><li>Scalable</li><li>Reusable</li><li>State-driven</li><li>Deep-link ready</li><li>Easy to maintain</li></ul><p>In this article, we’ll build an advanced navigation architecture in SwiftUI using:</p><ul><li>NavigationStack</li><li>Router Pattern</li><li>NavigationContainer</li><li>Sheet &amp; FullScreen handling</li><li>Deep Linking</li><li>Centralized navigation state</li></ul><h3>Why Traditional Navigation Becomes Difficult</h3><p>SwiftUI makes simple navigation easy, but large applications often face problems such as:</p><ul><li>Navigation logic spread across multiple views</li><li>Difficult state management</li><li>Complex deep linking</li><li>Hard-to-maintain flows</li><li>Tight coupling between screens</li></ul><p>When applications scale, navigation can quickly become messy.</p><p>That’s where a centralized Router architecture becomes useful.</p><h3>What We’re Building</h3><p>We’ll create a production-ready navigation system that supports:</p><p>✅ Push Navigation<br>✅ Sheet Presentation<br>✅ Full Screen Covers<br>✅ Deep Linking<br>✅ Centralized Routing<br>✅ State-Driven Navigation</p><h3>High Level Architecture</h3><pre>Views<br>   ↓<br>Router<br>   ↓<br>NavigationContainer<br>   ↓<br>NavigationStack<br>   ↓<br>Destinations</pre><p>The Router becomes the single source of truth for navigation state.</p><h3>Step 1 — Create Destination Models</h3><p>We define all navigation routes in one place.</p><pre>enum PushDestination: Hashable {<br>    case detail(String)<br>    case profile<br>}</pre><p>For sheets:</p><pre>enum SheetDestination: Identifiable {<br>    case settings<br>    var id: String {<br>        switch self {<br>        case .settings:<br>            return &quot;settings&quot;<br>        }<br>    }<br>}</pre><p>For full screen covers:</p><pre>enum FullScreenDestination: Identifiable {<br>    case fullScreen<br>    var id: String {<br>        switch self {<br>        case .fullScreen:<br>            return &quot;fullScreen&quot;<br>        }<br>    }<br>}</pre><p>This gives us type-safe navigation.</p><h3>Step 2 — Create the Router</h3><p>The Router manages all navigation actions.</p><pre>@Observable<br>final class Router {<br>    var navigationStackPath = NavigationPath()<br>    var presentingSheet: SheetDestination?<br>    var presentingFullScreen: FullScreenDestination?<br>}</pre><h3>Push Navigation</h3><pre>func push(_ destination: PushDestination) {<br>    navigationStackPath.append(destination)<br>}</pre><h3>Pop Navigation</h3><pre>func pop() {<br>    navigationStackPath.removeLast()<br>}</pre><h3>Pop to Root</h3><pre>func popToRoot() {<br>    navigationStackPath = NavigationPath()<br>}</pre><h3>Sheet Presentation</h3><pre>func presentSheet(_ sheet: SheetDestination) {<br>    presentingSheet = sheet<br>}</pre><h3>Full Screen Presentation</h3><pre>func presentFullScreen(_ destination: FullScreenDestination) {<br>    presentingFullScreen = destination<br>}</pre><h3>Step 3 — Build NavigationContainer</h3><p>The NavigationContainer wraps the entire app.</p><pre>NavigationStack(path: $router.navigationStackPath) {<br>    content()<br>        .navigationDestination(for: PushDestination.self) { destination in<br>            view(for: destination)<br>        }<br>}</pre><p>This container also manages:</p><ul><li>Sheets</li><li>FullScreenCover</li><li>Deep links</li><li>Environment injection</li></ul><h3>Handling Sheets</h3><pre>.sheet(item: $router.presentingSheet) { sheet in<br>    sheetView(for: sheet)<br>}</pre><h3>Handling Full Screen Covers</h3><pre>.fullScreenCover(item: $router.presentingFullScreen) { fullScreen in<br>    fullScreenView(for: fullScreen)<br>}</pre><h3>Step 4 — Environment Injection</h3><p>We inject the router globally.</p><pre>.environment(router)</pre><p>Now every screen can access navigation without manually passing dependencies.</p><p>Example:</p><pre>@Environment(Router.self) private var router</pre><p>This keeps views clean and reusable.</p><h3>Step 5 — Push Navigation Example</h3><pre>Button(&quot;Open Detail&quot;) {<br>    router.push(.detail(&quot;SwiftUI&quot;))<br>}</pre><p>This creates programmatic navigation with centralized control.</p><h3>Step 6 — Deep Linking</h3><p>Deep linking becomes much easier with centralized routing.</p><p>Example:</p><pre>myapp://profile</pre><p>Handling:</p><pre>func handleDeepLink(_ url: URL) {<br>    if url.absoluteString.contains(&quot;profile&quot;) {<br>        push(.profile)<br>    }<br>}</pre><h3>Add Deep Link Support in Info.plist</h3><pre>&lt;key&gt;CFBundleURLTypes&lt;/key&gt;<br>&lt;array&gt;<br>    &lt;dict&gt;<br>        &lt;key&gt;CFBundleURLSchemes&lt;/key&gt;<br>        &lt;array&gt;<br>            &lt;string&gt;myapp&lt;/string&gt;<br>        &lt;/array&gt;<br>    &lt;/dict&gt;<br>&lt;/array&gt;</pre><h3>Why This Architecture Works</h3><h3>1. Centralized Navigation</h3><p>All navigation flows through a single Router.</p><p>This improves:</p><ul><li>Readability</li><li>Maintainability</li><li>Predictability</li></ul><h3>2. Type-Safe Navigation</h3><p>Using enums prevents invalid routes.</p><pre>router.push(.profile)</pre><p>instead of fragile string-based navigation.</p><h3>3. Scalable Structure</h3><p>This architecture scales well for:</p><ul><li>Enterprise applications</li><li>Modular apps</li><li>Large SwiftUI projects</li><li>Multi-team development</li></ul><h3>4. Better Testing</h3><p>Because navigation is centralized, testing becomes easier.</p><p>You can validate navigation behavior independently from UI.</p><h3>MVVM Compatibility</h3><p>This architecture works perfectly with:</p><ul><li>MVVM</li><li>Clean Architecture</li><li>Coordinator Pattern</li><li>Modular Architecture</li></ul><p>The Router separates:</p><ul><li>UI logic</li><li>Navigation logic</li><li>Business logic</li></ul><p>This creates cleaner codebases.</p><h3>Real-World Use Cases</h3><p>This navigation approach is commonly used in:</p><ul><li>FinTech apps</li><li>E-commerce applications</li><li>Social media platforms</li><li>Enterprise products</li><li>Scalable SwiftUI applications</li></ul><h3>Advantages Over Traditional Navigation</h3><p><strong>Traditional Navigation</strong></p><p><strong>Router Architecture</strong></p><p>Navigation inside views</p><p>Centralized navigation</p><p>Hard to scale</p><p>Scalable</p><p>Difficult deep linking</p><p>Easy deep linking</p><p>Tight coupling</p><p>Decoupled architecture</p><p>Repetitive logic</p><p>Reusable system</p><h3>Final Thoughts</h3><p>SwiftUI’s NavigationStack combined with the Router pattern creates a powerful and scalable navigation system for modern iOS applications.</p><p>This architecture provides:</p><p>✅ Reusable navigation<br>✅ Cleaner code structure<br>✅ Better maintainability<br>✅ Deep link support<br>✅ State-driven navigation<br>✅ Production-ready scalability</p><p>As SwiftUI applications grow, investing in a strong navigation architecture becomes extremely valuable.</p><h3>Key Takeaways</h3><ul><li>Use NavigationStack for modern navigation</li><li>Centralize navigation with a Router</li><li>Use enums for type-safe destinations</li><li>Keep navigation state-driven</li><li>Separate navigation from UI logic</li><li>Design architecture for scalability</li></ul><h3>Conclusion</h3><p>Advanced navigation architecture is an essential part of building scalable SwiftUI applications.</p><p>By combining:</p><ul><li>NavigationStack</li><li>Router Pattern</li><li>Environment Injection</li><li>State-driven navigation</li></ul><p>you can create clean, modular, and production-ready iOS applications that are easier to maintain and scale.</p><h3>Thanks for reading!</h3><p>If you enjoyed this article, feel free to connect and follow for more iOS and SwiftUI architecture content.</p><p>GitHub: <a href="https://github.com/MidlajMc/AdvancedNavigation.git">https://github.com/MidlajMc/AdvancedNavigation.git</a></p><p>#SwiftUI #iOSDevelopment #NavigationStack #Swift #MVVM #iOSEngineer #MobileDevelopment</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0dc786968a6c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a Contacts App in SwiftUI using SwiftData]]></title>
            <link>https://medium.com/@midhlag55/building-a-contacts-app-in-swiftui-using-swiftdata-c97b3a1cd0e5?source=rss-e09f5db58866------2</link>
            <guid isPermaLink="false">https://medium.com/p/c97b3a1cd0e5</guid>
            <category><![CDATA[ios-apps]]></category>
            <category><![CDATA[swiftdata]]></category>
            <category><![CDATA[ios-architecture]]></category>
            <category><![CDATA[ios-app-development]]></category>
            <category><![CDATA[swiftui]]></category>
            <dc:creator><![CDATA[Midlaj]]></dc:creator>
            <pubDate>Mon, 27 Apr 2026 17:42:58 GMT</pubDate>
            <atom:updated>2026-04-27T17:42:58.158Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GCf9ab3cx0JzgsBeUGX-vQ.png" /></figure><p>Apple introduced <strong>SwiftData</strong> as a modern, lightweight persistence framework that replaces much of the complexity of Core Data. In this article, we’ll build a simple yet practical <strong>Contacts App</strong> using <strong>SwiftUI + SwiftData</strong>, covering:</p><ul><li>Data persistence</li><li>CRUD operations (Create, Read, Update, Delete)</li><li>Navigation</li><li>Search functionality</li></ul><h3>Why SwiftData?</h3><p>If you’ve worked with Core Data before, you know it can be powerful — but also verbose and complex.<br>SwiftData simplifies things by integrating directly with SwiftUI.</p><p>Key benefits:</p><ul><li>Minimal boilerplate</li><li>Seamless SwiftUI integration</li><li>Automatic UI updates</li><li>Declarative data fetching</li></ul><h3>Step 1: Define the Model</h3><p>We start by defining our data model using the @Model macro.</p><pre>import SwiftData<br><br>@Model<br>class Contact {<br>    var firstName: String<br>    var lastName: String<br>    var email: String<br>    var phone: String<br>    <br>    init(firstName: String,<br>         lastName: String,<br>         email: String,<br>         phone: String) {<br>        self.firstName = firstName<br>        self.lastName = lastName<br>        self.email = email<br>        self.phone = phone<br>    }<br>    <br>    var placeHolder: String {<br>        let first = firstName.prefix(1)<br>        let last = lastName.prefix(1)<br>        return String(first + last)<br>    }<br>}</pre><p>Notice: We <strong>don’t manually manage IDs</strong> — SwiftData handles identity internally.</p><h3>Step 2: Configure SwiftData</h3><p>Set up the model container in your App entry point:</p><pre>import SwiftUI<br>import SwiftData<br><br>@main<br>struct ContactsApp: App {<br>    var body: some Scene {<br>        WindowGroup {<br>            ContentView()<br>        }<br>        .modelContainer(for: Contact.self)<br>    }<br>}</pre><p>This enables persistence across app launches.</p><h3>Step 3: Fetch Data with @Query</h3><p>SwiftData provides @Query for fetching data declaratively.</p><pre>@Query private var contacts: [Contact]</pre><p>This automatically:</p><ul><li>Fetches stored contacts</li><li>Updates UI when data changes</li></ul><h3>Step 4: Add Search Functionality</h3><pre>@State private var searchText = &quot;&quot;<br><br>var filteredContacts: [Contact] {<br>    if searchText.isEmpty {<br>        return contacts<br>    } else {<br>        return contacts.filter {<br>            $0.firstName.localizedCaseInsensitiveContains(searchText) ||<br>            $0.lastName.localizedCaseInsensitiveContains(searchText)<br>        }<br>    }<br>}</pre><h3>Step 5: Build the UI</h3><h3>Contact List</h3><pre>List {<br>    ForEach(filteredContacts) { contact in<br>        NavigationLink(value: contact) {<br>            ContactRowView(data: contact)<br>        }<br>    }<br>}<br>.searchable(text: $searchText)<br>.navigationTitle(&quot;Contacts&quot;)</pre><h3>Step 6: Add New Contact</h3><pre>@Environment(\.modelContext) private var context<br><br>Button(&quot;Save&quot;) {<br>    let contact = Contact(<br>        firstName: firstName,<br>        lastName: lastName,<br>        email: email,<br>        phone: phone<br>    )<br>    <br>    context.insert(contact)<br>    try? context.save()<br>}</pre><h3>Step 7: Edit Contact</h3><p>SwiftData lets you bind directly to model properties:</p><pre>TextField(&quot;First Name&quot;, text: Binding(<br>    get: { contact.firstName },<br>    set: { contact.firstName = $0 }<br>))</pre><p>Save changes automatically or manually:</p><pre>try? context.save()</pre><h3>Step 8: Delete Contact</h3><pre>context.delete(contact)<br>try? context.save()</pre><h3>Common Pitfalls</h3><p>Here are a few issues you might run into:</p><h3>Only one item persists after relaunch</h3><p><strong>Cause:</strong> Manual id conflicts or store reset<br><strong>Fix:</strong> Let SwiftData handle identity</p><h3>Data not saving</h3><p><strong>Fix:</strong> Call:</p><pre>try? context.save()</pre><h3>Data disappears after changes</h3><p><strong>Cause:</strong> Model schema changed<br><strong>Fix:</strong> Delete and reinstall the app during development</p><h3>Final Thoughts</h3><p>SwiftData dramatically simplifies local data persistence in iOS apps. With just a few lines of code, you get:</p><ul><li>Persistent storage</li><li>Automatic UI updates</li><li>Clean and readable architecture</li></ul><p>This Contacts app is a great starting point for:</p><ul><li>Notes apps</li><li>To-do lists</li><li>CRM tools</li><li>Offline-first apps</li></ul><h3>What’s Next?</h3><p>You can extend this app by adding:</p><ul><li>Profile images</li><li>Contact grouping (A–Z sections)</li><li>Cloud sync with iCloud</li><li>Advanced filtering using @Query(filter:)</li></ul><h3>Conclusion</h3><p>SwiftData + SwiftUI is a powerful combination that enables rapid development with minimal complexity. If you’re targeting iOS 17+, this should be your default approach for persistence.</p><p>GitHub Link: <a href="https://github.com/MidlajMc/ContactsApp-SwiftUI-SwiftData-.git">https://github.com/MidlajMc/ContactsApp-SwiftUI-SwiftData-.git</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c97b3a1cd0e5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Log Every API Call in Swift Without a Single print() Statement]]></title>
            <link>https://medium.com/@midhlag55/how-to-log-every-api-call-in-swift-without-a-single-print-statement-cf2b8f9f31ff?source=rss-e09f5db58866------2</link>
            <guid isPermaLink="false">https://medium.com/p/cf2b8f9f31ff</guid>
            <category><![CDATA[networking]]></category>
            <category><![CDATA[debugging]]></category>
            <category><![CDATA[ios-development]]></category>
            <category><![CDATA[api-logging]]></category>
            <category><![CDATA[swift-programming]]></category>
            <dc:creator><![CDATA[Midlaj]]></dc:creator>
            <pubDate>Wed, 18 Mar 2026 15:23:52 GMT</pubDate>
            <atom:updated>2026-03-26T14:20:41.798Z</atom:updated>
            <content:encoded><![CDATA[<p><em>A deep dive into Alamofire’s EventMonitor, Apple’s os.Logger, and a production-ready pattern that gives you beautiful, zero-effort network logs in Xcode.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hhJjf81I37m522ojK-jfgA.png" /></figure><p>Every iOS developer has been there — you fire a network request, something goes wrong, and you start peppering your codebase with print() statements to figure out what the API actually sent and received. You get the bug fixed, commit the code, then realise you shipped fifteen print() calls to production.</p><p>There is a better way. Alamofire has a powerful event monitoring system that lets you intercept every single network request and response globally. Pair it with Apple’s os.Logger and you get structured, filterable, beautifully formatted logs in Xcode’s console — automatically, for every API call your app ever makes, with zero changes to your business logic.</p><blockquote><em>No print(). No debug flags. No forgetting to remove that log statement before your App Store submission.</em></blockquote><p>In this article, we will walk through building a production-grade APILogger that your team can drop into any project. By the end you will understand exactly how Alamofire’s EventMonitor works, why os.Logger is superior to print() for networking logs, and how to combine them with a file-based logger for long-term diagnostics.</p><h4><strong>The Problem With print()</strong></h4><p>When we reach for print() to debug API calls, we accept a set of trade-offs that quietly accumulate into real problems.</p><ul><li>print() output is unstructured — it is a wall of text with no metadata, no severity level, and no way to filter by subsystem.</li><li>It is too easy to leave print() calls in production code. They do not cause crashes, so they slip through code review.</li><li>print() has no concept of categories. All your API logs sit alongside UIKit warnings, CoreData noise, and your colleague’s debug output.</li><li>There is no persistence. If your app crashes or the user navigates away, those logs are gone.</li></ul><p>The moment your app grows beyond a handful of API calls, you need something better.</p><h4><strong>Meet Alamofire’s EventMonitor</strong></h4><p>Alamofire’s Session object accepts an array of EventMonitor instances at initialisation time. An EventMonitor is a protocol with dozens of lifecycle hooks — you can observe when a request is created, when it retries, when authentication happens, and crucially, when a response is parsed.</p><p>The key method for logging is:</p><pre>func request&lt;Value&gt;(<br>    _ request: DataRequest,<br>    didParseResponse response: DataResponse&lt;Value, AFError&gt;<br>)</pre><p>This fires after Alamofire finishes parsing the response, giving you access to both the original request (method, URL, headers, body) and the final response (status code, decoded data, error). It is the single hook you need to log everything.</p><h4><strong>Registering the monitor</strong></h4><p>You register your EventMonitor when you create the Alamofire Session. This is typically done in a shared NetworkManager:</p><pre>class NetworkManager {<br>    static let shared = NetworkManager()<br> <br>    let session: Session = {<br>        let config = URLSessionConfiguration.af.default<br>        config.timeoutIntervalForRequest = 30<br>        return Session(<br>            configuration: config,<br>            eventMonitors: [APILogger()]  // 👈 registered once, logs everything<br>        )<br>    }()<br>}</pre><p>That single line — eventMonitors: [APILogger()] — is the only change you make to your networking layer. Every request that flows through this Session will be observed by your logger automatically.</p><h4><strong>Why os.Logger Beats print()</strong></h4><p>Apple introduced the unified logging system in iOS 10, and os.Logger (the modern Swift API, available from iOS 14) is its best interface. Here is why it matters for API logging:</p><p><strong>Structured log levels</strong></p><p>os.Logger has proper severity levels. You call logger.info() for successful responses and logger.error() for failures. In Xcode’s console, info messages appear in black and errors appear in red. At a glance you can see which requests failed without reading a single line.</p><p><strong>Subsystem and category filtering</strong></p><p>Every os.Logger instance is created with a subsystem (typically your bundle identifier or app name) and a category:</p><pre>let logger = os.Logger(subsystem: &quot;MyApp&quot;, category: &quot;API&quot;)</pre><p>In Xcode’s console filter bar, you can type “App” or “API” and immediately isolate your network logs from everything else the system is printing. This is game-changing when you are debugging a complex flow.</p><p><strong>It works with Console.app too</strong></p><p>Because os.Logger feeds into Apple’s unified logging system, all your API logs are also visible in Console.app on your Mac when the device is connected. You can filter, search, and export logs even from TestFlight builds — something print() cannot do at all.</p><p><strong>No performance cost in production</strong></p><p>By default, os.Logger’s debug-level messages are not persisted in production. You can tune what gets stored and for how long. This means you get rich logging in development without any meaningful overhead in shipped builds.</p><h4><strong>Building the APILogger</strong></h4><p>Here is the complete, production-ready implementation:</p><pre>import Foundation<br>import Alamofire<br>import OSLog<br> <br>class APILogger: EventMonitor, @unchecked Sendable {<br> <br>    let queue = DispatchQueue(label: &quot;APILoggerQueue&quot;)<br>    let logger = os.Logger(subsystem: &quot;MyApp&quot;, category: &quot;API&quot;)<br> <br>    func request&lt;Value&gt;(<br>        _ request: DataRequest,<br>        didParseResponse response: DataResponse&lt;Value, AFError&gt;<br>    ) {<br>        var message = &quot;\n══════════════════════════════════&quot;<br>        message += &quot;\n➜ \(request.request?.httpMethod ?? &quot;&quot;)&quot;<br>        message += &quot; [\(response.response?.statusCode ?? 0)]&quot;<br>        message += &quot;\n🌐 \(request.request?.url?.absoluteString ?? &quot;&quot;)&quot;<br> <br>        if let headers = request.request?.allHTTPHeaderFields,<br>           !headers.isEmpty {<br>            message += &quot;\n📋 Headers:\n   \(headers)&quot;<br>        }<br> <br>        if let body = request.request?.httpBody {<br>            message += &quot;\n📤 Parameters:\n   \(prettyJSON(data: body))&quot;<br>        }<br> <br>        if let data = response.data {<br>            message += &quot;\n📥 Response:\n   \(prettyJSON(data: data))&quot;<br>        }<br> <br>        message += &quot;\n══════════════════════════════════&quot;<br> <br>        switch response.result {<br>        case .success:<br>            logger.info(&quot;\(message)&quot;)<br>        case .failure(let error):<br>            message += &quot;\n❌ \(error.localizedDescription)&quot;<br>            logger.error(&quot;\(message)&quot;)<br>        }<br>    }<br> <br>    private func prettyJSON(data: Data) -&gt; String {<br>        guard<br>            let obj = try? JSONSerialization.jsonObject(with: data),<br>            let pretty = try? JSONSerialization.data(<br>                withJSONObject: obj,<br>                options: .prettyPrinted<br>            ),<br>            let str = String(data: pretty, encoding: .utf8)<br>        else {<br>            return String(data: data, encoding: .utf8) ?? &quot;—&quot;<br>        }<br>        return str<br>    }<br>}</pre><p>Let us walk through what this does:</p><ul><li>The queue property satisfies the EventMonitor protocol requirement. Alamofire delivers events on this queue, keeping logging off the main thread.</li><li>The logger is created with a subsystem and category so you can filter in Xcode.</li><li>The request&lt;Value&gt;(_:didParseResponse:) method builds a formatted message string containing the HTTP method, status code, URL, request headers, request body (if any), and the response body.</li><li>prettyJSON transforms raw Data into indented, human-readable JSON. If the data is not valid JSON (HTML error pages, for example), it falls back to a plain string.</li><li>On success, logger.info() logs the message. On failure, logger.error() logs it with the error description appended.</li></ul><h4><strong>Adding Persistent File Logging</strong></h4><p>For long debugging sessions, especially when working on issues that only reproduce in production or TestFlight builds, it is valuable to persist logs to a file. The pattern is straightforward — after building your message string, call a file logger before handing off to os.Logger:</p><pre>// Inside request&lt;Value&gt;(_:didParseResponse:)<br> <br>// Determine the log type (e.g. separate podium API calls)<br>let isPodiumAPI = request.request?.url?<br>    .pathComponents<br>    .contains(where: { $0 == &quot;podium&quot; }) ?? false<br> <br>DispatchQueue.main.async {<br>    FLogger.shared.log(<br>        message,<br>        type: isPodiumAPI ? .podium : .API<br>    )<br>}<br> <br>// Then log to Xcode console as before<br>switch response.result {<br>case .success:<br>    logger.info(&quot;\(message)&quot;)<br>case .failure(let error):<br>    logger.error(&quot;\(message)&quot;)<br>}</pre><p>The FLogger class writes timestamped log entries to dated files in the app’s Application Support directory. You can then export these as encrypted ZIP archives for sharing with your backend team or for offline debugging.</p><h4><strong>Thread Safety Considerations</strong></h4><p>There are two things to be careful about when building a logger that runs across multiple threads.</p><p><strong>DateFormatter is not thread-safe</strong></p><p>NSDateFormatter — and by extension Swift’s DateFormatter — is not thread-safe. If you use a shared DateFormatter from multiple background threads simultaneously, you will hit ICU crashes in production. The fix is to give each logger class its own dedicated DateFormatter instance and always access it from a single serial queue:</p><pre>private let floggerLogQueue = DispatchQueue(label: &quot;com.app.flogger&quot;)<br> <br>private let logDateFormatter: DateFormatter = {<br>    let formatter = DateFormatter()<br>    formatter.locale = Locale(identifier: &quot;en_US_POSIX&quot;)<br>    formatter.dateFormat = &quot;dd/MM/yyyy h:mm a&quot;<br>    return formatter<br>}()<br> <br>func log(_ item: Any, type: LogType = .info) {<br>    floggerLogQueue.async {<br>        // All access to logDateFormatter happens here,<br>        // on a single serial queue — safe from any thread.<br>        let timestamp = self.logDateFormatter.string(from: Date())<br>        // ...<br>    }<br>}</pre><p><strong>The @unchecked Sendable annotation</strong></p><p>You will notice APILogger is marked @unchecked Sendable. This is required because Alamofire’s EventMonitor protocol must be Sendable in Swift 6 concurrency mode, but our class contains mutable state (the queue). By marking it @unchecked Sendable, we are telling the compiler we have manually verified thread safety — which we have, because all event delivery happens on a single DispatchQueue.</p><h4><strong>Filtering Logs in Xcode</strong></h4><p>Once your APILogger is wired up, here is how to get the most out of the console:</p><ul><li>Type your subsystem name (e.g. “MyApp”) in the Xcode console filter bar to hide everything else.</li><li>Type “API” to filter by category if you have multiple os.Logger instances.</li><li>The red highlighting on logger.error() calls makes failed requests instantly visible.</li><li>In Console.app, you can set the Action menu to “Include Info Messages” and “Include Debug Messages” for full verbosity.</li></ul><p>For teams using TestFlight, Console.app on Mac with the device connected gives you real-time os.Logger output — including from builds your testers are running. This is enormously useful for bugs that only reproduce on real hardware.</p><h4><strong>Production Checklist</strong></h4><p>Before shipping your logging setup, run through these:</p><ul><li>Guard file logging behind a scheme check (Bundle.main.scheme != .production) so you are not writing potentially sensitive API responses to disk in production builds.</li><li>Never log Authorization header values in full. Consider masking tokens: let masked = String(repeating: “*”, count: max(0, token.count — 4)) + token.suffix(4).</li><li>Set a log rotation policy. If you write logs to disk every request, the files grow quickly. Date-partitioned files (one per day) that are automatically pruned after seven days are a sensible default.</li><li>For password-protected log exports, use AES-256 encryption. The key should be derived from a password using SHA-256, never stored plaintext.</li></ul><h4><strong>But What About Pure URLSession Apps?</strong></h4><p>Everything we have covered so far uses Alamofire’s EventMonitor. But what if your app uses native URLSession directly — or mixes URLSession with Alamofire, or uses third-party SDKs that do their own networking under the hood?</p><p>Apple has the answer built into the foundation layer itself: URLProtocol.</p><p><strong>What is URLProtocol?</strong></p><p>Despite the name, URLProtocol is not a Swift protocol — it is an abstract class you subclass. It sits at the very bottom of the URLSession stack and lets you intercept, inspect, or even redirect any URL request before it hits the network. It was designed for things like caching, mocking, and — in our case — logging.</p><blockquote><em>URLProtocol intercepts at the URLSession level, which means it catches traffic from every library in your app — Alamofire, SDKs, SwiftUI’s .task{}, all of it.</em></blockquote><p><strong>Step 1: Subclass URLProtocol</strong></p><p>Create a new file called APILoggerProtocol.swift and subclass URLProtocol:</p><pre>import Foundation<br>import OSLog<br> <br>class APILoggerProtocol: URLProtocol {<br> <br>    let logger = os.Logger(subsystem: &quot;MyApp&quot;, category: &quot;API&quot;)<br>    private var dataTask: URLSessionDataTask?<br>    private var responseData = Data()<br> <br>    // ✅ Return true to intercept all requests<br>    override class func canInit(with request: URLRequest) -&gt; Bool {<br>        // Prevent infinite loop — skip already-tagged requests<br>        if URLProtocol.property(forKey: &quot;Logged&quot;, in: request) != nil {<br>            return false<br>        }<br>        return true<br>    }<br> <br>    override class func canonicalRequest(for request: URLRequest) -&gt; URLRequest {<br>        return request<br>    }<br> <br>    override func startLoading() {<br>        // Tag the request to prevent re-interception<br>        let mutable = (request as NSURLRequest).mutableCopy() as! NSMutableURLRequest<br>        URLProtocol.setProperty(true, forKey: &quot;Logged&quot;, in: mutable)<br> <br>        let session = URLSession(configuration: .default,<br>                                 delegate: self,<br>                                 delegateQueue: nil)<br>        dataTask = session.dataTask(with: mutable as URLRequest)<br>        dataTask?.resume()<br>    }<br> <br>    override func stopLoading() {<br>        dataTask?.cancel()<br>    }<br>}</pre><p>The canInit(with:) method is the gatekeeper. Return true and URLProtocol will intercept the request. The “Logged” property tag prevents an infinite loop — without it, each intercepted request would create a new session that gets intercepted again, forever.</p><p><strong>Step 2: Capture the response with URLSessionDataDelegate</strong></p><p>Extend your class to implement URLSessionDataDelegate so you can collect the response data as it streams in:</p><pre>extension APILoggerProtocol: URLSessionDataDelegate {<br> <br>    func urlSession(_ session: URLSession,<br>                    dataTask: URLSessionDataTask,<br>                    didReceive data: Data) {<br>        responseData.append(data)<br>        client?.urlProtocol(self, didLoad: data)<br>    }<br> <br>    func urlSession(_ session: URLSession,<br>                    dataTask: URLSessionDataTask,<br>                    didReceive response: URLResponse,<br>                    completionHandler: @escaping (URLSession.ResponseDisposition) -&gt; Void) {<br>        client?.urlProtocol(self, didReceive: response, cacheStoragePolicy: .allowed)<br>        completionHandler(.allow)<br>    }<br> <br>    func urlSession(_ session: URLSession,<br>                    task: URLSessionTask,<br>                    didCompleteWithError error: Error?) {<br>        defer { responseData = Data() }<br> <br>        if let error = error {<br>            client?.urlProtocol(self, didFailWithError: error)<br>        } else {<br>            client?.urlProtocolDidFinishLoading(self)<br>        }<br>        logRequest(task: task, error: error)<br>    }<br> <br>    private func logRequest(task: URLSessionTask, error: Error?) {<br>        guard let request = task.originalRequest else { return }<br> <br>        var message = &quot;\n══════════════════════════════&quot;<br>        message += &quot;\n➜ \(request.httpMethod ?? &quot;&quot;)&quot;<br>        message += &quot; [\((task.response as? HTTPURLResponse)?.statusCode ?? 0)]&quot;<br>        message += &quot;\n🌐 \(request.url?.absoluteString ?? &quot;&quot;)&quot;<br> <br>        if let headers = request.allHTTPHeaderFields, !headers.isEmpty {<br>            message += &quot;\n📋 Headers: \(headers)&quot;<br>        }<br>        if let body = request.httpBody,<br>           let str = String(data: body, encoding: .utf8) {<br>            message += &quot;\n📤 Body: \(str)&quot;<br>        }<br>        if !responseData.isEmpty,<br>           let obj = try? JSONSerialization.jsonObject(with: responseData),<br>           let pretty = try? JSONSerialization.data(withJSONObject: obj,<br>                                                    options: .prettyPrinted),<br>           let str = String(data: pretty, encoding: .utf8) {<br>            message += &quot;\n📥 Response: \(str)&quot;<br>        }<br>        message += &quot;\n══════════════════════════════&quot;<br> <br>        if let error {<br>            logger.error(&quot;\(message)\n❌ \(error.localizedDescription)&quot;)<br>        } else {<br>            logger.info(&quot;\(message)&quot;)<br>        }<br>    }<br>}</pre><p><strong>Step 3: Register once at app startup</strong></p><p>Register your URLProtocol subclass in your app entry point. One line is all it takes:</p><pre>@main<br>struct MyApp: App {<br>    init() {<br>        // ✅ Registers globally — intercepts ALL URLSession traffic<br>        URLProtocol.registerClass(APILoggerProtocol.self)<br>    }<br> <br>    var body: some Scene {<br>        WindowGroup {<br>            ContentView()<br>        }<br>    }<br>}</pre><p>From this point forward, every URLSession request in your app — including those made by third-party libraries — will be intercepted and logged automatically.</p><h4><strong>EventMonitor vs URLProtocol: Which Should You Use?</strong></h4><p>Both approaches use os.Logger and produce identical console output. The difference is scope and setup cost.</p><pre>┌─────────────────────────┬──────────────────────┬──────────────────────┐<br>│                         │ EventMonitor         │ URLProtocol          │<br>│                         │ (Alamofire)          │ (URLSession)         │<br>├─────────────────────────┼──────────────────────┼──────────────────────┤<br>│ Setup                   │ eventMonitors:[...]  │ registerClass(...)   │<br>│ Scope                   │ Alamofire only       │ ALL URLSession calls  │<br>│ Third-party SDKs        │ No                   │ Yes                  │<br>│ SwiftUI .task {}        │ No                   │ Yes                  │<br>│ Boilerplate             │ Minimal              │ Moderate             │<br>│ Access to decoded model │ Yes                  │ No (raw bytes only)  │<br>│ Retry / auth hooks      │ Yes                  │ No                   │<br>└─────────────────────────┴──────────────────────┴──────────────────────┘</pre><p>The rule of thumb is simple: if your app uses Alamofire for all its networking, EventMonitor is the cleaner choice. If your app mixes networking approaches — URLSession directly in some places, Alamofire in others, third-party SDKs doing their own thing — reach for URLProtocol. It catches everything.</p><p>For maximum coverage, you can even use both simultaneously. Register APILoggerProtocol globally and add APILogger to your Alamofire session. Alamofire requests will be logged twice unless you add a guard to canInit(with:) that skips requests already tagged by Alamofire’s internal machinery.</p><h4><strong>Putting It All Together</strong></h4><p>Regardless of which approach you choose, the architecture is the same. Your networking code fires a request. The logging layer intercepts it automatically — either via Alamofire’s EventMonitor or via URLProtocol. The interceptor formats the message and hands it to os.Logger. Xcode’s console displays it, colour-coded by severity, filterable by subsystem and category. No print(). No debug flags. No accidental production commits.</p><blockquote><em>One registration. Every request logged. No changes to your business logic — ever.</em></blockquote><p>The two techniques are complementary, not competing. EventMonitor gives you deep integration with Alamofire’s lifecycle — retries, authentication, serialisation. URLProtocol gives you universal coverage at the transport layer. Together they form a complete logging story for any iOS app.</p><p>If you are starting a new project, wire up EventMonitor on day one and you will never miss a network log again. If you are joining a large codebase with mixed networking, drop in URLProtocol and get immediate visibility across the entire app with a single line in your App entry point.</p><p>Sample Project: <a href="https://github.com/midlaj55/APILogger/tree/main">https://github.com/midlaj55/APILogger/tree/main</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cf2b8f9f31ff" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a Color Sort Game in SwiftUI (Step-by-Step)]]></title>
            <link>https://medium.com/@midhlag55/building-a-color-sort-game-in-swiftui-step-by-step-c7cb5ff2e117?source=rss-e09f5db58866------2</link>
            <guid isPermaLink="false">https://medium.com/p/c7cb5ff2e117</guid>
            <category><![CDATA[games]]></category>
            <category><![CDATA[swiftui]]></category>
            <category><![CDATA[game-development]]></category>
            <category><![CDATA[ios-development]]></category>
            <category><![CDATA[animation]]></category>
            <dc:creator><![CDATA[Midlaj]]></dc:creator>
            <pubDate>Sat, 28 Feb 2026 06:38:07 GMT</pubDate>
            <atom:updated>2026-02-28T06:38:07.551Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*L3g4JhBvtB79d6DPhB4GGg.png" /></figure><p>Mobile puzzle games are a great way to sharpen UI skills while practicing clean architecture. In this article, I’ll walk you through how I built a <strong>Color Sort Game</strong> in SwiftUI with:</p><ul><li><strong>Custom bottle shapes</strong></li><li><strong>Smooth pour animations</strong></li><li><strong>Game logic using MVVM</strong></li><li><strong>A splash screen with animations</strong></li><li><strong>Clean and reusable SwiftUI components</strong></li></ul><p>Let’s break it down.</p><h4>What Is a Color Sort Game?</h4><p>A Color Sort game is a simple puzzle:</p><ul><li><strong>You have multiple bottles.</strong></li><li><strong>Each bottle contains stacked colored layers.</strong></li><li><strong>You can pour color from one bottle to another.</strong></li><li><strong>The goal is to group the same colors into a single bottle.</strong></li></ul><p>The challenge?<br>You can only pour:</p><ul><li><strong>If the target bottle has space.</strong></li><li><strong>If the top colors match.</strong></li><li><strong>Or if the bottle is empty.</strong></li></ul><h4>Architecture: MVVM in SwiftUI</h4><p>I structured the app using <strong>MVVM (Model-View-ViewModel)</strong>:</p><h4><strong>Model</strong></h4><pre>struct BottleModel {<br>    var layers: [Color]<br>    var isCompleted: Bool = false<br>}</pre><p>Each bottle stores:</p><ul><li><strong>Its color layers</strong></li><li><strong>Whether it’s completed</strong></li></ul><h4>ViewModel — Game Logic</h4><p>The GameViewModel handles:</p><ul><li><strong>Generating bottles</strong></li><li><strong>Selecting bottles</strong></li><li><strong>Checking valid moves</strong></li><li><strong>Performing pour logic</strong></li><li><strong>Handling animations</strong></li><li><strong>Checking win conditions</strong></li></ul><pre>class GameViewModel: ObservableObject {<br>    @Published var bottles: [BottleModel] = []<br>    @Published var selectedBottleIndex: Int?<br>    @Published var isPouring: Bool = false<br>}</pre><p>Using @Published ensures the UI updates automatically when state changes.</p><h4>Generating Random Bottles</h4><p>We generate a color pool:</p><pre>private let gameColors: [Color] = [.red, .green, .blue, .orange, .purple]</pre><p>Each color is repeated maxCapacity times.</p><p>Then we randomly distribute colors across bottles — leaving one bottle empty so the game is solvable.</p><p>This makes the puzzle dynamic every time you hit <strong>Restart</strong>.</p><h4>Creating a Custom Bottle Shape</h4><p>Instead of using rectangles, I built a real bottle shape using Shape.</p><pre>struct BottleShape: Shape {<br>    func path(in rect: CGRect) -&gt; Path {<br>        var path = Path()<br>        ...<br>        return path<br>    }<br>}</pre><p>Using:</p><ul><li><strong>addQuadCurve for smooth curves</strong></li><li><strong>Neck + body proportions</strong></li><li><strong>Custom bottom curvature</strong></li></ul><p>This makes the UI feel polished and game-like.</p><h4>Designing the Bottle View</h4><p>BottleView is where the magic happens.</p><p>It includes:</p><ul><li><strong>Glass effect (gradients + highlights)</strong></li><li><strong>Color layers masked inside the bottle</strong></li><li><strong>Selection glow animation</strong></li><li><strong>Pour tilt animation</strong></li><li><strong>Completion cap on top</strong></li></ul><h4>Grouping Consecutive Colors</h4><p>To render stacked colors properly, I group consecutive layers:</p><pre>private func groupConsecutiveColors(_ colors: [Color]) -&gt; [ColorGroup]</pre><p>Why?</p><p>Because if you have:</p><pre>[Red, Red, Blue, Blue]</pre><p>You want:</p><ul><li><strong>One large red block</strong></li><li><strong>One large blue block</strong></li></ul><p>Not 4 tiny blocks.</p><h4>Smooth Pour Animation</h4><p>When a user selects a bottle:</p><ol><li>We calculate row &amp; column difference.</li><li>Compute horizontal + vertical offsets.</li><li>Rotate the bottle slightly while pouring.</li></ol><pre>.rotationEffect(isAnimating &amp;&amp; isPouring ? .degrees(-30) : .degrees(0), anchor: .top)</pre><p>The animation sequence:</p><ul><li>Lift bottle</li><li>Move horizontally</li><li>Tilt</li><li>Perform pour</li><li>Reset position</li></ul><p>All controlled using:</p><pre>DispatchQueue.main.asyncAfter</pre><p>Simple. Clean. Effective.</p><h4>Pour Logic (Game Rules)</h4><p>Before pouring, we validate:</p><pre>private func canPour(from sourceIndex: Int, to targetIndex: Int) -&gt; Bool</pre><p>Conditions:</p><ul><li>Source isn’t empty</li><li>Target isn’t full</li><li>Colors match OR target is empty</li></ul><p>Then we calculate how many layers can move:</p><pre>let sameColorCount = ...<br>let spaceLeft = ...<br>let pourCount = min(sameColorCount, spaceLeft)</pre><p>This allows multi-layer pours in a single move — just like the real game.</p><h4>Checking Completion</h4><p>After each move:</p><pre>private func checkBottleCompletion(_ index: Int)</pre><p>A bottle is completed when:</p><ul><li>It’s full</li><li>All colors are the same</li></ul><p>When completed, we render a capsule cap on top.</p><p>Nice visual feedback.</p><h3>UI Polish</h3><h4>Background</h4><p>A subtle gradient:</p><pre>LinearGradient(<br>    colors: [Color.blue.opacity(0.4), Color.purple.opacity(0.4)]<br>)</pre><h4>Selected Bottle Glow</h4><p>Radial gradient + blur:</p><pre>RadialGradient(...)<br>.blur(radius: 25)<br>.scaleEffect(pulse ? 1.1 : 0.95)</pre><h4>Glass Shine Effect</h4><pre>.blendMode(.plusLighter)</pre><p>Small details make it feel premium.</p><h3>Splash Screen</h3><p>Before loading the game:</p><ul><li>Bottle rotates</li><li>Logo scales up</li><li>Text fades in</li></ul><pre>withAnimation(.spring(...)) {<br>    scale = 1<br>    opacity = 1<br>}</pre><p>Then after 2.5 seconds:</p><pre>showSplash = false</pre><p>Clean transition into the game.</p><h3>Grid Layout</h3><p>We use:</p><pre>LazyVGrid(columns: columns, spacing: 30)</pre><p>Why LazyVGrid?</p><ul><li>Efficient rendering</li><li>Clean layout</li><li>Easy row/column calculations</li></ul><h3>What This Project Demonstrates</h3><p>This small game shows strong understanding of:</p><ul><li>SwiftUI animations</li><li>Custom shapes</li><li>Masking &amp; blend modes</li><li>MVVM architecture</li><li>State management</li><li>Game logic implementation</li><li>Gesture handling</li><li>Clean UI layering</li></ul><p>This is the kind of project that stands out in an iOS portfolio.</p><h3>Final Thoughts</h3><p>Building small games like this is an amazing way to:</p><ul><li>Master SwiftUI animation</li><li>Improve architecture skills</li><li>Practice UI polish</li><li>Learn state-driven UI design</li></ul><p>If you’re preparing for iOS interviews or building your portfolio — projects like this help you stand out.</p><p>Source Code: <a href="https://github.com/midlaj55/ColoursSortingGame.git">https://github.com/midlaj55/ColoursSortingGame.git</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c7cb5ff2e117" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How can we manually add meta tags in SwiftUI?]]></title>
            <link>https://medium.com/@midhlag55/how-can-we-manually-add-meta-tags-in-swiftui-15b8c029b80d?source=rss-e09f5db58866------2</link>
            <guid isPermaLink="false">https://medium.com/p/15b8c029b80d</guid>
            <category><![CDATA[swiftui]]></category>
            <category><![CDATA[meta]]></category>
            <category><![CDATA[meta-tag-generator]]></category>
            <dc:creator><![CDATA[Midlaj]]></dc:creator>
            <pubDate>Wed, 17 Apr 2024 04:44:07 GMT</pubDate>
            <atom:updated>2024-04-17T04:44:07.669Z</atom:updated>
            <content:encoded><![CDATA[<p>Metadata is information that provides context or additional details about other data. It is often described as “data about data.” Metadata is used to describe and provide information about other data, making it easier to understand, find, and work with the data it is associated with.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*KY-b0NOB2LeOTH12xdkVWw.png" /></figure><h4>In general, metadata can include information such as:</h4><p><strong>Descriptive Information:</strong> Descriptions of the data, such as titles, authors, creation dates, and summaries. This helps identify the data and understand its content.</p><p><strong>Structural Information:</strong> Information about the structure or organization of data, such as how data is stored, related data entities, and data types.</p><p><strong>Administrative Information:</strong> Information that helps manage and control data, such as data ownership, access permissions, and data versioning.</p><p><strong>Technical Information:</strong> Information about the data format, encoding, or technical aspects, such as file size and resolution.</p><h4>In software development, metadata can be used in various contexts:</h4><p><strong>APIs and Data Models:</strong> Metadata may include annotations or attributes that provide information about data models, fields, and their relationships.</p><p><strong>File Systems:</strong> Metadata can include information about files such as file names, types, sizes, creation dates, and permissions.</p><p><strong>Databases:</strong> Metadata in databases includes information about tables, columns, data types, and constraints.</p><p><strong>Media Files:</strong> For media files like images, audio, or video, metadata may include details like resolution, duration, or location where the media was created.</p><p>By providing additional context and details, metadata helps in organizing, managing, and utilizing data effectively.</p><h3>Get Your Metadata</h3><p>The first step in working with link metadata is to obtain an LPLinkMetadata object, which contains information about a URL, such as its title, icon, image, and video.</p><h4>Automatically Fetch Metadata</h4><p>Since the metadata for a link may not be readily available, you need a way to retrieve it. To do this, you can use the LPMetadataProvider class.</p><p>LPMetadataProvider is responsible for fetching metadata for a given URL and mapping it to an LPLinkMetadata object once the retrieval is complete.</p><p>LPMetadataProvider offers a method called startFetchingMetadata that initiates the metadata retrieval process.</p><p>Here’s an example to illustrate the process:</p><p>1. Create an `ObservableObject` class for managing the state of link metadata and handling the fetching of metadata.<br>2. In your SwiftUI view, use an instance of the `ObservableObject` and observe its state using the `<a href="http://twitter.com/StateObject">@StateObject</a>` or `<a href="http://twitter.com/ObservedObject">@ObservedObject</a>` property wrapper.<br>3. Handle the button action within the SwiftUI view to initiate fetching metadata and share it using a SwiftUI equivalent of the activity view controller.<br>4. Adapt the `LinkPresentationItemSource` class to a SwiftUI view or function as needed.</p><p>Here’s an example:</p><p>This class manages the state of the metadata and handles fetching metadata from a URL:</p><pre>import LinkPresentation<br>import Combine<br>class LinkMetadataManager: ObservableObject {<br> @Published var linkMetadata: LPLinkMetadata?<br> @Published var error: Error?<br> <br> func fetchURLPreview(url: URL) {<br> let metadataProvider = LPMetadataProvider()<br> metadataProvider.startFetchingMetadata(for: url) { (metadata, error) in<br> DispatchQueue.main.async {<br> if let error = error {<br> self.error = error<br> } else {<br> self.linkMetadata = metadata<br> }<br> }<br> }<br> }<br> <br> func getMetadataForSharingManually(title: String, url: URL, fileName: String, fileType: String) -&gt; LPLinkMetadata {<br> let linkMetadata = LPLinkMetadata()<br> if let path = Bundle.main.path(forResource: fileName, ofType: fileType) {<br> linkMetadata.iconProvider = NSItemProvider(contentsOf: URL(fileURLWithPath: path))<br> }<br> linkMetadata.originalURL = url<br> linkMetadata.title = title<br> return linkMetadata<br> }<br>}</pre><p>In this SwiftUI view, observe the `LinkMetadataManager` state and respond to button presses to fetch metadata and share it:</p><pre>import SwiftUI<br>import LinkPresentation<br>struct ContentView: View {<br> @StateObject private var metadataManager = LinkMetadataManager()<br> @State private var isFetchMetadataDynamic = true<br> <br> var body: some View {<br> VStack {<br> Button(action: {<br> let url = URL(string: &quot;https://www.apple.com/airpods-pro/&quot;)!<br> <br> if isFetchMetadataDynamic {<br> metadataManager.fetchURLPreview(url: url)<br> } else {<br> // Use the manually provided metadata<br> let manualMetadata = metadataManager.getMetadataForSharingManually(<br> title: &quot;[Custom Title] Airpods Pro&quot;,<br> url: url,<br> fileName: &quot;airpods_pro_custom&quot;,<br> fileType: &quot;jpg&quot;<br> )<br> metadataManager.linkMetadata = manualMetadata<br> shareURLWithMetadata()<br> }<br> }) {<br> Text(&quot;Share URL&quot;)<br> }<br> <br> if let linkMetadata = metadataManager.linkMetadata {<br> Text(&quot;Title: \(linkMetadata.title ?? &quot;N/A&quot;)&quot;)<br> Text(&quot;URL: \(linkMetadata.url?.absoluteString ?? &quot;N/A&quot;)&quot;)<br> <br> if let icon = linkMetadata.icon {<br> Image(uiImage: icon)<br> .resizable()<br> .frame(width: 50, height: 50)<br> }<br> }<br> <br> // Handle error<br> if let error = metadataManager.error {<br> Text(&quot;Error: \(error.localizedDescription)&quot;)<br> .foregroundColor(.red)<br> }<br> }<br> }<br> <br> func shareURLWithMetadata() {<br> guard let linkMetadata = metadataManager.linkMetadata else { return }<br> let metadataItemSource = LinkPresentationItemSource(metaData: linkMetadata)<br> <br> // Present the activity view controller<br> let activityViewController = UIActivityViewController(activityItems: [metadataItemSource], applicationActivities: nil)<br> <br> // Find the topmost view controller<br> guard let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene,<br> let window = windowScene.windows.first,<br> let rootViewController = window.rootViewController else {<br> return<br> }<br> <br> rootViewController.present(activityViewController, animated: true)<br> }<br>}<br>class LinkPresentationItemSource: NSObject, UIActivityItemSource {<br> var linkMetaData: LPLinkMetadata<br> <br> init(metaData: LPLinkMetadata) {<br> self.linkMetaData = metaData<br> }<br> <br> // Prepare data to share<br> func activityViewControllerLinkMetadata(_ activityViewController: UIActivityViewController) -&gt; LPLinkMetadata? {<br> return linkMetaData<br> }<br> <br> // Placeholder item<br> func activityViewControllerPlaceholderItem(_ activityViewController: UIActivityViewController) -&gt; Any {<br> return &quot;Placeholder&quot;<br> }<br> <br> // Return the data that will be shared<br> func activityViewController(_ activityViewController: UIActivityViewController, itemForActivityType activityType: UIActivity.ActivityType?) -&gt; Any? {<br> return linkMetaData.originalURL<br> }<br>}</pre><p>In this setup, the SwiftUI view (`ContentView`) interacts with the `LinkMetadataManager` class (`<a href="http://twitter.com/StateObject">@StateObject</a>`) to fetch and display link metadata and initiate sharing actions when the button is pressed.</p><p>To share the link metadata, the function `shareURLWithMetadata()` creates an instance of `UIActivityViewController` and presents it using the topmost view controller. The `LinkPresentationItemSource` class is kept the same since it manages the metadata being shared.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=15b8c029b80d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CoreData using advance level swiftUI]]></title>
            <link>https://medium.com/@midhlag55/coredata-using-advance-level-swiftui-a792f7a06e1c?source=rss-e09f5db58866------2</link>
            <guid isPermaLink="false">https://medium.com/p/a792f7a06e1c</guid>
            <category><![CDATA[core-data-swift]]></category>
            <dc:creator><![CDATA[Midlaj]]></dc:creator>
            <pubDate>Wed, 27 Mar 2024 14:03:48 GMT</pubDate>
            <atom:updated>2024-03-27T14:04:37.796Z</atom:updated>
            <content:encoded><![CDATA[<h3>CoreData using advance level in swiftUI</h3><p>Integrating Core Data into SwiftUI applications involves several key steps to efficiently manage and persist data. Initially, developers establish a Core Data stack, comprising essential components such as the persistent container, managed object model, and context. Subsequently, they define the data model using Xcode’s Core Data modeling tool, structuring entities, attributes, and relationships. Accessing the managed object context in SwiftUI views or view models allows for seamless data management. Utilizing the @FetchRequest property wrapper enables fetching data dynamically, while SwiftUI&#39;s view constructs facilitate the display of fetched results. Creation and saving of data occur through interactions with the managed object context, with error handling mechanisms ensuring robustness. To enhance performance, developers optimize fetch requests and manage memory usage effectively. Finally, thorough testing and debugging validate Core Data operations, ensuring data integrity and application stability. By following these steps, developers can seamlessly integrate Core Data into SwiftUI applications, enabling efficient data management and persistence.</p><h3><strong>Maximizing Performance in Core Data Applications with SwiftUI</strong></h3><p>Core Data is a powerful framework that allows SwiftUI applications to manage complex data efficiently. However, to ensure optimal performance, it’s essential to understand how to leverage Core Data effectively within the SwiftUI architecture. Let’s delve deeper into various aspects:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f_9us6PY11PSGNMIKt0O8g.jpeg" /></figure><h3>Overhead versus Functionality</h3><p>While Core Data adds some overhead to SwiftUI applications, the benefits it provides — such as undo/redo support, validation, and object graph management — far outweigh this initial cost. These features streamline development and reduce the need for manual implementation, especially as application complexity grows.</p><h3>NSManagedObject Storage Mechanism</h3><p>NSManagedObject, the backbone of Core Data, offers an optimized storage mechanism compatible with SwiftUI’s data binding capabilities. By adhering to key-value coding and observing standards, NSManagedObject ensures efficient data storage and retrieval, enhancing overall application performance.</p><h3>Fetching Managed Objects</h3><p>Minimizing round trips to the persistent store is crucial for performance optimization in SwiftUI. Combining multiple fetch requests into a single query and managing memory effectively helps reduce overhead, ensuring swift data retrieval and manipulation.</p><h3>Fetch Predicates and Limits</h3><p>Crafting fetch predicates strategically and setting fetch limits are vital for enhancing application performance. Prioritizing restrictive predicates and limiting fetched objects minimize data retrieval time, especially when dealing with large datasets.</p><blockquote>import CoreData</blockquote><blockquote>// Assuming you have a managedObjectContext available</blockquote><blockquote>// Create a fetch request<br>let request: NSFetchRequest&lt;YourManagedObject&gt; = YourManagedObject.fetchRequest()</blockquote><blockquote>// Set fetch limit<br>request.fetchLimit = 100</blockquote><h3>Preventing Faults from Firing</h3><p>Avoiding unnecessary fault firing overheads is essential for optimal performance. By leveraging fault-safe methods and understanding faulting behaviors, developers can minimize performance bottlenecks associated with object resolution.</p><h3>Batch Faulting and Prefetching</h3><p>Batch faulting and prefetching techniques optimize performance by proactively managing object retrieval and relationship prefetching. These strategies reduce overhead, particularly in scenarios involving complex data access patterns common in SwiftUI applications.</p><h3>Reducing Memory Overhead</h3><p>Strategies like refaulting managed objects, selective property value loading, and context resets help mitigate memory consumption within SwiftUI Core Data applications. Employing autorelease pools and understanding object ownership further optimize memory management.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ouKv9SgnuXjW51DI.png" /></figure><blockquote>import CoreData</blockquote><blockquote>// Assuming you have a managedObjectContext available<br>let employeesFetch: NSFetchRequest&lt;Employee&gt; = Employee.fetchRequest()<br>do {<br> let fetchedEmployees = try moc.fetch(employeesFetch)<br> for employee in fetchedEmployees {<br> print(“\(employee.name ?? “”) -&gt; \(employee.department?.name ?? “Unknown”) department”)<br> }<br>} catch {<br> print(“Error fetching: \(error.localizedDescription)”)<br> fatalError(“Failed to fetch employees: \(error)”)<br>}</blockquote><h3>BLOB Management</h3><p>Efficient handling of Binary Large Objects (BLOBs) is crucial for maintaining performance in SwiftUI Core Data applications. Utilizing SQLite for BLOB storage and employing entity relationships for BLOB attributes optimize memory usage and scalability.</p><blockquote>NSArray *array = @[fault1, fault2, ...];</blockquote><blockquote>NSPredicate *predicate = [NSPredicate predicateWithFormat:@&quot;self IN %@&quot;, array];</blockquote><blockquote>SWIFT</blockquote><blockquote>let array = [fault1, fault2, ...]</blockquote><blockquote>let predicate = NSPredicate(format:&quot;self IN %@&quot;, array)</blockquote><h3>Performance Analysis Tools</h3><p>Instruments and SQLite debugging tools provide valuable insights into Core Data performance metrics in SwiftUI applications. Utilizing these tools enables developers to identify and address performance bottlenecks effectively, ensuring optimal application responsiveness.</p><blockquote>NSManagedObjectContext *moc = …;</blockquote><blockquote>NSFetchRequest *request = [NSFetchRequest fetchRequestWithEntityName:@&quot;Employee&quot;];</blockquote><blockquote>[request setRelationshipKeyPathsForPrefetching:@[@&quot;department&quot;]];</blockquote><blockquote>SWIFT</blockquote><blockquote>let moc = …</blockquote><blockquote>let request = NSFetchRequest&lt;EmployeeMO&gt;(entityName:&quot;Employee&quot;)</blockquote><blockquote>fetchRequest.relationshipKeyPathsForPrefetching = [&quot;department&quot;]</blockquote><h3>Conclusion</h3><p>By adopting best practices, leveraging Core Data’s features effectively, and utilizing performance analysis tools, developers can maximize the efficiency of SwiftUI Core Data applications. With a focus on minimizing overhead, optimizing data retrieval, and managing memory effectively, Core Data remains a powerful asset for building high-performance SwiftUI applications.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a792f7a06e1c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[SwiftUI Animations: The Basics of Animations and Transitions]]></title>
            <link>https://medium.com/@midhlag55/swiftui-animations-the-basics-of-animations-and-transitions-5dfae5ce4268?source=rss-e09f5db58866------2</link>
            <guid isPermaLink="false">https://medium.com/p/5dfae5ce4268</guid>
            <dc:creator><![CDATA[Midlaj]]></dc:creator>
            <pubDate>Tue, 19 Dec 2023 07:46:25 GMT</pubDate>
            <atom:updated>2023-12-19T07:48:41.087Z</atom:updated>
            <content:encoded><![CDATA[<p>In SwiftUI, animations are enriched by the flexibility of timing curves and springs. Timing curves, such as Linear, easeIn, easeOut, and easeInOut, offer predefined patterns for animation progression. These curves enable developers to control the speed and acceleration of animations. Additionally, custom durations can be applied to tailor the timing of any animation. On the other hand, Springs simulate the behaviour of a physical spring, providing a more dynamic and natural feel to animations. The damping ratio and initial velocity parameters define the characteristics of a spring animation. A higher damping ratio results in quicker damping, while the initial velocity determines the animation’s starting speed. Combining these features allows SwiftUI developers to craft engaging and lifelike user interfaces through precise control of animation dynamics and duration.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*z-CfRz8K3YJMRVcu50dshw.jpeg" /></figure><p>Certainly! SwiftUI is a user interface (UI) framework developed by Apple for building applications across their various platforms, such as iOS, macOS, watchOS, and tvOS. SwiftUI uses a declarative syntax, allowing developers to describe the UI and its behaviour in a concise and easy-to-read manner.</p><p>When it comes to animations in SwiftUI, the framework provides a set of tools and capabilities that make it straightforward to create smooth and visually appealing transitions and movements within your user interface. Here are some key aspects of SwiftUI animations:</p><h3>1. Declarative Animation Syntax:</h3><p>In SwiftUI, animations are declared alongside the view hierarchy. You can use the withAnimation block to wrap the changes you want to animate. This block automatically animates the changes within its scope.</p><pre>withAnimation {<br>    // Code to modify the UI state<br>}</pre><h3>2. Animated Properties:</h3><p>Many SwiftUI views have animatable properties. When these properties change, SwiftUI automatically animates the transition. For example, changing the position, opacity, or size of a view will trigger a smooth animation.</p><pre>Text(&quot;Hello, World!&quot;)<br>    .offset(x: isAnimating ? 200 : 0)<br>    .animation(.easeInOut)</pre><h3>3. Animation Types:</h3><p>SwiftUI supports various animation types out of the box, such as linear, ease-in, ease-out, and ease-in-out. You can choose the animation type based on the desired visual effect.</p><pre>.animation(.easeInOut)</pre><h3>4. Custom Animations:</h3><p>SwiftUI allows you to create custom animations by implementing the Animatable protocol or using the UIViewRepresentable protocol to integrate UIKit-based animations.</p><pre>.animation(<br>    Animation.linear(duration: 2)<br>        .repeatForever(autoreverses: false)<br>)</pre><h3>5. Transitions:</h3><p>Transitions in SwiftUI control how views enter or exit the view hierarchy. You can apply transitions to individual views or to entire view hierarchies.</p><pre>.transition(.slide)</pre><h3>6. Gesture-based Animation:</h3><p>SwiftUI integrates seamlessly with gestures, enabling interactive animations. You can respond to gestures like taps, drags, or rotations and update your UI accordingly.</p><pre>.gesture(<br>    DragGesture()<br>        .onChanged { value in<br>            // Update UI based on drag position<br>        }<br>        .onEnded { value in<br>            // Perform actions when the drag ends<br>        }<br>)</pre><h3>7. State and Animation:</h3><p>SwiftUI leverages its state management system to trigger animations. When the state of a view changes, SwiftUI automatically computes the differences and animates the transitions.</p><pre>@State private var isAnimating = false<br>// ...<br>withAnimation {<br>    isAnimating.toggle()<br>}</pre><h3>8. Animating View Transitions:</h3><p>SwiftUI provides the onChange modifier to observe changes in the state and trigger animations. This is useful for animating transitions between different views.</p><pre>.onChange(of: someState) { newValue in<br>    withAnimation {<br>        // Code to animate view transition<br>    }<br>}</pre><p>By combining these features, SwiftUI makes it easy for developers to create sophisticated and responsive animations in their applications with relatively minimal code. The framework’s declarative nature and built-in animation support contribute to a more intuitive and streamlined development experience.</p><h3>Declarative Animation Syntax in SwiftUI:</h3><ol><li>withAnimation Block: The withAnimation block is a fundamental part of SwiftUI&#39;s declarative animation syntax. It allows you to wrap the code that modifies the UI state in a way that triggers an animation for the specified duration.</li></ol><pre>struct ContentView: View {<br>    @State private var isAnimating = false</pre><pre>    var body: some View {<br>        Button(&quot;Animate&quot;) {<br>            withAnimation {<br>                // Code to modify the UI state<br>                isAnimating.toggle()<br>            }<br>        }<br>    }<br>}</pre><p>In this example, when the “Animate” button is tapped, the isAnimating state is toggled within the withAnimation block. The changes to the UI state inside this block are automatically animated.</p><p>2. Animation Modifier: You can attach the animation modifier to specific views or view modifiers to customize the animation effect. This modifier allows you to specify the type and duration of the animation.</p><pre>Text(&quot;Hello, World!&quot;)<br>    .offset(x: isAnimating ? 200 : 0)<br>    .animation(.easeInOut) // Apply animation modifier</pre><p>Here, the .easeInOut animation modifier is applied to create a smooth in-and-out animation effect when the text view&#39;s offset changes.</p><p>3. Animation Parameters: The withAnimation block and the animation modifier can take additional parameters to customize the animation behavior, such as duration, delay, and repeat count.</p><pre>withAnimation(.easeInOut(duration: 1.5)) {<br>    // Code to modify the UI state<br>}</pre><p>In this example, the animation within the withAnimation block has a duration of 1.5 seconds and uses an ease-in-out timing function.</p><p>4. Nested Animations: SwiftUI supports nesting animations within each other. If you have multiple animated changes, you can wrap them in nested withAnimation blocks to control their animations independently.</p><pre>withAnimation {<br>    // Outer animation<br>    withAnimation(.easeInOut) {<br>        // Inner animation<br>        // Code to modify the UI state<br>    }<br>}</pre><p>Here, the inner animation has a different timing function than the outer animation.</p><p>5. Animating State Changes: State changes automatically trigger animations in SwiftUI. When a property marked with @State changes, SwiftUI compares the new and old values and animates the transition.</p><pre>@State private var isAnimating = false</pre><pre>var body: some View {<br>    Text(&quot;Hello, World!&quot;)<br>        .offset(x: isAnimating ? 200 : 0)<br>        .onTapGesture {<br>            withAnimation {<br>                isAnimating.toggle() // Animates the state change<br>            }<br>        }<br>}</pre><p>The onTapGesture triggers a state change, and SwiftUI automatically animates the offset change.</p><h3>Animated Properties:</h3><ol><li>Position (Offset):The offset modifier is often used to animate the position of a view. The CGPoint values in the offset determine the horizontal and vertical displacement.</li></ol><pre>Text(&quot;Hello, World!&quot;)<br>    .offset(x: isAnimating ? 200 : 0, y: 0)</pre><p>Here, the text moves horizontally by 200 points when isAnimating is true.</p><p>2. Opacity: The opacity property controls the transparency of a view. Animating opacity creates smooth fade-in or fade-out effects.</p><pre>Image(&quot;logo&quot;)<br>    .opacity(isFaded ? 0.5 : 1.0)</pre><p>When isFaded is true, the image smoothly fades to 50% opacity.</p><p>3. Scale: The scaleEffect property adjusts the size of a view. Animating scale produces zoom-in or zoom-out effects.</p><pre>Circle()<br>    .scaleEffect(isZoomed ? 1.5 : 1.0)</pre><p>When isZoomed is true, the circle scales to 1.5 times its size.</p><p>4. Rotation: The rotationEffect property controls the rotation angle of a view. Animating rotation produces spinning or turning effects.</p><pre>Rectangle()<br>    .rotationEffect(Angle(degrees: isRotated ? 180 : 0))</pre><p>When isRotated is true, the rectangle smoothly rotates 180 degrees.</p><p>5. Frame Size: The frame modifier can animate changes in the size of a view. Combining it with the animation modifier creates smooth transitions.</p><pre>RoundedRectangle(cornerRadius: 10)<br>    .frame(width: isExpanded ? 200 : 100, height: 100)</pre><p>When isExpanded is true, the rounded rectangle smoothly expands to a width of 200 points.</p><p>6. Color: Animating color changes is straightforward. The foregroundColor or background modifiers can be used to change a view&#39;s color dynamically.</p><pre>Text(&quot;SwiftUI&quot;)<br>    .foregroundColor(isHighlighted ? .red : .blue)</pre><p>When isHighlighted is true, the text color smoothly transitions to red.</p><p>7. Border: The border modifier can be animated to create dynamic border effects. Adjusting the border width or color within an animation block results in smooth transitions.</p><pre>RoundedRectangle(cornerRadius: 10)<br>    .border(Color.black, width: isHighlighted ? 3 : 1)</pre><p>When isHighlighted is true, the border width smoothly increases to 3 points.</p><p>8. Shadow: The shadow modifier can animate changes in shadow properties, such as radius or offset. This can be used for subtle or dynamic shadow effects.</p><pre>Circle()<br>    .shadow(radius: isFocused ? 10 : 2)</pre><p>When isFocused is true, the circle&#39;s shadow radius smoothly increases to 10.</p><p>9. Gradient: Animating gradients involves adjusting the color stops or the overall gradient itself. This can be achieved by updating the LinearGradient or RadialGradient parameters.</p><pre>Rectangle()<br>    .fill(LinearGradient(gradient: isGradientReversed ? reversedGradient : originalGradient, startPoint: .leading, endPoint: .trailing))</pre><p>When isGradientReversed is true, the gradient smoothly transitions to a reversed version.</p><h3>Animation Types:</h3><h4>1. Linear Animation:</h4><ul><li>Usage:</li></ul><pre>.animation(.linear)</pre><ul><li>Description: Linear animation maintains a constant speed throughout its duration. It produces a consistent and steady transition from the start to the end of the animation.</li></ul><h4>2. Ease-In Animation:</h4><ul><li>Usage:</li></ul><pre>.animation(.easeIn)</pre><ul><li>Description: Ease-in animation starts slowly and accelerates as it progresses. The initial part of the animation is gentle, making it appear as if the view is gradually easing into the new state.</li></ul><h4>3. Ease-Out Animation:</h4><ul><li>Usage:</li></ul><pre>.animation(.easeOut)</pre><ul><li>Description: Ease-out animation begins quickly and decelerates towards the end. The initial part of the animation is swift, giving the impression that the view is slowing down as it reaches its final state.</li></ul><h4>4. Ease-In-Out Animation:</h4><ul><li>Usage:</li></ul><pre>.animation(.easeInOut)</pre><ul><li>Description: Ease-in-out animation combines characteristics of ease-in and ease-out. It starts slowly, accelerates through the middle, and then decelerates towards the end, resulting in a smooth and natural-looking transition.</li></ul><h4>5. Spring Animation:</h4><ul><li>Usage:</li></ul><pre>.animation(.spring())</pre><ul><li>Description: Spring animation simulates the motion of a spring, creating a bounce or elastic effect. It is particularly useful for giving a more playful and dynamic feel to your animations.</li></ul><pre>.animation(<br>    Animation.spring(response: 0.5, dampingFraction: 0.8, blendDuration: 0)<br>)</pre><p>The response, dampingFraction, and blendDuration parameters allow you to fine-tune the characteristics of the spring animation.</p><h4>6. Interpolating Animation:</h4><ul><li>Usage:</li></ul><pre>.animation(.interpolatingSpring(mass: 1.0, stiffness: 100.0, damping: 10.0, initialVelocity: 0.0))</pre><ul><li>Description: Similar to spring animation, interpolating spring animation allows you to customize the mass, stiffness, damping, and initial velocity of the spring, providing more control over the animation behaviour.</li></ul><h4>7. Custom Timing Curve Animation:</h4><ul><li>Usage:</li></ul><pre>.animation(Animation.timingCurve(0.2, 0.8, 0.0, 1.0, duration: 1.0) )</pre><ul><li>Description: Custom timing curve animation enables you to define your own Bézier curve for precise control over the acceleration and deceleration of the animation.</li></ul><h3>Custom Animations:</h3><h4>1. Custom Animations with Animatable Conformance:</h4><p>Conforming to the Animatable protocol allows you to create custom animations by animating a single property of your view. This property must be of a type that conforms to the VectorArithmetic protocol.</p><pre>struct CustomAnimatingView: View {<br>    @State private var animationProgress: CGFloat = 0.0<br>var body: some View {<br>        Rectangle()<br>            .fill(Color.blue)<br>            .frame(width: 100, height: 100)<br>            .onTapGesture {<br>                withAnimation {<br>                    self.animationProgress = 1.0 - self.animationProgress<br>                }<br>            }<br>            .modifier(CustomAnimationModifier(progress: animationProgress))<br>    }<br>}</pre><pre>struct CustomAnimationModifier: ViewModifier {<br>    var progress: CGFloat</pre><pre>    func body(content: Content) -&gt; some View {<br>        content<br>            .rotationEffect(Angle(degrees: 360 * progress))<br>    }<br>}</pre><p>In this example, tapping on the rectangle triggers a custom animation that rotates the rectangle based on the animationProgress property.</p><h4>2. Custom Animations with UIViewRepresentable:</h4><p>If you need to integrate UIKit-based animations or leverage more complex animations available in the UIKit framework, you can use the UIViewRepresentable protocol to wrap a UIKit view or animation.</p><pre>import SwiftUIstruct CustomUIKitAnimationView: UIViewRepresentable {<br>    func makeUIView(context: Context) -&gt; UIView {<br>        let uiView = UIView()<br>        // Set up UIKit-based animation here<br>        return uiView<br>    }</pre><pre>    func updateUIView(_ uiView: UIView, context: Context) {<br>        // Update UIKit-based animation as needed<br>    }<br>}</pre><p>You can then use this UIViewRepresentable view as part of your SwiftUI hierarchy and integrate any UIKit-based animation you need.</p><h4>3. Animating Multiple Properties with AnimatablePair:</h4><p>To animate multiple properties simultaneously, you can use AnimatablePair or AnimatableTuple to combine different animatable values.</p><pre>struct MultiPropertyAnimatingView: View {<br>    @State private var size: CGFloat = 100<br>    @State private var rotation: Double = 0<br>var body: some View {<br>        Rectangle()<br>            .fill(Color.green)<br>            .frame(width: size, height: size)<br>            .rotationEffect(Angle(degrees: rotation))<br>            .onTapGesture {<br>                withAnimation {<br>                    self.size = CGFloat.random(in: 50...200)<br>                    self.rotation += 45<br>                }<br>            }<br>    }<br>}</pre><p>In this example, the rectangle’s size and rotation are animated simultaneously.</p><h4>4. Animating Paths:</h4><p>Custom animations can also be applied to Path objects, allowing you to create complex shape animations.</p><pre>struct PathAnimatingView: View {<br>    @State private var showPath: Bool = false<br>var body: some View {<br>        Path { path in<br>            // Define your path<br>        }<br>        .stroke(showPath ? Color.blue : Color.clear, lineWidth: 2)<br>        .animation(.easeInOut)<br>        .onTapGesture {<br>            withAnimation {<br>                self.showPath.toggle()<br>            }<br>        }<br>    }<br>}</pre><p>Here, tapping the view toggles the visibility of the path with a smooth animation.</p><h3>Transitions:</h3><h4>1. Default Transition:</h4><p>The default transition is applied when a view is added or removed from the hierarchy. SwiftUI automatically applies a cross-fade animation by default.</p><pre>struct ContentView: View {<br>    @State private var showDetails = false</pre><pre>    var body: some View {<br>        VStack {<br>            if showDetails {<br>                Text(&quot;Details View&quot;)<br>                    .transition(.opacity)<br>            } else {<br>                Text(&quot;Main View&quot;)<br>            }</pre><pre>            Button(&quot;Toggle Details&quot;) {<br>                withAnimation {<br>                    self.showDetails.toggle()<br>                }<br>            }<br>        }<br>    }<br>}</pre><p>In this example, the .opacity transition is applied to smoothly fade in and out the &quot;Details View&quot; when the showDetails state changes.</p><h4>2. Slide Transition:</h4><p>The slide transition animates views in and out with a sliding motion. You can specify the direction of the slide (from leading, trailing, top, or bottom).</p><pre>Text(&quot;Slide Transition&quot;)<br>    .transition(.slide)</pre><p>By default, the slide transition slides in from the trailing edge, but you can customize it further.</p><h4>3. Scale Transition:</h4><p>The scale transition scales views in and out. You can control the scale factor and anchor point.</p><pre>Image(&quot;logo&quot;)<br>    .transition(.scale)</pre><p>The scale transition smoothly scales the image in and out.</p><h4>4. Custom Transition:</h4><p>SwiftUI allows you to create custom transitions by implementing the ViewModifier protocol. This gives you complete control over the animation.</p><pre>struct CustomTransition: ViewModifier {<br>    func body(content: Content) -&gt; some View {<br>        // Implement custom animation logic here<br>        content<br>    }<br>}</pre><pre>// Usage:<br>Text(&quot;Custom Transition&quot;)<br>    .modifier(CustomTransition())<br>    .transition(.identity) // Apply the custom transition</pre><p>In the example above, you can define your own animation logic within the CustomTransition modifier.</p><h4>5. Combined Transitions:</h4><p>You can combine multiple transitions to achieve complex effects. For example, you can combine slide and opacity transitions.</p><pre>Text(&quot;Combined Transitions&quot;)<br>    .transition(.asymmetric(insertion: .slide, removal: .opacity))</pre><p>This combines a slide-in animation for insertion and a fade-out animation for removal.</p><h4>6. AnyTransition:</h4><p>The AnyTransition type allows you to compose transitions dynamically. You can create custom transition sequences based on conditions.</p><pre>Text(&quot;AnyTransition Example&quot;)<br>    .transition(AnyTransition.opacity.animation(.easeInOut))</pre><p>Here, the view smoothly fades in and out with an ease-in-out animation.</p><h4>7. Transition Animation Control:</h4><p>You can control the animation duration and timing function using the animation modifier along with transitions.</p><pre>Text(&quot;Custom Duration and Timing&quot;)<br>    .transition(.slide)<br>    .animation(<br>        Animation.easeInOut(duration: 0.5)<br>    )</pre><p>This example customizes the slide transition’s animation with a specified duration and timing function.</p><h3>Gesture-based Animation:</h3><h4>1. Tap Gesture:</h4><p>The tapGesture is triggered when the user taps on a view. You can use it to toggle a boolean state and animate the associated changes.</p><pre>@State private var isAnimating = false</pre><pre>var body: some View {<br>    Circle()<br>        .fill(isAnimating ? Color.red : Color.blue)<br>        .frame(width: 100, height: 100)<br>        .onTapGesture {<br>            withAnimation {<br>                self.isAnimating.toggle()<br>            }<br>        }<br>}</pre><p>In this example, tapping on the circle toggles its color with a smooth animation.</p><h4>2. Drag Gesture:</h4><p>The dragGesture recognizes dragging motions. You can use it to update the position of a view based on the drag gesture, creating a dynamic and interactive UI.</p><pre>@State private var offset = CGSize.zero</pre><pre>var body: some View {<br>    Circle()<br>        .fill(Color.blue)<br>        .frame(width: 100, height: 100)<br>        .offset(offset)<br>        .gesture(<br>            DragGesture()<br>                .onChanged { value in<br>                    self.offset = value.translation<br>                }<br>                .onEnded { _ in<br>                    withAnimation {<br>                        self.offset = .zero<br>                    }<br>                }<br>        )<br>}</pre><p>This example allows the user to drag the circle, and when the dragging ends, the circle smoothly returns to its original position.</p><h4>3. Rotation Gesture:</h4><p>The rotationGesture recognizes rotational gestures. You can use it to update the rotation angle of a view.</p><pre>@State private var rotationAngle: Angle = .degrees(0)</pre><pre>var body: some View {<br>    Rectangle()<br>        .fill(Color.green)<br>        .frame(width: 100, height: 100)<br>        .rotationEffect(rotationAngle)<br>        .gesture(<br>            RotationGesture()<br>                .onChanged { angle in<br>                    self.rotationAngle = angle<br>                }<br>                .onEnded { _ in<br>                    // Perform actions when rotation ends<br>                }<br>        )<br>}</pre><p>In this example, the rectangle rotates based on the user’s rotational gestures.</p><h4>4. Long Press Gesture:</h4><p>The longPressGesture recognizes long-press gestures. You can use it to trigger animations or actions after a long press.</p><pre>@State private var isPressed = false</pre><pre>var body: some View {<br>    Circle()<br>        .fill(isPressed ? Color.red : Color.blue)<br>        .frame(width: 100, height: 100)<br>        .gesture(<br>            LongPressGesture()<br>                .onChanged { isPressed in<br>                    withAnimation {<br>                        self.isPressed = isPressed<br>                    }<br>                }<br>        )<br>}</pre><p>Here, the circle changes its color when the user performs a long press.</p><h4>5. Pinch Gesture:</h4><p>The MagnificationGesture (pinch gesture) recognizes pinch or spread gestures. You can use it to scale a view based on the user&#39;s pinch gestures.</p><pre>@State private var scale: CGFloat = 1.0</pre><pre>var body: some View {<br>    Image(&quot;photo&quot;)<br>        .resizable()<br>        .scaledToFit()<br>        .scaleEffect(scale)<br>        .gesture(<br>            MagnificationGesture()<br>                .onChanged { scale in<br>                    self.scale = scale<br>                }<br>        )<br>}</pre><p>This example allows the user to pinch or spread to zoom in and out of an image.</p><h3>State and Animation:</h3><h4>1. @State Property:</h4><p>The @State property wrapper is used to declare properties in SwiftUI views that are mutable and trigger the view&#39;s body to re-evaluate when their values change. This is crucial for animating changes to the UI.</p><pre>struct ContentView: View {<br>    @State private var isAnimating = false</pre><pre>    var body: some View {<br>        Circle()<br>            .fill(isAnimating ? Color.red : Color.blue)<br>            .frame(width: 100, height: 100)<br>            .onTapGesture {<br>                withAnimation {<br>                    self.isAnimating.toggle()<br>                }<br>            }<br>    }<br>}</pre><p>In this example, the isAnimating state triggers a change in the color of the circle when tapped, and the change is animated.</p><h4>2. Animating State Changes:</h4><p>When the value of a state property changes, SwiftUI automatically animates the transition between the old and new values. The withAnimation block is used to specify the animation for a particular state change.</p><pre>struct ContentView: View {<br>    @State private var isExpanded = false</pre><pre>    var body: some View {<br>        RoundedRectangle(cornerRadius: 10)<br>            .frame(width: isExpanded ? 200 : 100, height: 100)<br>            .onTapGesture {<br>                withAnimation {<br>                    self.isExpanded.toggle()<br>                }<br>            }<br>    }<br>}</pre><p>In this example, tapping on the rectangle triggers a smooth animation that expands or contracts its width based on the isExpanded state.</p><h4>3. Animation Modifier:</h4><p>The animation modifier allows you to customize the animation type and duration for a specific view or view hierarchy.</p><pre>Text(&quot;Hello, SwiftUI!&quot;)<br>    .padding()<br>    .animation(.easeInOut(duration: 1.0))</pre><p>Here, the text view is animated with an ease-in-out animation over a duration of 1 second.</p><h4>4. Animation and Gesture Interaction:</h4><p>Combining animations with gestures allows you to create interactive and visually engaging UIs. Gestures can modify state properties, and animations provide a smooth transition.</p><pre>struct ContentView: View {<br>    @State private var scale: CGFloat = 1.0</pre><pre>    var body: some View {<br>        Image(&quot;logo&quot;)<br>            .resizable()<br>            .scaledToFit()<br>            .scaleEffect(scale)<br>            .gesture(<br>                MagnificationGesture()<br>                    .onChanged { scale in<br>                        withAnimation {<br>                            self.scale = scale<br>                        }<br>                    }<br>            )<br>    }<br>}</pre><p>Here, the pinch gesture scales an image with a smooth animation.</p><h4>5. Conditional Animation:</h4><p>You can conditionally apply animations based on certain conditions. Use the if statement within the withAnimation block to selectively animate changes.</p><pre>struct ContentView: View {<br>    @State private var isAnimating = false</pre><pre>    var body: some View {<br>        Circle()<br>            .fill(isAnimating ? Color.red : Color.blue)<br>            .frame(width: 100, height: 100)<br>            .onTapGesture {<br>                withAnimation {<br>                    if self.isAnimating {<br>                        // Additional animations or changes<br>                    }<br>                    self.isAnimating.toggle()<br>                }<br>            }<br>    }<br>}</pre><p>Here, the additional animations or changes inside the if statement will be animated only if isAnimating is true.</p><h3>Animating View Transitions:</h3><h4>1. transition Modifier:</h4><p>The transition modifier is applied to a specific view or view hierarchy, specifying the animation that should occur when the view enters or exits the screen. You can use predefined transition types or create custom transitions.</p><pre>struct ContentView: View {<br>    @State private var showDetails = false</pre><pre>    var body: some View {<br>        VStack {<br>            if showDetails {<br>                Text(&quot;Details View&quot;)<br>                    .transition(.opacity) // or any other transition type<br>            } else {<br>                Text(&quot;Main View&quot;)<br>            }</pre><pre>            Button(&quot;Toggle Details&quot;) {<br>                withAnimation {<br>                    self.showDetails.toggle()<br>                }<br>            }<br>        }<br>    }<br>}</pre><p>In this example, the .opacity transition is applied to smoothly fade in and out the &quot;Details View&quot; when the showDetails state changes.</p><h4>2. Built-in Transition Types:</h4><p>SwiftUI provides several built-in transition types that you can use with the transition modifier. Some common ones include:</p><ul><li>.opacity: Fades in or out.</li><li>.scale: Scales in or out.</li><li>.slide: Slides in or out from different directions.</li><li>.move(edge:): Moves in or out from a specified edge.</li></ul><pre>Text(&quot;Hello, World!&quot;)<br>    .transition(.scale)</pre><p>This example uses the .scale transition to animate the appearance or disappearance of the text.</p><h4>3. Custom Transitions:</h4><p>You can create custom transitions by conforming to the ViewModifier protocol. This allows you to define your own animation logic for entering and exiting views.</p><pre>struct CustomTransition: ViewModifier {<br>    func body(content: Content) -&gt; some View {<br>        // Implement custom animation logic here<br>        content<br>    }<br>}</pre><pre>// Usage:<br>Text(&quot;Custom Transition&quot;)<br>    .modifier(CustomTransition())<br>    .transition(.identity) // Apply the custom transition</pre><p>In the example above, the CustomTransition modifier encapsulates custom animation logic that can be applied to views.</p><h4>4. Combined Transitions:</h4><p>You can combine multiple transitions to achieve more complex effects. For example, you can combine slide and opacity transitions for different insertion and removal animations.</p><pre>Text(&quot;Combined Transitions&quot;)<br>    .transition(.asymmetric(insertion: .slide, removal: .opacity))</pre><p>This combines a slide-in animation for insertion and a fade-out animation for removal.</p><h4>5. AnyTransition:</h4><p>The AnyTransition type allows you to compose transitions dynamically. You can create custom transition sequences based on conditions.</p><pre>Text(&quot;AnyTransition Example&quot;)<br>    .transition(AnyTransition.opacity.animation(.easeInOut))</pre><p>Here, the view smoothly fades in and out with an ease-in-out animation using AnyTransition.</p><h4>6. Conditional Transitions:</h4><p>You can conditionally apply transitions based on certain conditions. This can be useful for selectively animating views based on dynamic criteria.</p><pre>struct ContentView: View {<br>    @State private var showDetails = false</pre><pre>    var body: some View {<br>        Text(&quot;Main View&quot;)<br>            .transition(showDetails ? .slide : .identity)<br>            .onTapGesture {<br>                withAnimation {<br>                    self.showDetails.toggle()<br>                }<br>            }<br>    }<br>}</pre><p>In this example, the .slide transition is applied only when showDetails is true.</p><h3>Conclusion</h3><p>SwiftUI animation is a key feature of Apple’s declarative UI framework, designed to facilitate the creation of seamless and visually attractive animations across various Apple platforms. By providing a range of built-in animations and user-friendly APIs, SwiftUI empowers developers to incorporate dynamic and engaging elements into their applications effortlessly.</p><p>The framework’s declarative syntax allows developers to express animation logic concisely, focusing on the desired outcomes rather than the intricate details of the animation process. SwiftUI simplifies the animation workflow, making it accessible for both beginners and experienced developers.</p><p>Whether building applications for iOS, macOS, watchOS, or tvOS, SwiftUI’s animation capabilities contribute to the development of modern, responsive, and visually appealing user interfaces. As SwiftUI evolves, it continues to be a powerful tool for creating delightful user experiences through its seamless integration of state, animation, and declarative programming principles.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5dfae5ce4268" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What's new in iOS 17 ?]]></title>
            <link>https://medium.com/@midhlag55/whats-new-in-ios-17-f2485dfbdf6?source=rss-e09f5db58866------2</link>
            <guid isPermaLink="false">https://medium.com/p/f2485dfbdf6</guid>
            <dc:creator><![CDATA[Midlaj]]></dc:creator>
            <pubDate>Fri, 15 Sep 2023 06:23:47 GMT</pubDate>
            <atom:updated>2023-09-15T10:50:07.590Z</atom:updated>
            <content:encoded><![CDATA[<h3>What&#39;s new in iOS 17 ?</h3><p>Hello readers,</p><p>As Apple prepares to unveil its 2023 iPhone lineup, there’s another highly anticipated update in store for iPhone users, encompassing models from the iPhone XR onwards: iOS 17. The official release date for iOS 17 is set for Monday, September 18, 2023.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aDAibqhAnEGHG-3AEKbgew.jpeg" /></figure><p>During the keynote presentation at WWDC on June 5, Apple introduced a host of exciting new features that will be part of iOS 17. Among these enhancements, users can expect a new application called Journal, Live Voicemail functionality, and a fresh approach to using Stickers, alongside numerous other smaller refinements.</p><p>This forthcoming software update, which is entirely free, will introduce a plethora of interface refinements, resolve lingering bugs, and introduce innovative features. It’s akin to having a brand-new iPhone experience without any additional cost. In this article, we comprehensively cover everything you need to know about iOS 17. We delve into the latest beta versions and how to access them, elucidate the release schedule for the final version of iOS 17, outline compatible iPhone models, and highlight the exciting new features that will enrich the iOS experience.</p><p><strong>iOS 17 Features<br></strong><br> iOS 16 brought several noteworthy features such as a revamped Lock Screen, the ability to unsend iMessages, and the iCloud Shared Photo Library. Now, as we anticipate iOS 17, it’s natural to wonder what’s in store. While early rumors hinted at “fewer major changes,” Apple has, in fact, unveiled a slew of exciting new features for this update, which we’ll detail below.</p><p>However, it’s important to note that not all of these new features will be available right from the start. At least five iOS 17 features won’t be available at the initial release, including AirDrop over the Internet, the <br> Journal app, Collaborative Apple Music playlists, AirPlay in hotel rooms, and NameDrop to Apple Watch. These features are slated to arrive “later this year” as part of a subsequent software update.</p><p>For more insights into iOS 17, you may also want to explore articles on two fronts: “iOS 17 features that didn’t make the WWDC keynote” and “iOS 17 features that make us eager to upgrade.” Additionally, comparing iOS 16 and iOS 17 can provide further context and a deeper understanding of the upcoming changes.<br> <br><strong> Journal</strong></p><p>Journal is an exciting new addition to the iOS 17 lineup. This innovative app takes inspiration from the Memories feature in Photos and introduces a fresh way to revisit cherished moments in your life. With Journal, you can not only relive these special occasions but also capture your memories in a meaningful way by combining text, location information, and photos. It offers a comprehensive platform for reminiscing about your experiences and documenting them for future reference. Furthermore, Journal includes a Suggestions API, empowering developers to integrate this feature into their own applications, providing users with even more ways to engage with their memories.<br> <br> <br><strong> StandBy</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tr44EfWI0G3xdLVoPyrycQ.jpeg" /></figure><p>StandBy appears to draw inspiration from the Apple Watch. When you place your phone in landscape mode on a stand during the night, it transforms into a versatile bedside companion. It showcases the time with a selection of clock styles, reminiscent of traditional alarm clocks. Additionally, StandBy offers the ability to cycle through your favorite photos, display widgets, and keep you updated on Live Activities, including real-time game scores. Furthermore, you have the option to activate Night Mode, which displays soothing red text to minimize eye strain during nighttime use. It’s like having a modern take on the classic alarm clock, and you can explore how to harness the power of StandBy to create a smart home hub in our detailed guide. For more information, see: “How to use StandBy to elevate your smart home experience.”</p><p><strong>Contact Posters</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QqNz0D6dAngaFYfGemsL3g.jpeg" /></figure><p>With Contact Posters, you have the power to personalize your presence during calls and on your contact card, making your identity distinct and memorable to others. Your customized contact card will be prominently displayed in the Contacts of your friends, allowing you to leave a lasting impression. Tailor your poster using a variety of options, including images, fonts, and colors, ensuring it reflects your unique style and personality. This feature seamlessly integrates with Call Kit, extending its utility to third-party VOIP (Voice Over Internet Protocol) applications as well.</p><p>Discover more about crafting and customizing your Contact Poster in iOS 17 in our comprehensive guide: “How to create and personalize your Contact Poster in iOS 17.”<br> <br><strong> Live Voicemail</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wx8ZmhZO6jPIbq5HIxxZOQ.jpeg" /></figure><p>In the realm of voicemail, iOS 17 introduces a remarkable feature known as Live Voicemail. When someone places a call and leaves a voicemail, you’ll witness a live transcription unfolding as they speak. This real-time transcription empowers you to make an informed decision about whether to answer the call or let it go to voicemail.</p><p><strong>Phone Calls</strong></p><p>Apple has ushered in several changes to enhance the Phone app’s usability. The Contacts button has been replaced, in-call buttons have been repositioned, and the app’s icons have received an update. Following some user feedback, Apple decided to revert the end-call button to its central position, a change implemented in mid-August.</p><p><strong>FaceTime</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/696/1*QXyi3tyicsijzndSet252A.jpeg" /></figure><p>In the FaceTime realm, Apple is introducing a new capability. Users will now have the option to leave a video message within the FaceTime app if the recipient doesn’t answer the call. This feature offers a convenient way to convey your message even when direct communication isn’t possible.<br> <br><strong> Messages</strong></p><p>The Messages app receives significant enhancements in iOS 17. It will offer a speedier performance, along with the addition of search filters that enable users to refine their search results by adding specific terms. Moreover, you’ll have the ability to instantly navigate to the first unread message in a group chat, employ swipe gestures to reply to individual message bubbles and benefit from automatic transcription of audio messages.</p><p>A novel “Check-In” feature is also introduced, allowing you to notify your Family and Friends about your safe arrival at a destination. Messages will intelligently detect any lack of progress toward your destination and prompt you for a response. If you fail to respond, it will automatically share essential information with your designated contact, including your current location, battery level, and cellular service status.</p><p><strong>Improved Autocorrect</strong></p><p>Say goodbye to autocorrect-induced frustrations! Apple is overhauling its on-device machine learning model to enhance accuracy. Additionally, it will learn from your frequently used words and provide real-time sentence suggestions as you type. Furthermore, if you happen to tap on an autocorrected word, you can easily revert it to your original input, eliminating the need for retyping — a welcome relief for everyone.<br> <br><strong> Emoji as Stickers</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nQfHe7tK5rQIZMULnXvLfw.jpeg" /></figure><p>In iOS 17, all emojis have been transformed into versatile stickers, allowing you to resize them to your liking. Additionally, you can now extract subjects from photos and convert them into stickers, providing a creative and personalized touch to your conversations. Furthermore, live animated photos can be transformed into dynamic Live Stickers, adding a lively dimension to your messaging experience.</p><p><strong>New Emoji for iOS 17 in 2024</strong></p><p>Take a sneak peek at the potential new emoji additions slated for iOS 17 in 2024.</p><p><strong>AirDrop Simplified</strong></p><p>Apple is streamlining the AirDrop functionality in iOS 17, making it significantly easier to use. The process is straightforward: simply bring your phones in close proximity, and you can seamlessly share information. Whether you want to share photos or other content, the choice is yours, and you can easily select the phone numbers and email addresses to share on your iPhone or Apple Watch. For instance, if you wish to share photos, all you need to do is bring your devices close together.</p><p><strong>NameDrop</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*087nuHspTHpJN_bvbLpyrA.jpeg" /></figure><p>A novel feature making the most of AirDrop is NameDrop, offering a hassle-free method for exchanging contact information. Gone are the days of initiating a missed call just to ensure someone has your contact details. With NameDrop, sharing contact information becomes a breeze.<br> <br><strong> Keyboard and Dictation</strong></p><p>iOS 17 brings a significant boost to your typing experience. Autocorrect is now more precise than ever before, offering an underlined word that you can tap to easily revert to your original input. Predictive text suggestions appear in real-time as you type, and you can effortlessly incorporate them by tapping the space bar. Thanks to machine learning, autocorrect adapts to your writing style for a more personalized experience. In addition, Dictation benefits from a revamped speech recognition model, ensuring even greater accuracy.</p><p><strong>Siri</strong></p><p>Summoning Siri has become more seamless in iOS 17. You no longer need to preface your commands with “Hey.” Moreover, you can issue multiple requests within the same command, streamlining your interactions with Siri for added convenience.</p><p><strong>Photos</strong></p><p>In iOS 17, the People album harnesses the power of on-device machine learning to recognize a wider array of photos featuring your favorite individuals, as well as adorable cats and dogs.</p><p>While iOS 17 boasts several enhancements, one feature many users would welcome is the ability to pause while recording video, essentially allowing for real-time editing during recording. It’s worth noting that Apple has not officially announced such a feature at this time.<br> <br><strong> Additional Enhancements</strong></p><p>Beyond the prominent features showcased in the keynote, iOS 17 boasts a multitude of smaller yet noteworthy enhancements across various aspects of the operating system. These include improvements in Spotlight search, Notes, Autofill, and Apple Music, offering users a more refined and streamlined experience. For example, you can learn how to set and fine-tune crossfade settings in Apple Music for a personalized listening experience.</p><p><strong>Apple ID Passkey</strong></p><p>iOS 17 marks the mainstream implementation of Apple ID passkey support, building upon its introduction in iOS 16. With iOS 17, iPadOS 17, and macOS Sonoma, you can securely log into your Apple ID using a passkey, eliminating the need for a traditional password. This passkey can be authenticated using Face ID or Touch ID on your iPhone, enhancing both security and convenience in accessing your Apple ID account.<br> <br><strong> iOS 17 Compatibility: Which iPhones Will Be Able to Run iOS 17?</strong></p><p>iOS 17 won’t extend its support to the iPhone 8 and the iPhone X. These models, the iPhone 8, 8 Plus, and iPhone X, all made their debut in the same year. However, they are capable of running iOS 16, and users can expect to receive security updates for at least another year. The following iPhones are slated to receive support for iOS 17, although not all of them may be compatible with every new feature:</p><ul><li>iPhone 14</li><li>iPhone 14 Plus</li><li>iPhone 14 Pro</li><li>iPhone 14 Pro Max</li><li>iPhone 13</li><li>iPhone 13 Mini</li><li>iPhone 13 Pro</li><li>iPhone 13 Pro Max</li><li>iPhone 12</li><li>iPhone 12 Mini</li><li>iPhone 12 Pro</li><li>iPhone 12 Pro Max</li><li>iPhone 11</li><li>iPhone 11 Pro</li><li>iPhone 11 Pro Max</li><li>iPhone XS</li><li>iPhone XS Max</li><li>iPhone XR</li><li>iPhone SE (2nd generation or later)</li></ul><p>Keep in mind that even if your device continues to receive software support for another year, older iPhones might not enjoy the complete array of new features. In previous instances, such as last year, the iPhone 8 and iPhone X missed out on certain exciting functionalities due to their older processors. For more detailed information, you can review the history of iOS versions and ascertain which iOS version your specific iPhone model supports.<br> <br><strong> iOS 17: Third-party App Stores and Sideloading</strong></p><p>Leading up to WWDC, reports circulated suggesting that Apple might introduce a more open approach to iOS in iOS 17. This potential shift could encompass allowing the distribution of applications beyond Apple’s own App Store, enabling the utilization of NFC for contactless payments that extend beyond Apple Pay, permitting browsers that aren’t bound to Apple’s Webkit rendering engine, and more. This move is largely driven by the need to adhere to the EU’s newly established Digital Markets Act. It’s worth noting that these expected changes are anticipated to be applicable exclusively to iPhones running iOS 17 within regions subject to EU law.</p><p>During WWDC, Apple did not officially address these changes, which isn’t entirely surprising. Moreover, there are no explicit references to sideloading or third-party app stores on the iOS 17 website. Nevertheless, the absence of explicit mention does not necessarily rule out the possibility of these changes being implemented in iOS 17, either upon its initial release or in subsequent updates in 2024.</p><h4><strong>Exploring iOS 17: A Glimpse into the Future</strong></h4><p>As the anticipation builds for Apple’s grand unveiling of the 2023 iPhone lineup, iPhone users have another reason to be excited — the impending arrival of iOS 17. Set to debut on Monday, September 18, 2023, iOS 17 promises an array of innovations that will breathe new life into models from the iPhone XR onward.</p><p>During the captivating WWDC keynote on June 5, Apple pulled back the curtain on iOS 17, revealing a treasure trove of features that will redefine the iPhone experience. Among these revelations, we can look forward to the introduction of the Journal app, Live Voicemail functionality, a fresh take on Stickers, and numerous other refinements. The best part? This upcoming software update comes at no extra cost, delivering a host of interface enhancements, bug fixes, and groundbreaking features — a veritable rejuvenation of your iPhone experience.</p><h4><strong>The Evolution of iOS: A Sneak Peek into iOS 17 Features</strong></h4><p>As we eagerly await the arrival of iOS 17, it’s natural to wonder what’s in store. Initial speculations hinted at “fewer major changes,” but Apple has astounded us with a multitude of exciting new features. In this article, we delve deep into these features, providing you with a sneak peek of what’s to come. However, it’s important to note that not all of these features will be available right from the start. At least five notable features, including AirDrop over the Internet, the Journal app, Collaborative Apple Music playlists, AirPlay in hotel rooms, and NameDrop for Apple Watch, are set to arrive “later this year” as part of a subsequent software update.</p><p>For a comprehensive understanding of iOS 17, be sure to explore articles on two fronts: “iOS 17 features that didn’t make the WWDC keynote” and “iOS 17 features that make us eager to upgrade.” Additionally, comparing the advancements between iOS 16 and iOS 17 can provide valuable context and insights into the upcoming changes.</p><p>A Closer Look at Key iOS 17 Features</p><h4><strong>1. Journal: Reliving Cherished Memories</strong></h4><p>Journal emerges as a captivating addition to the iOS 17 lineup, drawing inspiration from the Memories feature in Photos. This innovative app offers a fresh approach to revisiting and preserving the most precious moments of your life. With Journal, you can not only relive these special occasions but also immortalize your memories by seamlessly combining text, location information, and photos. It provides a comprehensive platform for reminiscing about your experiences and documenting them for posterity. What’s more, Journal includes a Suggestions API, granting developers the power to integrate this feature into their applications, offering users even more ways to engage with their treasured memories.</p><h4>2. StandBy: A Modern Take on the Classic Alarm Clock</h4><p>StandBy takes cues from the Apple Watch and transforms your iPhone into a versatile bedside companion. By simply placing your phone in landscape mode on a stand during the night, it undergoes a remarkable metamorphosis. StandBy showcases the time with an array of clock styles reminiscent of traditional alarm clocks. But it doesn’t stop there — StandBy also allows you to cycle through your favorite photos, display widgets, and keep you updated on Live Activities, including real-time game scores. The option to activate Night Mode ensures minimal eye strain during nighttime use, providing a contemporary twist to the classic alarm clock. Discover how to harness the potential of StandBy and create a smart home hub with our in-depth guide.</p><h4>3. Contact Posters: Personalize Your Presence</h4><p>With Contact Posters, you have the power to imbue your calls and contact card with a distinctive and memorable identity. Your personalized contact card takes center stage in your friends’ Contacts, leaving an indelible impression. Tailor your poster using a plethora of options, including images, fonts, and colors, ensuring it authentically represents your unique style and personality. Seamlessly integrating with Call Kit, this feature extends its utility to third-party VOIP applications, enhancing your ability to connect and communicate. Dive into the world of crafting and customizing your Contact Poster in iOS 17 with our comprehensive guide.</p><h4>4. Live Voicemail: A Game-Changer in Voicemail</h4><p>In the realm of voicemail, iOS 17 introduces the groundbreaking Live Voicemail feature. When someone leaves a voicemail, you’ll witness a live transcription unfolding in real time as they speak. This real-time transcription empowers you to make informed decisions about whether to answer the call or let it go to voicemail.</p><h4>5. Phone Calls: Enhancing Usability</h4><p>Apple has embraced several enhancements to elevate the usability of the Phone app. The Contacts button has undergone a transformation, in-call buttons have been repositioned for improved accessibility, and the app’s icons have received a fresh update. Responding to valuable user feedback, Apple has reinstated the end-call button to its central position, a change implemented in mid-August.</p><h4>6. FaceTime: Leaving Video Messages</h4><p>In the FaceTime arena, Apple introduced an exciting capability. Users now have the option to leave a video message within the FaceTime app if the recipient doesn’t answer the call. This feature offers a convenient means of conveying your message even when direct communication isn’t feasible.</p><h4>7. Messages: A Faster, Enhanced Experience</h4><p>The Messages app undergoes significant enhancements in iOS 17, delivering a faster and more responsive performance. Additionally, it introduces search filters that empower users to refine search results by adding specific terms. Further enhancements include the ability to instantly navigate to the first unread message in a group chat, swipe gestures for replying to individual message bubbles, and automatic transcription of audio messages. A novel “Check-In” feature is also introduced, allowing you to notify your Family and Friends about your safe arrival at a destination.</p><p>**8. Improved Autocorrect: Bid Farewell to F</p><p>Continue generating</p><p>Free Research Preview. ChatGPT may produce inaccurate information about people, places, or facts. <a href="https://help.openai.com/en/articles/6825453-chatgpt-release-notes">ChatGPT August 3 Version</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f2485dfbdf6" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>