<?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 Hemant Soni on Medium]]></title>
        <description><![CDATA[Stories by Hemant Soni on Medium]]></description>
        <link>https://medium.com/@sonihemant111?source=rss-393faaa31462------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*Y0FV2AW54_AgNF6wfetH-Q.jpeg</url>
            <title>Stories by Hemant Soni on Medium</title>
            <link>https://medium.com/@sonihemant111?source=rss-393faaa31462------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 18:49:01 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sonihemant111/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[ViewDidLoad vs ViewDidAppear (How to use them appropriately).]]></title>
            <link>https://sonihemant111.medium.com/viewdidload-vs-viewdidappear-how-to-use-them-appropriately-d8785cfc1e20?source=rss-393faaa31462------2</link>
            <guid isPermaLink="false">https://medium.com/p/d8785cfc1e20</guid>
            <category><![CDATA[viewwillappear]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[viewdidload]]></category>
            <category><![CDATA[lifecycle]]></category>
            <dc:creator><![CDATA[Hemant Soni]]></dc:creator>
            <pubDate>Thu, 18 Feb 2021 11:57:41 GMT</pubDate>
            <atom:updated>2021-02-18T11:57:41.907Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>ViewDidLoad:</strong> This method is called after the view controller has loaded its view hierarchy into memory. This method is called regardless of whether the view hierarchy was loaded from a nib file or created programmatically in the loadView() method. You usually override this method to perform additional initialization on views that were loaded from nib files.</p><p><strong>ViewDidAppear:</strong> Notifies the view controller that its view was added to a view hierarchy. You can override this method to perform additional tasks associated with presenting the view. If you override this method, you must call super at some point in your implementation.<br><strong>Note:</strong> If a view controller is presented by a view controller inside of a popover, this method is not invoked on the presenting view controller after the presented controller is dismissed.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d8785cfc1e20" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Where is main file in swift]]></title>
            <link>https://sonihemant111.medium.com/where-is-main-file-in-swift-c6fb38458303?source=rss-393faaa31462------2</link>
            <guid isPermaLink="false">https://medium.com/p/c6fb38458303</guid>
            <category><![CDATA[entry-point-in-swift]]></category>
            <category><![CDATA[swift-programming]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[main-function-in-swift]]></category>
            <category><![CDATA[app-life-cycle]]></category>
            <dc:creator><![CDATA[Hemant Soni]]></dc:creator>
            <pubDate>Thu, 18 Feb 2021 11:47:51 GMT</pubDate>
            <atom:updated>2021-02-18T11:47:51.812Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IHOW9OKe64et1vxDGTmZqw.jpeg" /></figure><p>In Objective C we have main.c file where the application life cycle starts from.</p><pre><em>#import &lt;UIKit/UIKit.h&gt;<br>#import &quot;AppDelegate.h&quot;<br><br>int main(int argc, char * argv[]) {<br>    @autoreleasepool {<br>        return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));<br>    }<br>}</em></pre><p>In this function, UIApplicationMain from UIKit is invoked. It will initiate an object of UIApplication or its subclass and as you can see in the third argument nil is passed in this example, which means the default UIApplication will be used. The last argument specifies which class to be used as the app delegate. An instance of it will be created in UIApplicationMain and set as the delegate property of UIApplication object. This object is used to receive some life cycle methods like didFinishLaunching and didEnterBackground.</p><p>Although UIApplicationMain returns an int, it will never return and be left in the memory, until the system or user kills it.</p><p>When you create an iOS project in Swift, there is no main file in the project, neither the main function. but there is a only thing seems to be related to main that is @UIApplicationMain attribute, which is above the default Appdelegate class declaration.</p><p>If we mark a class as @UIApplicationMain, the compiler will assume that class as a Appdelegate class. Other things are more likely boilerplate code, so they are inserted in compiling time automatically.</p><p>You can try to remove the @UIApplicationMain attribute, which will cause an error when compiling and we don’t need to remove this attribute until or unless you need to create your own Appdelegate class.</p><h3>Thank you for reading</h3><p>I hope it will be useful for you. Please let me know your thoughts and opinions :). If you enjoyed it, feel free to hit the clap button below 👏 to help others find it!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c6fb38458303" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Static vs Class vs Global Functions in Swift]]></title>
            <link>https://sonihemant111.medium.com/static-vs-class-vs-global-functions-in-swift-3a72856dba4a?source=rss-393faaa31462------2</link>
            <guid isPermaLink="false">https://medium.com/p/3a72856dba4a</guid>
            <dc:creator><![CDATA[Hemant Soni]]></dc:creator>
            <pubDate>Thu, 18 Feb 2021 08:04:32 GMT</pubDate>
            <atom:updated>2021-02-18T08:05:04.600Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3xX-B4qg_p1TE2H2_iHTGQ.png" /></figure><p><em>Functions</em> are self-contained chunks of code that perform a specific task. There are multiple ways to write functions in Swift.</p><p><strong>Static Functions:</strong></p><p>Static functions are invoked by the class/struct itself, not by an instance. This makes it simple to invoke utility functions.</p><pre><strong>class</strong> <strong>AppUtility</strong> {<br>    static func appUtility() {<br>    }<br>}</pre><p>We can access static function as AppUtility.appUtility()</p><p>Note: Static functions can not be overridden and static is same as class final..</p><p><strong>Class Functions:</strong></p><p>Class functions (not instance methods) are also static functions but they can be overridden by subclasses unlike static functions.</p><pre><strong>class</strong> <strong>AppUtility</strong>{<br>    <strong>class</strong> func appUtility(){<br>        print(&quot;Inside AppUtility&quot;)<br>    }<br>}<br><strong>class</strong> <strong>AppOtherUtility</strong>: AppUtility{<br>    override <strong>class</strong> func appUtility(){<br>        print(&quot;Inside AppOtherUtility&quot;)<br>    }<br>}</pre><p>We can access them similar to static functions as AppUtility.appUtility() and AppOtherUtility.appUtility().</p><p>we can call the appUtility method as AppUtility.appUtility() and AppOtherUtility.appUtility()</p><p><strong>Global Functions:</strong></p><p>If the function is not in class or structure and it is independent in the project. The global functions can be kept in a separate file that we can import into any project as per the requirement.</p><pre>func appUtility() {<br>}</pre><p>We can just access them as appUtility() anywhere in the project.</p><p>Note: In case of static functions, if we access one of the static member, entire class gets loaded in memory. But in case of global function, only that particular function will be loaded in memory.</p><h3>Thank you for reading</h3><p>I hope it will be useful for you. Please let me know your thoughts and opinions :). If you enjoyed it, feel free to hit the clap button below 👏 to help others find it!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3a72856dba4a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Static Property || Swift]]></title>
            <link>https://sonihemant111.medium.com/static-property-swift-9575232f9e9b?source=rss-393faaa31462------2</link>
            <guid isPermaLink="false">https://medium.com/p/9575232f9e9b</guid>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[swift-static-property]]></category>
            <category><![CDATA[swift-programming]]></category>
            <category><![CDATA[static-properties]]></category>
            <dc:creator><![CDATA[Hemant Soni]]></dc:creator>
            <pubDate>Thu, 18 Feb 2021 06:55:10 GMT</pubDate>
            <atom:updated>2021-02-18T06:55:10.633Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*_Oyn-z510A8EaKgwjQo1zQ.jpeg" /></figure><p>Swift lets you create properties and methods that belong to a type, rather than to instances of a type. This is helpful for organizing your data meaningfully by storing shared data.</p><h3>When to use Static Property</h3><p>As we all know that if we creates a instance property then it will belongs to a specific type and every time we will create a instance of that type it has own property value.</p><p>Use Static property when you don’t need to have different value of property for every instance.</p><p>You can create static property by just placing static keyword. Have a look on below code example:</p><blockquote><strong>struct Student {<br> static var favoriteSubject = “Drawing”</strong></blockquote><blockquote><strong>var name: String<br>var age: Int<br>}</strong></blockquote><blockquote><strong>let objStudent = Student(name: “Hemant Soni”, age: 30)<br>print(Student.favoriteSubject)</strong></blockquote><p>The out put will be: Drawing</p><p>and if we will try to use static property with instance of that type then we will get below error:</p><blockquote><strong>Ex: print(objStudent.favoriteSubject)<br>error: static member ‘favoriteSubject’ cannot be used on instance of type ‘Student’</strong></blockquote><h3>Thank you for reading</h3><p>I hope it will be useful for you. Please let me know your thoughts and opinions :). If you enjoyed it, feel free to hit the clap button below 👏 to help others find it!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9575232f9e9b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Enable Stack Logging in Xcode]]></title>
            <link>https://sonihemant111.medium.com/enable-stack-logging-in-xcode-1e0f8b8f194c?source=rss-393faaa31462------2</link>
            <guid isPermaLink="false">https://medium.com/p/1e0f8b8f194c</guid>
            <category><![CDATA[memory-leak]]></category>
            <category><![CDATA[stack-logging]]></category>
            <category><![CDATA[enable-memory-debugger]]></category>
            <dc:creator><![CDATA[Hemant Soni]]></dc:creator>
            <pubDate>Sun, 31 May 2020 14:22:45 GMT</pubDate>
            <atom:updated>2020-05-31T14:34:22.988Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Ytg5NeYaP88oLkwk" /></figure><p>Guys, we all want’s to improve the performance of the app and at that time when you are getting memory pressure or you found that application is taking too much memory then you just start digging into your code and try to find out exact things that are causing memory issues but still, it is very difficult to check each and every line of code so Xcode provides a very important tool that is memory graph debugger to find out exact memory leaks cause.</p><p>But we need to enable Malloc Stack Logging first that will give the Xcode memory debugger the ability to find the exact lines of code that are causing memory leaks.</p><p>In this tutorial we are just going to Enabling Malloc Stack Logging:</p><p>Step 1: First of all, we need to edit the scheme.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*qHEcBzJ1vguuWQFx.png" /></figure><p>Step 2: In the Run schema: there is Malloc scribble and Malloc stack options under the Memory management section we need to check this to allow Xcode to find out exact memory leaks using memory graph debugger and one more thing we need to select All Allocation and Free History for Malloc stack.</p><p>As you can see the image below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*oJsglTxSq6AE1evG.png" /></figure><p>Now you have upgraded memory debugger and you just need to click on Memory debugger icon to start to find memory leaks in your current project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/462/0*7YN8Gxl4tveP2Fb6.png" /></figure><p>In the next tutorial, you will get more detailed information on debugging Memory leaks using Memory Graph Debugger.</p><p>Thanks for reading and I hope you enjoyed the article. Happy debugging!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1e0f8b8f194c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[HTTP response status codes]]></title>
            <link>https://sonihemant111.medium.com/http-response-status-codes-5970014a11bd?source=rss-393faaa31462------2</link>
            <guid isPermaLink="false">https://medium.com/p/5970014a11bd</guid>
            <category><![CDATA[status-codes]]></category>
            <category><![CDATA[http-status-code]]></category>
            <dc:creator><![CDATA[Hemant Soni]]></dc:creator>
            <pubDate>Sun, 17 May 2020 17:53:02 GMT</pubDate>
            <atom:updated>2020-05-18T03:26:16.777Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/920/1*L8XRYeaepHki61mXaXeDnA.jpeg" /></figure><p>HTTP response status codes indicate whether a specific request has been successfully completed or not and many of us (mobile developers) are not aware about all the http status as we can’t judge which status should be received or what backend guys should provide us in API’s response.</p><p>Basically all the developers are aware about the 200 and 500 http status code but if a talk about others like 201,503 etc then often mobile developer are not aware about that so I would like to explain about some the the available http status code so that mobile developer can taken decision at what time and what should they received in API’s response.</p><p>Lets discuss in detail:</p><p>Responses are grouped in five classes:</p><ol><li>Informational responses (100 –199),</li><li>Successful responses (200 — 299),</li><li>Redirects (300 — 399),</li><li>Client errors (400 – 499),</li><li>and Server errors (500 — 599).</li></ol><h3>1. Information responses</h3><p>100 (Continue): This interim response indicates that everything so far is OK and that the client should continue the request, or ignore the response if the request is already finished.</p><p>101 (Switching Protocol): This code is sent in response to an upgrade request header from the client, and indicates the protocol the server is switching to.</p><p>102 (Processing): This code indicates that the server has received and is processing the request, but no response is available yet.</p><p>103 (Early Hints): This status code is primarily intended to be used with the link header, letting the user agent start preloading resources while the server prepares a response.</p><h3>2. Successful responses</h3><p>200 (OK): The request has succeeded. The meaning of the success depends on the HTTP method:</p><ul><li>GET: The resource has been fetched and is transmitted in the message body.</li><li>HEAD: The entity headers are in the message body.</li><li>PUT or POST: The resource describing the result of the action is transmitted in the message body.</li><li>TRACE: The message body contains the request message as received by the server</li></ul><p>201 (Created): The request has succeeded and a new resource has been created as a result. This is typically the response sent after Post requests, or some Put requests.</p><p>204 (No Content): There is no content to send for this request, but the headers may be useful. The user-agent may update its cached headers for this resource with the new ones.</p><p>205 (Reset Content): Tells the user-agent to reset the document which sent this request.</p><h3>3. Redirection messages</h3><p>300 (Multiple Choice): The request has more than one possible response. The user-agent or user should choose one of them.</p><p>301 (Moved Permanently): The URL of the requested resource has been changed permanently. The new URL is given in the response.</p><p>302 (Found): This response code means that the URI (Uniform Resource Identifier) of requested resource has been changed <em>temporarily</em>. Further changes in the URI might be made in the future. Therefore, this same URI should be used by the client in future requests.</p><p>303 (See Others): The server sent this response to direct the client to get the requested resource at another URI with a GET request.</p><p>304 (Not Modified): This is used for caching purposes. It tells the client that the response has not been modified, so the client can continue to use the same cached version of the response.</p><h3>4. Client error responses</h3><p>400 (Bad Request): The server could not understand the request due to invalid syntax.</p><p>401 (Unauthorized): Although the HTTP standard specifies &quot;unauthorized&quot;, semantically this response means &quot;unauthenticated&quot;. That is, the client must authenticate itself to get the requested response.</p><p>402 (Payment Required): This response code is reserved for future use. The initial aim for creating this code was using it for digital payment systems, however this status code is used very rarely and no standard convention exists.</p><p>403 (Forbidden): The client does not have access rights to the content; that is, it is unauthorized, so the server is refusing to give the requested resource. Unlike 401, the client&#39;s identity is known to the server.</p><p>404 (Not Found): The server can not find the requested resource. In the browser, this means the URL is not recognized. In an API, this can also mean that the endpoint is valid but the resource itself does not exist. Servers may also send this response instead of 403 to hide the existence of a resource from an unauthorized client. This response code is probably the most famous one due to its frequent occurrence on the web.</p><p>405 (Method Not Allowed): The request method is known by the server but has been disabled and cannot be used. For example, an API may forbid DELETE-ing a resource. The two mandatory methods, GET and HEAD, must never be disabled and should not return this error code.</p><p>406 (Not Acceptable): This response is sent when the web server, after performing server-driven content negotiation, doesn&#39;t find any content that conforms to the criteria given by the user agent.</p><p>408 (Request Timeout): The server did not receive a complete request message within the time that it was prepared to wait.</p><h3>5. Server error responses</h3><p>500 (Internal Server Error): The server has encountered a situation it doesn&#39;t know how to handle.</p><p>501 (Not Implemented): The request method is not supported by the server and cannot be handled. The only methods that servers are required to support (and therefore that must not return this code) are GET and HEAD.</p><p>502 (Bad Gateway): This error response means that the server, while working as a gateway to get a response needed to handle the request, got an invalid response.</p><p>503 (Service Unavailable): The server is not ready to handle the request. Common causes are a server that is down for maintenance or that is overloaded.</p><p>504 (Gateway Timeout)This error response is given when the server is acting as a gateway and cannot get a response in time.</p><p>505 (HTTP Version Not Supported): The HTTP version used in the request is not supported by the server.</p><p>I hope now you guys are aware of available HTTP status code.</p><p><em>If you like what you’ve read today you can check our my other </em><a href="https://medium.com/@sonihemant111"><em>articles</em></a><em> or want to get in touch, please send me a tweet or follow me on </em><a href="https://twitter.com/sonihemant111"><em>Twitter</em></a><em>, it really makes my day.</em></p><p>Thanks!!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5970014a11bd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[SWIFT: Public getter and Private setter:- Private(Set)]]></title>
            <link>https://sonihemant111.medium.com/swift-public-getter-and-private-setter-private-set-3e9eb0840137?source=rss-393faaa31462------2</link>
            <guid isPermaLink="false">https://medium.com/p/3e9eb0840137</guid>
            <category><![CDATA[swift-5]]></category>
            <category><![CDATA[ios-app-development]]></category>
            <category><![CDATA[private]]></category>
            <category><![CDATA[xcode]]></category>
            <dc:creator><![CDATA[Hemant Soni]]></dc:creator>
            <pubDate>Sat, 14 Dec 2019 10:24:52 GMT</pubDate>
            <atom:updated>2019-12-14T10:24:52.229Z</atom:updated>
            <content:encoded><![CDATA[<p>Swift supports public get but private set on properties:</p><p>Let’s have a look with sample code so that we can understand the need to use private(set) keyword-</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lw6K2vrORr9d4cdIByTGxQ.png" /></figure><p>The above picture depicts, there is a Student class with property rollNumber, firstName, and lastName and we have declared them as private property, hence we can’t use them directly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UMHYaNpK0m1s-QmT_AFoPw.png" /><figcaption>As you can see we have to create a method inside a class to use its private property.</figcaption></figure><p>But recently I came across a new and awesome way to do this in a single line statement like</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*I2RQtwQwdLJ6pa5KEroUeQ.png" /></figure><h3>Thank you for reading</h3><p>This is my second article on Medium, I hope it will be useful for you. Please let me know your thoughts and opinions :). If you enjoyed it, feel free to hit the clap button below 👏 to help others find it!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3e9eb0840137" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Required Initializers in swift]]></title>
            <link>https://sonihemant111.medium.com/required-initializers-in-swift-4805de8ade9e?source=rss-393faaa31462------2</link>
            <guid isPermaLink="false">https://medium.com/p/4805de8ade9e</guid>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[required-initializers]]></category>
            <dc:creator><![CDATA[Hemant Soni]]></dc:creator>
            <pubDate>Sun, 08 Sep 2019 06:36:37 GMT</pubDate>
            <atom:updated>2019-09-08T06:36:37.041Z</atom:updated>
            <content:encoded><![CDATA[<p>Required initializers will be explained in this article.</p><p>If we write a required modifier before the definition of init method in a class that indicates that every subclass of that class must implement that initializer.</p><p>There are various things related to required initializer.</p><p>Lets Consider the following example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*taGzURC4tI74e8xD114oBA.png" /></figure><p>As you can see there is super class named <strong>ClassA</strong> and derived class named <strong>ClassB</strong>. Here we didn’t write required init method in ClassB because there is no requirement of ClassB to do something in init() method, So it will automatically call super class required init().</p><p><strong>Note: You do not have to provide an explicit implementation of a required initializer if you can satisfy the requirement with an inherited initializer.</strong></p><p>Lets change something in above code snippet to understand other things related to required init() method —</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NEn__61RZsBjBzQGT8jN-Q.png" /></figure><p>On the above example we have written required init() in derived class so at the time of initialization of ClassB’s object, Super class required initializer method will automatically get called and we don’t need to write super.init() method .</p><p>Note — Here we didn’t write super.init() in ClassB required init() method.</p><p>Lets modify above code snippet to understand when we need to call super init() method in derived class initializer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*siein7M0X_5-ZCaFI77s_w.png" /></figure><p>Now we are getting an error :- “‘super.init’ isn’t called on all paths before returning from initializer”</p><p>It means, if there is any parameter in required init() method of super class then we have to call super.init() method in ClassB’s required init() method.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OMErxni4NFCClfbxZvF4Pw.png" /></figure><p><em>Finally we know now all about required init() method in Swift.</em></p><h3>If you enjoyed reading this post and found it useful, please share and recommend it so others can find it !!!!</h3><p>Thanks!!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4805de8ade9e" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>