<?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 Keval Gajjar on Medium]]></title>
        <description><![CDATA[Stories by Keval Gajjar on Medium]]></description>
        <link>https://medium.com/@kevalunchadiya92?source=rss-41f4452a57b2------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*gaoxvjO_xU3ZkwAY</url>
            <title>Stories by Keval Gajjar on Medium</title>
            <link>https://medium.com/@kevalunchadiya92?source=rss-41f4452a57b2------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 05:37:45 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@kevalunchadiya92/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[Access Specifier Swift]]></title>
            <link>https://medium.com/@kevalunchadiya92/access-specifier-swift-75ea4e527fb7?source=rss-41f4452a57b2------2</link>
            <guid isPermaLink="false">https://medium.com/p/75ea4e527fb7</guid>
            <category><![CDATA[access-modifier-in-swift]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[access-specifier-in-swift]]></category>
            <dc:creator><![CDATA[Keval Gajjar]]></dc:creator>
            <pubDate>Wed, 05 Aug 2026 13:45:34 GMT</pubDate>
            <atom:updated>2026-08-05T13:45:34.056Z</atom:updated>
            <content:encoded><![CDATA[<p>Swift supports basically 5 access specifier, which plays a crucial role in development, It controls the visibility for the class, methods, and properties, other types during the file.</p><p>We can make it secure the code and the accessibility level as per the permission given to the scope.</p><p><em>Following are the access specifier in Swift<br>1.</em><strong><em>open</em></strong>: Any module and can be subclassed/overridden outside the module<br><em>2</em>. <strong><em>public</em></strong>: Any module, but cannot be subclassed/overridden outside the module<br><em>3.</em> <strong><em>internal</em> </strong>(default): Anywhere within the same module<br><em>4.</em> <strong><em>fileprivate</em>: </strong>Only within the same source file<br><em>5.</em> <strong><em>private</em>: </strong>Only within the enclosing declaration (and extensions in the same file)</p><p><strong>Examples<br>open: </strong>it provides highest access level, also, It allows access, subclassing, and method overriding from other modules.</p><pre>open class Animal {<br>    open func makeSound() {<br>        print(&quot;Sound&quot;)<br>    }<br>}</pre><p><strong>public: </strong>Accessible from other modules. also, It cannot be subclassed or overridden outside the defining module</p><pre>public class Vehicle {<br>    public func start() {<br>        print(&quot;Started&quot;)<br>    }<br>}</pre><p><strong>internal: </strong>Its default access specifier, Accessible only within the current module, If you don’t specify an access level, Swift uses internal</p><pre>class Student {<br>    var name = &quot;John&quot;<br>}</pre><pre>internal class Student {<br>    internal var name = &quot;John&quot;<br>}</pre><p>above both the snippet is equivalent.</p><p><strong>fileprivate: </strong>Accessible only within the same source file, it will also be accessible in extension in same file</p><pre>// Helper.swift<br>fileprivate class Helper {<br>    func calculate() { }<br>}<br>extension Helper {<br>    init() {<br>        self.calculate() // It will be accessible here too because of the same file<br>    }<br>}</pre><p><strong>private: </strong>Accessible only within the enclosing declaration and its extensions in the same file.</p><pre>class BankAccount {<br>    private var balance = 1000 <br><br>    func showBalance() { <br>        print(balance)<br>    }<br>}<br>extension BankAccount {<br>    func getBalance() -&gt; Int {<br>       // Here balance will not be accesible due to private access specifier<br>    }<br>}</pre><p>Access level hierarchy</p><pre>open -&gt; public -&gt; internal (default) -&gt; fileprivate -&gt; private<br>Low                                                       High</pre><blockquote>Difference between <strong><em>public</em> v/s <em>open</em></strong></blockquote><p><strong><em>public</em></strong> Accessible from other modules, <strong>cannot</strong> be subclassed or overridden outside the module.<br><strong><em>open </em></strong>Accessible from other modules and <strong>can</strong> be subclassed and overridden outside the module.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=75ea4e527fb7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Property wrappers in SwiftUI]]></title>
            <link>https://medium.com/@kevalunchadiya92/property-wrappers-in-swiftui-a00983c3d23d?source=rss-41f4452a57b2------2</link>
            <guid isPermaLink="false">https://medium.com/p/a00983c3d23d</guid>
            <category><![CDATA[combine-framework]]></category>
            <category><![CDATA[property-wrapper]]></category>
            <category><![CDATA[swiftdata]]></category>
            <category><![CDATA[swiftui-5]]></category>
            <dc:creator><![CDATA[Keval Gajjar]]></dc:creator>
            <pubDate>Tue, 04 Aug 2026 05:50:14 GMT</pubDate>
            <atom:updated>2026-08-04T05:50:14.488Z</atom:updated>
            <content:encoded><![CDATA[<p>Before we start working on SwiftUI, we should be aware of it’s fundamentals. one of the most fundamental is Property Wrappers.</p><blockquote>There are categories as follow :<br><strong>Dynamic Types: </strong>These are the property wrappers which purely been introduced in SwiftUI (introduced after iOS 13 onwards — 2019).</blockquote><p><strong>@State </strong>Stores a value owned by the view itself; when it changes, the view redraws.</p><p><strong>@Binding </strong>A two-way link to a value that lives in a different (usually parent) view.</p><p><strong>@StateObject </strong>Creates and owns a class-based observable object; survives view redraws.</p><p><strong>@ObservedObject </strong>Watches a class-based observable object that’s owned somewhere else (you don’t create it here). (Note: this is the real name — “ObservableObject” is the protocol, not this wrapper.)</p><p><strong>@EnvironmentObject </strong>Grabs a shared observable object that was placed into the environment by an ancestor view.</p><p><strong>@Environment </strong>Reads a system or custom value from the environment (like color scheme, dismiss action, etc.).</p><p><strong>@FocusState </strong>Tracks/controls which input field currently has keyboard focus.</p><p><strong>@GestureState </strong>Holds temporary state during a gesture; automatically resets when the gesture ends.</p><p><strong>@ScaledMetric </strong>Auto-adjusts a number (like spacing or size) based on the user’s Dynamic Type text size.</p><p><strong>@AppStorage </strong>Saves/reads a small value directly to UserDefaults (persists across app launches).</p><p><strong>@SceneStorage </strong>Restores small UI state (like scroll position) when a scene is recreated.</p><p><strong>@FetchRequest </strong>Fetches and live-observes a list of Core Data objects.</p><p><strong>@SectionedFetchRequest </strong>Same as above, but groups the results into sections.</p><p><strong>@Query </strong>Fetches and live-observes model data in SwiftData (the newer replacement for Core Data).</p><p><strong>@Bindable <br></strong>Lets you create two-way bindings to properties of an @Observable class (used with the newer Observation framework / SwiftData).</p><blockquote><strong>Protocol (not a property wrapper)</strong></blockquote><p><strong>@ObsevableObject</strong> — A protocol you make a class conform to, so SwiftUI can watch its @Published properties for changes.</p><blockquote><strong>Other</strong></blockquote><p><strong>@Namespace</strong> — Creates a shared ID space so SwiftUI can animate matching views smoothly between states (matched geometry effect).</p><p><strong>Example</strong></p><pre>import SwiftUI<br>import CoreData<br>import SwiftData<br><br>// MARK: - ObservableObject (protocol) + @Published<br>// A reference-type &quot;model&quot; SwiftUI can watch. This is the protocol<br>// that makes @StateObject / @ObservedObject / @EnvironmentObject work.<br>class NotesSettings: ObservableObject {<br>    @Published var isDarkNotesTheme: Bool = false<br>}<br><br>// MARK: - @Observable class (new Observation framework, used with @Bindable)<br>@Observable<br>class Draft {<br>    var text: String = &quot;&quot;<br>}<br><br>// MARK: - Root screen<br>struct NotesScreen: View {<br><br>    @StateObject private var settings = NotesSettings()<br>    @State private var newNoteTitle: String = &quot;&quot;<br>    @FocusState private var titleFieldIsFocused: Bool<br>    @GestureState private var dragOffset: CGFloat = 0<br>    @ScaledMetric(relativeTo: .body) private var iconSize: CGFloat = 24<br>    @AppStorage(&quot;showCompletedNotes&quot;) private var showCompletedNotes: Bool = true<br>    @SceneStorage(&quot;notesScreen.selectedTab&quot;) private var selectedTab: Int = 0<br>    @Namespace private var noteAnimation<br>    @Bindable var draft = Draft()<br><br>    var body: some View {<br>        NavigationStack {<br>            VStack(spacing: 16) {<br><br>                TextField(&quot;New note title&quot;, text: $newNoteTitle)<br>                    .focused($titleFieldIsFocused)<br>                    .textFieldStyle(.roundedBorder)<br>                    .font(.system(size: iconSize))<br><br>                TextField(&quot;Draft body (Observable + Bindable)&quot;, text: $draft.text)<br>                    .textFieldStyle(.roundedBorder)<br><br>                Toggle(&quot;Show completed notes&quot;, isOn: $showCompletedNotes)<br>                Toggle(&quot;Dark notes theme&quot;, isOn: $settings.isDarkNotesTheme)<br><br>                Rectangle()<br>                    .fill(Color.gray.opacity(0.4))<br>                    .frame(width: 60, height: 20)<br>                    .offset(x: dragOffset)<br>                    .gesture(<br>                        DragGesture()<br>                            .updating($dragOffset) { value, state, _ in<br>                                state = value.translation.width<br>                            }<br>                    )<br>                    .matchedGeometryEffect(id: &quot;handle&quot;, in: noteAnimation)<br><br>                Picker(&quot;Source&quot;, selection: $selectedTab) {<br>                    Text(&quot;Core Data&quot;).tag(0)<br>                    Text(&quot;SwiftData&quot;).tag(1)<br>                }<br>                .pickerStyle(.segmented)<br><br>                if selectedTab == 0 {<br>                    CoreDataNotesList()<br>                } else {<br>                    SwiftDataNotesList()<br>                }<br>            }<br>            .padding()<br>            .navigationTitle(&quot;Notes&quot;)<br>            .onAppear { titleFieldIsFocused = true }<br>            .environmentObject(settings)<br>        }<br>    }<br>}<br><br>// MARK: - A child that just watches an object owned elsewhere<br>struct NoteSummaryBadge: View {<br>    @ObservedObject var settings: NotesSettings<br><br>    var body: some View {<br>        Text(settings.isDarkNotesTheme ? &quot;🌙&quot; : &quot;☀️&quot;)<br>    }<br>}<br><br>// MARK: - A deeper child pulling settings from the environment<br>struct FooterView: View {<br>    @EnvironmentObject var settings: NotesSettings<br>    @Environment(\.dismiss) var dismiss<br>    @Environment(\.colorScheme) var colorScheme<br><br>    var body: some View {<br>        HStack {<br>            Text(colorScheme == .dark ? &quot;Dark mode&quot; : &quot;Light mode&quot;)<br>            Button(&quot;Close&quot;) { dismiss() }<br>        }<br>    }<br>}<br><br>// MARK: - A reusable view driven purely by a @Binding<br>struct TitleEditor: View {<br>    @Binding var title: String<br><br>    var body: some View {<br>        TextField(&quot;Title&quot;, text: $title)<br>    }<br>}<br><br>// MARK: - Core Data example<br>struct CoreDataNotesList: View {<br>    @FetchRequest(sortDescriptors: [NSSortDescriptor(key: &quot;createdAt&quot;, ascending: false)])<br>    private var notes: FetchedResults&lt;NoteEntity&gt;<br><br>    @SectionedFetchRequest(sectionIdentifier: \NoteEntity.category, sortDescriptors: [])<br>    private var sectionedNotes: SectionedFetchResults&lt;String, NoteEntity&gt;<br><br>    var body: some View {<br>        List {<br>            ForEach(sectionedNotes) { section in<br>                Section(header: Text(section.id)) {<br>                    ForEach(section) { note in<br>                        Text(note.title ?? &quot;Untitled&quot;)<br>                    }<br>                }<br>            }<br>        }<br>    }<br>}<br><br>// Placeholder Core Data entity (normally generated from your .xcdatamodeld)<br>@objc(NoteEntity)<br>class NoteEntity: NSManagedObject {<br>    @NSManaged var title: String?<br>    @NSManaged var category: String<br>    @NSManaged var createdAt: Date<br>}<br><br>// MARK: - SwiftData example<br>struct SwiftDataNotesList: View {<br>    @Query(sort: \SwiftDataNote.createdAt, order: .reverse)<br>    private var notes: [SwiftDataNote]<br><br>    var body: some View {<br>        List(notes) { note in<br>            Text(note.title)<br>        }<br>    }<br>}<br><br>@Model<br>class SwiftDataNote {<br>    var title: String<br>    var createdAt: Date<br>    init(title: String, createdAt: Date = .now) {<br>        self.title = title<br>        self.createdAt = createdAt<br>    }<br>}</pre><h3>Walking through it</h3><ul><li><strong>@State / </strong><strong>@Binding</strong> — newNoteTitle is owned locally with @State. TitleEditor takes a @Binding so a child view can edit a value it doesn&#39;t own.</li><li><strong>@StateObject / </strong><strong>@ObservedObject / </strong><strong>@EnvironmentObject</strong> — NotesScreen creates settings with @StateObject because it&#39;s the owner. NoteSummaryBadge receives the same object as @ObservedObject because it only watches. FooterView pulls it from the environment instead of being passed it directly.</li><li><strong>@Environment</strong> — used for dismiss and colorScheme, both built-in system values.</li><li><strong>@FocusState / </strong><strong>@GestureState</strong> — focus for the title field, a transient offset for the drag handle.</li><li><strong>@ScaledMetric / </strong><strong>@AppStorage / </strong><strong>@SceneStorage</strong> — a font size that respects accessibility settings, a toggle persisted to UserDefaults, and a tab selection that survives the scene being recreated.</li><li><strong>@FetchRequest / </strong><strong>@SectionedFetchRequest</strong> — Core Data, flat versus grouped by category.</li><li><strong>@Query</strong> — the SwiftData equivalent of @FetchRequest.</li><li><strong>@Observable + </strong><strong>@Bindable</strong> — Draft uses the newer Observation framework instead of ObservableObject/@Published; @Bindable lets you bind directly into its properties.</li><li><strong>@Namespace</strong> — ties the drag handle to a matchedGeometryEffect ID space for smooth animation.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a00983c3d23d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[SwiftUI Basics]]></title>
            <link>https://medium.com/@kevalunchadiya92/swiftui-basics-ded7648da16b?source=rss-41f4452a57b2------2</link>
            <guid isPermaLink="false">https://medium.com/p/ded7648da16b</guid>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[mobile-app-development]]></category>
            <category><![CDATA[swiftui]]></category>
            <dc:creator><![CDATA[Keval Gajjar]]></dc:creator>
            <pubDate>Sun, 28 May 2023 18:32:16 GMT</pubDate>
            <atom:updated>2023-05-28T18:32:16.475Z</atom:updated>
            <content:encoded><![CDATA[<p>Hello folks, Hope you are doing good in iOS, Till SwiftUI was come in the market, all were use the Storyboard and Xib before, and it takes time to load the storyboard based on scenes it contains, the storyboard with more Scenes would take some time to compile too. for this problem’s solution the SwiftUI came in the market.</p><p>SwiftUI is purely work based on <strong>View</strong> structure, every piece of code to design any view or something similar, it uses the <strong>struct by subclassing the View</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/552/1*KNn7CqAPTwkPoTRE_CBowg.png" /><figcaption>This is the basic structure of the brand new SwiftUI project</figcaption></figure><p>Example :</p><pre>import SwiftUI<br><br>@main<br>struct FirstSwiftUIApp: App {<br>    var body: some Scene {<br>        WindowGroup {<br>            ContentView()<br>        }<br>    }<br>}</pre><p><strong>iOS 14</strong> introduced the <strong>App</strong> protocol, for what many consider <strong>“SwiftUI 2.0”</strong>. In essence, the App protocol <strong>replaces the AppDelegate,</strong> and takes over many of its functions. Your app is now a “pure” SwiftUI App; it doesn’t have that <strong>AppDelegate</strong> anymore.</p><p>The above snippet is the default one snippet, it consists of <strong>body variable of Scene </strong>protocol, it is the content and behavior of the scene. For any scene that you create, provide a computed `body` property that defines the scene as a composition of other scenes. You can assemble a scene from built-in scenes that SwiftUI provides, as well as other scenes that you’ve defined.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7zpJbhgK-p60z3spKQr5XQ.png" /></figure><p>Example of <strong>VStack</strong>:</p><pre>var body: some View {<br>      VStack(<br>          alignment: .leading,<br>          spacing: 10<br>       ) {<br>          ForEach(<br>              1...10,<br>              id: \.self<br>          ) {<br>              Text(&quot;Item \($0)&quot;)<br>          }<br>      }<br> }</pre><p><strong>Output:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/120/1*dELNZrUI8HRUUD7tJcfqgQ.png" /></figure><p>Example of<strong> HStack</strong>:</p><pre>var body: some View {<br>       HStack(<br>          alignment: .center,<br>          spacing: 10<br>       ) {<br>       ForEach(<br>            1...3,<br>            id: \.self<br>       ) {<br>             Text(&quot;Item \($0)&quot;)<br>       }<br>   }<br>}</pre><p><strong>Output:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/330/1*77sBKJyCoIbZdUvT7ws6Vw.png" /></figure><p>The above two Stacks are the most commonly used stack to design any views.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ded7648da16b" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>