<?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 Anil Sutariya on Medium]]></title>
        <description><![CDATA[Stories by Anil Sutariya on Medium]]></description>
        <link>https://medium.com/@anilsutariya?source=rss-f96bbad7896e------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*6acfEaT0fTU6JJE3.</url>
            <title>Stories by Anil Sutariya on Medium</title>
            <link>https://medium.com/@anilsutariya?source=rss-f96bbad7896e------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 21:44:48 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@anilsutariya/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[The Model-View-ViewModel Architectural Pattern]]></title>
            <link>https://medium.com/@anilsutariya/the-model-view-viewmodel-architectural-pattern-3be344c1bc47?source=rss-f96bbad7896e------2</link>
            <guid isPermaLink="false">https://medium.com/p/3be344c1bc47</guid>
            <category><![CDATA[design-patterns]]></category>
            <category><![CDATA[mvc]]></category>
            <category><![CDATA[mvvm]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[ios]]></category>
            <dc:creator><![CDATA[Anil Sutariya]]></dc:creator>
            <pubDate>Wed, 30 Aug 2017 05:39:16 GMT</pubDate>
            <atom:updated>2017-08-30T05:39:16.942Z</atom:updated>
            <content:encoded><![CDATA[<p>The Model-View-ViewModel (MVVM) architectural pattern used by iOS/Swift applications. MVVM is an expansion of MVC where we formally couple the view and the controller, but move all the presentation logic out of the controller into a new object called the view model.</p><p>Within an iOS/Swift context, the role of the view is fulfilled by the view+view controller combination (see Figure ).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/641/1*jRzrFhoCrO3smszo55ZpBA.png" /></figure><p><strong><em>Figure </em></strong><em>Model-View View-Model pattern on iOS<br> </em>The roles of the three components are summarized below:</p><ul><li><strong>Model: </strong>Responsible for storing data, maintains two-way communication with the view model.</li><li><strong>View/View controller: </strong>Represents the view part of the pattern, and handles user interaction events. Maintains two-way communication with the view model.</li><li><strong>View model: </strong>Handles presentation logic, maintains two- communication with both the model and the view/view controller. Handles communication with other controllers that may provide specific functionality like complex business logic, and network requests.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3be344c1bc47" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Sufficient, or Unambiguous, layout]]></title>
            <link>https://medium.com/@anilsutariya/a-sufficient-or-unambiguous-layout-e891cca4f81f?source=rss-f96bbad7896e------2</link>
            <guid isPermaLink="false">https://medium.com/p/e891cca4f81f</guid>
            <category><![CDATA[ios]]></category>
            <dc:creator><![CDATA[Anil Sutariya]]></dc:creator>
            <pubDate>Fri, 04 Aug 2017 18:18:06 GMT</pubDate>
            <atom:updated>2017-08-04T18:18:06.356Z</atom:updated>
            <content:encoded><![CDATA[<p>A sufficient, or <em>unambiguous</em>, layout has at least two geometric rules per axis, or a minimum of four rules in all. For example, a view might have an origin and a size — as you would use with frames — to specify where it is and how big it is. But you can express much more with Auto Layout. The following sufficient rule examples define a view’s position and extent along one axis, as illustrated in Figur.</p><ul><li>You could pin the horizontal edges (A) of a view to exact positions in its superview.<br> (The two properties defined in this example are the view’s minimum X and maximum X positions.)</li><li>You could match the width of one view to another subview (B) and then center it horizontally to its superview (width and center X).</li><li>You could declare a view’s width to match its intrinsic content, such as the length of text drawn on it ©, and then pin its right (<em>trailing</em>) edge to the left (<em>leading</em>) edge of another view (width and maximum X).</li><li>You could pin the top and bottom of a view to the superview (D) so that the view stretches vertically along with its superview (minimum Y and maximum Y).</li><li>You could specify a view’s vertical center and its maximum extent (E) and let Auto Layout calculate the height from that offset (center Y and maximum Y)</li><li>You could specify a view’s height and its offset from the top of the view (F) and then hang the view off the top of the superview (minimum Y and height.)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/674/1*bbA2vFMvzB0Mvg5CZC4MgQ.jpeg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e891cca4f81f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[REST Network Communication Framework Using Swift(3.0)]]></title>
            <link>https://medium.com/@anilsutariya/rest-network-communication-framework-using-swift-3-0-bfb00d9e5af6?source=rss-f96bbad7896e------2</link>
            <guid isPermaLink="false">https://medium.com/p/bfb00d9e5af6</guid>
            <category><![CDATA[nsurlsession]]></category>
            <category><![CDATA[rest]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[post]]></category>
            <dc:creator><![CDATA[Anil Sutariya]]></dc:creator>
            <pubDate>Tue, 01 Aug 2017 05:12:28 GMT</pubDate>
            <atom:updated>2017-08-02T11:08:37.382Z</atom:updated>
            <content:encoded><![CDATA[<p><a href="https://www.dropbox.com/s/65y6n0y6dnjfmhr/CommunicationLayer.zip?dl=0"><em>https://www.dropbox.com/s/65y6n0y6dnjfmhr/CommunicationLayer.zip?dl=0</em></a></p><p>Customised NSURLSession and Completely supporting below operations.</p><ol><li>Post.</li><li>Get.</li><li>Delete.</li><li>Put.</li></ol><p>This framework Included.</p><ol><li>Multithreading.</li><li>Error handling.</li><li>Error descriptions and customisation (message) of error.</li><li>Closure based call designed.</li></ol><blockquote><strong><em>How to Usage.</em></strong></blockquote><ol><li>private let client = WebClient()</li></ol><p>2. let params: JSON = param</p><p>client.load(path: “/api/v2/album/58/videos.json”, method: .get, params: params) { result, error in</p><p>}let dictionaries = result as? [JSON]</p><p>Print (dictionaries).</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bfb00d9e5af6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Difference between Stub object and Mock object in Unit Test]]></title>
            <link>https://medium.com/@anilsutariya/difference-between-stub-object-and-mock-object-in-unit-test-17b8d79c0829?source=rss-f96bbad7896e------2</link>
            <guid isPermaLink="false">https://medium.com/p/17b8d79c0829</guid>
            <category><![CDATA[testing]]></category>
            <dc:creator><![CDATA[Anil Sutariya]]></dc:creator>
            <pubDate>Sat, 29 Jul 2017 04:56:48 GMT</pubDate>
            <atom:updated>2017-07-29T04:56:48.201Z</atom:updated>
            <content:encoded><![CDATA[<blockquote><strong>Stub object</strong>. A stub object (also known as a stub), is a fake<br> object that can be used in place of a real dependency, is significantly easier to instantiate, and provides harmless method implementations of the object it is trying to emulate.</blockquote><blockquote><strong>Mock object</strong>. A mock object (also known as a mock), is similar to a stub. However, the key difference is that a mock is used in a test assertion, or asserted against.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=17b8d79c0829" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Basic array properties and methods]]></title>
            <link>https://medium.com/@anilsutariya/basic-array-properties-and-methods-5fe503c03c9e?source=rss-f96bbad7896e------2</link>
            <guid isPermaLink="false">https://medium.com/p/5fe503c03c9e</guid>
            <category><![CDATA[swift-3]]></category>
            <category><![CDATA[arrays]]></category>
            <dc:creator><![CDATA[Anil Sutariya]]></dc:creator>
            <pubDate>Thu, 27 Jul 2017 17:46:27 GMT</pubDate>
            <atom:updated>2017-07-27T17:46:27.652Z</atom:updated>
            <content:encoded><![CDATA[<p>An array is a Collection, which is itself a Sequence. If those terms have a familiar ring, they should: the same is true of a String’s characters, which I called a character sequence For this reason, an array and a character sequence bear some striking similarities to one another.</p><p>As a collection, an array’s count read-only property reports the number of elements it contains. If an array’s count is 0, its isEmpty property is true.</p><p>An array’s first and last read-only properties return its first and last elements, but they are wrapped in an Optional because the array might be empty and so these prop‐ erties would need to be nil. This is one of those rare situations in Swift where you can wind up with an Optional wrapping an Optional. For example, consider an array of Optionals wrapping Ints, and what happens when you get the last property of such an array.</p><p>An array’s largest accessible index is one less than its count. You may find yourself calculating index values with reference to the count; for example, to refer to the last two elements of arr, you can say:</p><pre>let arr = [1,2,3]<br>let slice = arr[arr.count-2...arr.count-1] // [2,3]</pre><p>Swift doesn’t adopt the modern convention of letting you use negative numbers as a shorthand for that calculation. On the other hand, for the common case where you want the last n elements of an array, you can use the suffix(_:) method:</p><p>let arr = [1,2,3]</p><p>let slice = arr.suffix(2) // [2,3]</p><p>Both suffix(_:) and its companion prefix(_:) yield ArraySlices, and have the remarkable feature that there is no penalty for going out of range:</p><pre>let arr = [1,2,3]<br>let slice = arr.suffix(10) // [1,2,3] (and no crash)</pre><p>Instead of describing the size of the suffix or prefix by its count, you can express the limit of the suffix or prefix by its index:</p><pre>let arr = [1,2,3]<br>    let slice = arr.suffix(from:1)    // [2,3]<br>    let slice2 = arr.prefix(upTo:1)    // [1]<br>    let slice3 = arr.prefix(through:1) // [1,2]</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5fe503c03c9e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Array subscripting]]></title>
            <link>https://medium.com/@anilsutariya/array-subscripting-5644761aef49?source=rss-f96bbad7896e------2</link>
            <guid isPermaLink="false">https://medium.com/p/5644761aef49</guid>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[arrays]]></category>
            <dc:creator><![CDATA[Anil Sutariya]]></dc:creator>
            <pubDate>Thu, 27 Jul 2017 17:33:08 GMT</pubDate>
            <atom:updated>2017-07-27T17:33:08.209Z</atom:updated>
            <content:encoded><![CDATA[<p>The Array struct implements subscript methods to allow access to elements using square brackets after a reference to an array. You can use an Int inside the square brackets. For example, in an array consisting of three elements, if the array is referred to by a variable arr, then arr[1] accesses the second element.</p><p>You can also use a Range of Int inside the square brackets. For example, if arr is an array with three elements, then arr[1…2] signifies the second and third elements. Technically, an expression like arr[1…2] yields something called an ArraySlice. However, an ArraySlice is very similar to an array; for example, you can subscript an ArraySlice in just the same ways you would subscript an array, and an ArraySlice can be passed where an array is expected.</p><p>In general, therefore, you will probably pretend that an ArraySlice <em>is </em>an array. How‐ ever, they are not the same thing. An ArraySlice is not a new object; it’s a way of pointing into a section of the original array. For this reason, its index numbers are those of the original array. For example:</p><p>let arr = [&quot;manny&quot;, &quot;moe&quot;, &quot;jack&quot;]<br> let slice = arr[1...2]<br> print(slice[1]) // moe</p><pre>The ArraySlice slice consists of &quot;moe&quot; and &quot;jack&quot; — and these are not merely &quot;moe&quot; and &quot;jack&quot; taken <em>from </em>the original array, but the &quot;moe&quot; and &quot;jack&quot; <em>in </em>the original array. For this reason, their index numbers are 1 and 2, just as in the original array. If you want to extract a new array based on this slice, coerce the slice to an Array:</pre><pre>let arr2 = Array(slice)<br>    print(arr2[1]) // jack<br>If the reference to an array is mutable (var, not let), then a subscript expression can be assigned to. This alters what’s in that slot. Of course, what is assigned must accord with the type of the array’s elements:</pre><pre>var arr = [1,2,3]<br>    arr[1] = 4 // arr is now [1,4,3]</pre><pre>If the subscript is a range, what is assigned must be a slice. You can assign a literal array, because it will be cast for you to an ArraySlice; but if what you’re starting with is an array reference, you’ll have to cast it to a slice yourself. Such assignment can change the length of the array being assigned to:var arr = [1,2,3]<br>    arr[1..&lt;2] = [7,8] // arr is now [1,7,8,3]<br>    arr[1..&lt;2] = [] // arr is now [1,8,3]<br>    arr[1..&lt;1] = [10] // arr is now [1,10,8,3] (no element was removed!)</pre><pre>    let arr2 = [20,21]<br>    // arr[1..&lt;1] = arr2 // compile error! You have to say this:<br>    arr[1..&lt;1] = ArraySlice(arr2) // arr is now [1,20,21,10,8,3]It is a runtime error to access an element by a number larger than the largest element number or smaller than the smallest element number. If arr has three elements, speaking of arr[-1] or arr[3] is not illegal linguistically, but your program will crash.</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5644761aef49" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Swift Modern Approach MVC With Network Communication Layer.]]></title>
            <link>https://medium.com/@anilsutariya/modern-approach-mvc-with-network-communication-layer-71ede0eb9566?source=rss-f96bbad7896e------2</link>
            <guid isPermaLink="false">https://medium.com/p/71ede0eb9566</guid>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[mvc]]></category>
            <dc:creator><![CDATA[Anil Sutariya]]></dc:creator>
            <pubDate>Wed, 19 Jul 2017 14:06:35 GMT</pubDate>
            <atom:updated>2017-07-22T12:26:15.191Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/562/1*rsCZnvpC29H-OUC5ValYBw.png" /></figure><p><a href="https://www.dropbox.com/s/k6alhm6jb3yp2sw/Demostration_AnilSutariya.zip?dl=0"><strong>https://www.dropbox.com/s/k6alhm6jb3yp2sw/Demostration_AnilSutariya.zip?dl=0</strong></a></p><p>=&gt;This Example Include Completed MVC Architecture Pattern.</p><p>=&gt;NetworkCommunication Layer have Different operations(POST,GET,DELET,UPDATE). Completly optimized.</p><p>=&gt;Services Error Model.</p><p>=&gt;Pagination wise data request to server.</p><p>=&gt; Image Lazy Loading cell image in TableView.</p><p><strong><em>Download Link:</em>https://www.dropbox.com/s/k6alhm6jb3yp2sw/Demostration_AnilSutariya.zip?dl=</strong>0</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=71ede0eb9566" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Creational design pattern with Swift]]></title>
            <link>https://medium.com/@anilsutariya/creational-design-pattern-with-swift-2c9bec23f7b4?source=rss-f96bbad7896e------2</link>
            <guid isPermaLink="false">https://medium.com/p/2c9bec23f7b4</guid>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[design-patterns]]></category>
            <dc:creator><![CDATA[Anil Sutariya]]></dc:creator>
            <pubDate>Wed, 31 May 2017 15:17:02 GMT</pubDate>
            <atom:updated>2017-05-31T15:21:45.119Z</atom:updated>
            <content:encoded><![CDATA[<p>In software engineering, creational design patterns are design patterns that deal with object creation mechanisms, trying to create objects in a manner suitable to the situation. The basic form of object creation could result in design problems or added complexity to the design. Creational design patterns solve this problem by somehow controlling this object creation.</p><p><strong>Abstract Method: </strong>The factory pattern is used to replace class constructors, abstracting the process of object generation so that the type of the object instantiated can be determined at run-time.</p><p>import UIKit</p><p>protocol Currency {</p><p>func symbol() -&gt; String</p><p>func code() -&gt; String</p><p>}</p><p>class Euro : Currency {</p><p>func symbol() -&gt; String {</p><p>return “€”</p><p>}</p><p>func code() -&gt; String {</p><p>return “EUR”</p><p>}</p><p>}</p><p>class UnitedStatesDolar : Currency {</p><p>func symbol() -&gt; String {</p><p>return “$”</p><p>}</p><p>func code() -&gt; String {</p><p>return “USD”</p><p>}</p><p>}</p><p>enum Country {</p><p>case UnitedStates, Spain, UK, Greece</p><p>}</p><p>enum CurrencyFactory {</p><p>static func currencyForCountry(country:Country) -&gt; Currency? {</p><p>switch country {</p><p>case .Spain, .Greece :</p><p>return Euro()</p><p>case .UnitedStates :</p><p>return UnitedStatesDolar()</p><p>default:</p><p>return nil</p><p>}</p><p>}</p><p>}</p><p>let noCurrencyCode = “No Currency Code Available”</p><p>CurrencyFactory.currencyForCountry(country: .Greece)?.code() ?? noCurrencyCode</p><p>CurrencyFactory.currencyForCountry(country: .Spain)?.code() ?? noCurrencyCode</p><p>CurrencyFactory.currencyForCountry(country: .UnitedStates)?.code() ?? noCurrencyCode</p><p>CurrencyFactory.currencyForCountry(country: .UK)?.code() ?? noCurrencyCode</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2c9bec23f7b4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[GCD With Multithreading Using Swift.]]></title>
            <link>https://medium.com/@anilsutariya/gcd-with-multithreading-using-swift-2f3a3b71ba4f?source=rss-f96bbad7896e------2</link>
            <guid isPermaLink="false">https://medium.com/p/2f3a3b71ba4f</guid>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[gcd]]></category>
            <dc:creator><![CDATA[Anil Sutariya]]></dc:creator>
            <pubDate>Tue, 30 May 2017 13:26:08 GMT</pubDate>
            <atom:updated>2017-07-27T17:49:21.920Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Try to use this code for some complex task in thread.</em></p><p>DispatchQueue.global(qos: .userInitiated).asyncAfter(deadline: .now() + 2) {[unowned self] in</p><p>// Call the Perform Work</p><p>self.performWork()</p><p>DispatchQueue.main.async {</p><p>self.statusLabel.text = “Finished!”</p><p>}</p><p>}</p><p>self.statusLabel.text = “Started work!”</p><p>}</p><p>///////////////////////////////////////////////////////////////</p><p>func performWork() {</p><p>let n = 5000</p><p>var matrix = Array(repeating: [Int](repeating: 0, count: n), count: n)</p><p>for i in 0..&lt;n {</p><p>for j in 0..&lt;n {</p><p>matrix[i][j] = i + j</p><p>}</p><p>}</p><p>}</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2f3a3b71ba4f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Button Extension with semicircle shape in Swift]]></title>
            <link>https://medium.com/@anilsutariya/button-extension-with-semicircle-shape-in-swift-5f9cfe8bd5af?source=rss-f96bbad7896e------2</link>
            <guid isPermaLink="false">https://medium.com/p/5f9cfe8bd5af</guid>
            <category><![CDATA[uibutton]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[ios]]></category>
            <dc:creator><![CDATA[Anil Sutariya]]></dc:creator>
            <pubDate>Tue, 30 May 2017 02:54:05 GMT</pubDate>
            <atom:updated>2017-05-30T02:54:05.104Z</atom:updated>
            <content:encoded><![CDATA[<p>Please download code below link</p><h4><a href="https://www.dropbox.com/s/noh7ilddkacg67n/test.zip?dl=0"><strong>https://www.dropbox.com/s/noh7ilddkacg67n/test.zip?dl=0</strong></a></h4><p>extension UIButton</p><p>{</p><p>func mybg(_bg:UIColor){</p><p>let circlePath = UIBezierPath.init(arcCenter: CGPoint(x:self.bounds.size.width / 2, y: self.bounds.size.height/2),</p><p>radius: 50.0, startAngle: (CGFloat(M_PI/4)), endAngle: (CGFloat(M_PI)), clockwise: true)</p><p>let circleShape = CAShapeLayer()</p><p>circleShape.path = circlePath.cgPath</p><p>self.layer.mask = circleShape</p><p>self.backgroundColor = .red</p><p>}</p><p>}</p><p><strong>Use it</strong></p><p>import UIKit</p><p>class ViewController: UIViewController {</p><p>@IBOutlet weak var circularButton:UIButton?</p><p>override func viewDidLoad() {</p><p>super.viewDidLoad()</p><p>circularButton?.mybg(_bg:.red)</p><p>// Do any additional setup after loading the view, typically from a nib.</p><p>}</p><p>override func didReceiveMemoryWarning() {</p><p>super.didReceiveMemoryWarning()</p><p>// Dispose of any resources that can be recreated.</p><p>}</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/322/1*ozMl6mNRSBQPW3kPwVao5Q.png" /></figure><p>}</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5f9cfe8bd5af" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>