<?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 Nofel on Medium]]></title>
        <description><![CDATA[Stories by Nofel on Medium]]></description>
        <link>https://medium.com/@Nofel?source=rss-6f854e459450------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*MXL-j6S8fTEd8UFP_foEEw.png</url>
            <title>Stories by Nofel on Medium</title>
            <link>https://medium.com/@Nofel?source=rss-6f854e459450------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 22:09:10 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@Nofel/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[Swift’s “guard”]]></title>
            <link>https://medium.com/swift-space/swift-s-guard-893c24c7ef2c?source=rss-6f854e459450------2</link>
            <guid isPermaLink="false">https://medium.com/p/893c24c7ef2c</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[swift]]></category>
            <dc:creator><![CDATA[Nofel]]></dc:creator>
            <pubDate>Thu, 20 Aug 2015 20:17:29 GMT</pubDate>
            <atom:updated>2017-02-10T05:04:35.614Z</atom:updated>
            <content:encoded><![CDATA[<p>Guard statement is an awesome new addition to Swift. You can think of it, as if used in the right way it actually does what a guard does in real.</p><p>A school guard like would only allow the students to enter belonging to that school. A student of another, if tries to enter is stopped right there and asked to go back. That is exactly what a guard statement will do if the condition following it is not met.</p><p>Less talk some code now !</p><h3>guard in Functions</h3><pre>func printString(string: String?) {<br>  guard string != nil else { return }<br>  print(string!, separator: &quot;&quot;, terminator: &quot;\n&quot;)<br>}</pre><p>The function is guarded against any <strong>nil</strong> inputs. If the input is nil, guard will execute the <strong>else</strong> clause and <strong>return</strong> from the function before any other statement is able to run.</p><h3>Optional Binding</h3><p>Heard of optional binding , Yes guard statement support it. Using it, the previous code block can be rewritten as</p><pre>func printString(string: String?) {<br>  guard let stringToPrint = string else { return }<br>  print(stringToPrint, separator &quot;&quot;, terminator: &quot;\n&quot;)<br>}</pre><p>Now if the argument ‘<strong>string</strong>’ is <strong>nil</strong> than it will execute the else clause if not than the function will continue to run normal and will print the string. If you have been using optional binding using <strong>if-let</strong> syntax you might notice something different here. We are using the optionally bind constant outside the scope of the conditional. In the case of if-let, we could only use it inside the brackets succeeding ‘<strong>if</strong>’ only when the condition is true.</p><p>In the case of guard statement if the condition is true than the constant’s scope is rest of the function. We can use it anywhere after it.</p><h4>Compound Optional Binding</h4><p>We can also use compound optional bindings like in the following example.</p><pre>func printBio(firstName: String?,lastName: String?, dateOfBirth: String?, country: String?) {<br>  guard let fName = firstName, <br>        let lName = lastName, <br>        let dob = dateOfBirth, let cnt = country <br>        else {<br>              print(“Bio is not complete”, separator: “”, terminator: “\n”)<br>              return<br>             }<br> <br>  print(“\(fName) \(lName) \(dob) \(cnt)”, separator: &quot;&quot;, terminator: &quot;\n&quot;)<br>}</pre><h3>Transferring Control</h3><p>Another thing to note in the above example is if the condition is not met we return from the function. This is because guard statement must have transfer control in order to leave the scope in which it resides, if the condition following it is not met. In the example above we have used “<strong>return</strong>”. In the case of a loop we could use “<strong>continue</strong>” or “<strong>break”</strong>. We can also throw an <a href="https://medium.com/swift-space/error-handling-in-swift-2-0-e9f304131e95"><strong>error</strong></a>. Let’s look at an example.</p><pre>var strings: Array&lt;String&gt; = [“Safe”, “Coding”, “why”, “using”, “guard”, “statement”]</pre><pre>for string in strings {</pre><pre>// We don’t want the ‘why’ string to be printed because it violates the grammar of the sentence.</pre><pre>    guard string != “why” else { continue }<br>    print(string, separator: &quot;&quot;, terminator: &quot;\n&quot;)<br>}<br>// Safe Coding using guard statement</pre><p>Here if the condition is not met we use “<strong>continue</strong>” in the else clause to transfer control.</p><p>That is it for <strong>guard</strong>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=893c24c7ef2c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swift-space/swift-s-guard-893c24c7ef2c">Swift’s “guard”</a> was originally published in <a href="https://medium.com/swift-space">Swift Space</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Swift’s Error Handling]]></title>
            <link>https://medium.com/swift-space/error-handling-in-swift-2-0-e9f304131e95?source=rss-6f854e459450------2</link>
            <guid isPermaLink="false">https://medium.com/p/e9f304131e95</guid>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[swift-programming]]></category>
            <category><![CDATA[ios]]></category>
            <dc:creator><![CDATA[Nofel]]></dc:creator>
            <pubDate>Fri, 14 Aug 2015 11:23:27 GMT</pubDate>
            <atom:updated>2016-01-17T08:34:56.517Z</atom:updated>
            <content:encoded><![CDATA[<p>We all coders love what we do but let’s be honest only when it works. The moment it fails we go through rigorous testing and pain to find the real cause behind it. What makes us great coders is not just how well we code but how well and fast we debug what we write, and anything which facilitates this is gold for all of us.</p><p>With <strong>Swift 2.0 </strong>Apple adds error handling. Its very carefully designed keeping in mind the things a Cocoa or any other developer expects and deserves. Swift Error Handling beats Objective C where it hurts the most. It was just a pain in the ass to pass error instances as pointers to methods which could return an error and then later on checking the return value.</p><p>Swift 2.0 solves this with a breeze keeping code readable and understandable, and of course making your method signatures a little small by stripping away the need to pass error instances as pointers, but adding a keyword.</p><h3>Functions that can throw errors</h3><p>Any function that is expected to throw an error is marked with a throw keyword like this</p><pre>func someFunctionThatThrowsAnError(aValue: Int) throws</pre><p>and of course with any return type it would look like this</p><pre>func someFunctionThatThrowsAnError(aValue: Int) throws -&gt; Bool</pre><h3>Defining and Throwing Errors</h3><p>Now the real question is how to throw an error. Swift 2.0 introduced <a href="https://developer.apple.com/library/prerelease/ios/documentation/Swift/Reference/Swift_ErrorType_Protocol/index.html"><strong>ErrorType Protocol</strong></a>. We can easily create a <strong>enum</strong> for our different error types by conforming it to the <strong>ErrorType Protocol</strong> like this</p><pre>enum MyErrorType: ErrorType {<br>  case AnyError<br>  case AnyErrorWithanArgument(argument: AnyObject)<br>  case AnyErrorWithUserInfo(info: [String:AnyObject])<br>}</pre><h4>Let’s throw some now !</h4><pre>func someFunctionThatThrowsAnError(value: Int) throws {<br>   if value == -1 {<br>     throw MyErrorType.AnyError<br>   }<br>}</pre><p><strong>Or</strong></p><pre>func someFunctionThatThrowsAnError(value: Int) throws {<br>   if value == -1 {<br>     throw MyErrorType.AnyErrorWithanArgument(argument: value)<br>   }<br>}</pre><p><strong>Or</strong></p><pre>func someFunctionThatThrowsAnError(value: Int) throws { <br>  if value == -1 {<br>    var userInfo: [String:AnyObject] = [String:AnyObject]()<br>    userInfo[“Value”] = value<br>    throw MyErrorType.AnyErrorWithUserInfo(info: userInfo)<br>  }<br>}</pre><h3>Catching Errors</h3><h4>Thrown now let’s catch !</h4><p>For catching errors any function that can throw is called by prepending<strong> try</strong> to the method call in the <strong>do statement</strong>.</p><pre>do {<br>  try someFunctionThatThrowsAnError(value: Int) throws<br>}<br>catch MyErrorType.AnyError {<br>   print(&quot;Any Error Occured&quot;, separator: &quot;&quot;, terminator: &quot;\n&quot;)<br>}<br>catch MyErrorType.AnyErrorWithanArgument(let argument) {<br>   print(argument, separator: &quot;&quot;, terminator: &quot;\n&quot;)<br>}<br>catch MyErrorType.AnyErrorWithUserInfo(let userInfo) {<br>   print(userInfo, separator: &quot;&quot;, terminator: &quot;\n&quot;)<br>}<br>catch {<br>   print(&quot;Unknown Error&quot;, separator: &quot;&quot;, terminator: &quot;\n&quot;)<br>}</pre><p>You catch errors by using one or multiple catch statements after a do statement. You can use catch statement for every possible error and yes the last without any error type is compulsory, because in addition to handling the error types you know about, you need to handle the ones you don’t with a universal catch statement. That way if your function changes the set of errors it throws in the future, callers will still catch its errors.</p><h3>try! and try?</h3><p>If for any specific input in a function you are dead sure it will never throw an error can be called like this using <strong>try!</strong> instead of <strong>try</strong>. There’s no need to put it in a <strong>do-catch statement</strong>.</p><pre>let newValue = 2<br>try! someFunctionThatThrowsAnError(value: newValue)</pre><p>In case you don’t want to go into catching errors and just want to get the result then Swift introduces an option to call functions that throw errors in the following way.</p><pre>let oldValue = 2<br>let newValue = try? someFunctionThatThrowsAnError(value: oldValue)</pre><p>This returns a optional. The optional value is nil in case of error and it contains the returned value in case of no error.</p><p><strong>Happy Error Handling :)</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e9f304131e95" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swift-space/error-handling-in-swift-2-0-e9f304131e95">Swift’s Error Handling</a> was originally published in <a href="https://medium.com/swift-space">Swift Space</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Swift Protocol Extensions: A Limitation ?]]></title>
            <link>https://medium.com/swift-space/swift-protocol-extensions-a-limitation-3239ea1de3b3?source=rss-6f854e459450------2</link>
            <guid isPermaLink="false">https://medium.com/p/3239ea1de3b3</guid>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[swift-programming]]></category>
            <category><![CDATA[swift-protocol]]></category>
            <dc:creator><![CDATA[Nofel]]></dc:creator>
            <pubDate>Sun, 09 Aug 2015 12:03:04 GMT</pubDate>
            <atom:updated>2017-03-17T07:08:48.524Z</atom:updated>
            <content:encoded><![CDATA[<p>I think Protocol extensions are one of the most powerful features of Swift 2.0 . I simply love it. I recently tried to get my hands dirty and the first problem I tried to solve using it wasn’t possible. If it was I bet it would have been awesome. So Let me share what I am talking about.</p><h3>Little background</h3><p>I always try to keep my app’s view controllers clean and tidy. For every DataSource or Delegate I create a separate class and implement the required DataSource or Delegate Protocols in it. I then finally use instance of this class as a datasource or delegate for tableview/collectionview’s datasource or delegate in the view controller.</p><p>I thought this would have been made much easier through <strong>Swift Protocol Extensions</strong>.</p><h3>So what I tried</h3><p>For example I have two view controllers each having an instance of <a href="https://developer.apple.com/library/ios/documentation/UIKit/Reference/UITableView_Class/"><strong>UITableView</strong></a> and conforming to the <a href="https://developer.apple.com/library/ios/documentation/UIKit/Reference/UITableViewDataSource_Protocol/"><strong>UITableViewDataSource</strong></a> Protocol.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/488aca2f7f458a6ad8d7aa0ce60e8f58/href">https://medium.com/media/488aca2f7f458a6ad8d7aa0ce60e8f58/href</a></iframe><blockquote>I know this code will not compile because both view controllers have not implemented the required methods belonging to UITableViewDataSource Protocol but still just for a second bear with me !</blockquote><p><strong>Then I could do this …..</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5a2060ce666562a125f6b181ffb4484d/href">https://medium.com/media/5a2060ce666562a125f6b181ffb4484d/href</a></iframe><p>Just imagine if this could happen then we wouldn’t have to create separate classes for datasources or delegates. Just extend <a href="https://developer.apple.com/library/ios/documentation/UIKit/Reference/UITableViewDataSource_Protocol/"><strong>UITableViewDataSource</strong></a>/<a href="https://developer.apple.com/library/ios/documentation/UIKit/Reference/UICollectionViewDataSource_protocol/"><strong>UICollectionViewDataSource</strong></a>, implement the required methods and use the where clause to specify for what view controller (that has the <a href="https://developer.apple.com/library/ios/documentation/UIKit/Reference/UITableView_Class/"><strong>UITableView</strong></a>/<a href="https://developer.apple.com/library/ios/documentation/UIKit/Reference/UICollectionView_class/"><strong>UICollectionView</strong></a>) these methods need to be called!</p><p>This could kind of enforce the developers to some extent keep there view controllers clean by not managing any datasources or delegates.</p><h4>Edit — 17/03/2017</h4><p>There’s also another limitation that the protocol extensions do not provide the ability to have properties of their own, which we’ll be needing in the case of datasources.</p><blockquote>What do you think ?</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3239ea1de3b3" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swift-space/swift-protocol-extensions-a-limitation-3239ea1de3b3">Swift Protocol Extensions: A Limitation ?</a> was originally published in <a href="https://medium.com/swift-space">Swift Space</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CloudKit in context]]></title>
            <link>https://medium.com/@Nofel/cloudkit-in-context-1efd6ec23ed1?source=rss-6f854e459450------2</link>
            <guid isPermaLink="false">https://medium.com/p/1efd6ec23ed1</guid>
            <category><![CDATA[core-data]]></category>
            <category><![CDATA[cloudkit]]></category>
            <category><![CDATA[swift]]></category>
            <dc:creator><![CDATA[Nofel]]></dc:creator>
            <pubDate>Fri, 26 Jun 2015 22:18:40 GMT</pubDate>
            <atom:updated>2016-01-03T16:40:39.344Z</atom:updated>
            <content:encoded><![CDATA[<p>I have been playing with <a href="https://developer.apple.com/icloud/index.html"><strong>CloudKit</strong></a> for a while now. I admit that I was always skeptical because of the things being said and discussed in the developer community. Specially a <a href="https://news.ycombinator.com/item?id=9681872"><strong>thread</strong></a> on <a href="https://news.ycombinator.com/"><strong>news.ycombinator</strong></a> in which the take away thing was that Apple has a very bad reputation in doing the server side stuff. And who doesn’t agree because who hasn’t been bitten by the iCloud Sync claims like <strong>“It Just Works”</strong> while actually being <strong>“It does work sometimes but only if you are the chosen one”</strong>.</p><p>While with <strong>CloudKit</strong> Apple is trying to fix their past mistakes. I have tried it and it works. It’s Apis are very well done and documented. And the ease with which you can incorporate it in your apps is mind blowing.</p><p>I come from being working on <strong>CoreData</strong> a lot and I personally like how its Api is designed. So, while working on CloudKit I missed some features which CoreData’s Api provide like the <a href="https://developer.apple.com/library/ios/documentation/Cocoa/Reference/CoreDataFramework/Classes/NSManagedObjectContext_Class/"><strong>NSManagedObjectContext</strong></a> class. What it does is it tracks all the <strong>insertions</strong>, <strong>deletions</strong> and <strong>modifications</strong> on instances of <a href="https://developer.apple.com/library/prerelease/ios/documentation/Cocoa/Reference/CoreDataFramework/Classes/NSManagedObject_Class/index.html"><strong>NSManagedObject</strong></a> class and it simply commits the changes to the store only when we call <strong>save()</strong> on an instance of it.</p><h3>Allow me to introduce CKSRecordContext</h3><p>I tried to implement the same approach with CloudKit. I wrote a class <strong>CKSRecordContext</strong>. It does for <a href="https://www.google.com/url?sa=t&amp;rct=j&amp;q=&amp;esrc=s&amp;source=web&amp;cd=1&amp;ved=0CCEQFjAA&amp;url=https%3A%2F%2Fdeveloper.apple.com%2Flibrary%2Fprerelease%2Fios%2Fdocumentation%2FCloudKit%2FReference%2FCKRecord_class%2Findex.html&amp;ei=m8-NVY2eBcW3uQSk8p24Ag&amp;usg=AFQjCNF5VOWZjUI9lIHbY7uq5o_oSoOR_w&amp;sig2=ILm9PBx6pCJlPtXzhMNWKA&amp;bvm=bv.96783405,d.c2E&amp;cad=rja"><strong>CKRecord</strong></a> what <strong>NSManagedObjectContext</strong> does for <strong>NSManagedObject</strong>. It tracks all the <strong>insertions</strong>, <strong>modifications</strong> and <strong>deletions</strong> and only tries to save the instances of CKRecords on the server when we call <strong>save</strong>() on an instance of it.</p><h4>Time to show some code in Swift !</h4><p><strong>Creating a new instance of CKSRecordContext</strong></p><pre>var context:CKSRecordContext = CKRecordContext(database: CKContainer.defaultContainer().privateCloudDatabase, recordZone: nil)</pre><p><strong>Creating a new CKRecord</strong></p><pre>var ckRecord = context.insertNewCKRecord(&quot;NewRecordType&quot;)</pre><p><strong>Modifying CKRecords</strong></p><p><strong>Good news !</strong> No code over here. Any changes in the records created with the methods provided by the context are tracked automatically.</p><p><strong>Deleting a CKRecord</strong></p><pre>var ckRecord = context.insertNewCKRecord(&quot;NewRecordType&quot;)<br>context.deleteRecord(record: ckRecord)</pre><p><strong>Fetching CKRecords from the server</strong></p><pre>fetchCKRecord(recordID:CKRecordID,completion:(record:CKRecord?,error:NSError!) -&gt;())</pre><pre>fetchCKRecords(recordType:String,predicate:NSPredicate,completion:(results:Array&lt;AnyObject&gt;?,error:NSError!) -&gt;())<br> fetchCKRecords(recordType:String,predicate:NSPredicate,sortDescriptors:[NSSortDescriptor],completion:(results:Array&lt;AnyObject&gt;?,error:NSError!) -&gt;())</pre><h3>And Finally ! Saving the Insertions, Modifications and Deletions to server.</h3><p>Its a one liner ! (Ignoring the completion closure to make it sound cooler :)</p><pre>context.save { error in<br>  if error != nil {<br>        print(&quot;Saved Successfully&quot;)<br>    }<br>}</pre><p>For more info Check it out on <a href="https://github.com/CloudKitSpace/CKSRecordContext"><strong>Github</strong></a>.</p><p><strong>Happy CloudKitting :)</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1efd6ec23ed1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Reason why CloudKit cannot be ignored.]]></title>
            <link>https://medium.com/@Nofel/reason-why-cloudkit-cannot-be-ignored-9c7806d76230?source=rss-6f854e459450------2</link>
            <guid isPermaLink="false">https://medium.com/p/9c7806d76230</guid>
            <category><![CDATA[core-data]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[cloudkit]]></category>
            <dc:creator><![CDATA[Nofel]]></dc:creator>
            <pubDate>Thu, 25 Jun 2015 13:39:18 GMT</pubDate>
            <atom:updated>2015-08-24T07:27:01.008Z</atom:updated>
            <content:encoded><![CDATA[<p>So, It was <strong>2014</strong> and <strong>Apple</strong> tried its best to buy Parse. Failing at it, they did what they do most of the time. They built their own “<strong>Parse</strong>” from the ground up and then closed it to Apple Platforms which they released on <strong>WWDC 2014</strong>. The developers who went through the <strong>WWDC 2014 CloudKit </strong><a href="https://developer.apple.com/videos/wwdc/2014/"><strong>Session Videos</strong></a> were convinced, including myself that it’s awesome. <a href="https://twitter.com/brentsimmons"><strong>Brent Simmons</strong></a> even did a <a href="http://inessential.com/2014/06/08/notes_on_cloudkit">blog post</a> on it and his remarks were</p><blockquote>“First off — holy shit.”</blockquote><p>And rest of the developers were also like.…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*zmPwmzXHYOpwmgWrPRTnUg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*VElj5nOcQafyad8CS9GvOw.jpeg" /></figure><p>Then the hype went down. Developers did a sanity check and tried to let their dreams of becoming a millionaire live, by porting their <strong>iOS</strong> or <strong>Mac</strong> Apps to <strong>Android</strong> in the near future. And so CloudKit was not adopted that much because of it’s competitors like <strong>Parse</strong>, <strong>Firebase</strong> etc who provide the same functionality with more features and at the same time they’re cross platform.</p><p>Being an <strong>Indie developer</strong> I also had the same thoughts on using Parse so that I can develop an Android version of my app too. That gate is always open. But the one thing that always held me back on using CloudKit was the <strong>“no sign in feature”</strong>. Apple users most of the time have signed up for iCloud on their devices using their Apple ID and so if you use CloudKit there’s no need to authenticate the user again.</p><p>So, yes that’s the one thing that makes a huge difference for the user. It feels like the user is using just another app belonging to iOS like Notes, Reminders etc. And so it increases it’s chances of being used. User feels at home and so we as developers must take the responsibility to keep users first in anything we develop because that is what we do and that is what we live for. We want to delight our users with the stuff we make by sacrificing our time, so that we can contribute in making their life easier.</p><p>And so I decided to go with <strong>CloudKit</strong>. The first hurdle I faced was sync. CloudKit allows us to transfer data between our app and the CloudKit Servers. That’s it. Its the developer’s responsibility to provide the local cache and sync support. I had worked on <strong>CoreData</strong> a lot and to be honest I loved it. Every developer knows that CoreData comes with its own complications but at the same time most of them do agree that 90% of the time its the answer for your app.</p><h3>The birth of CKSIncrementalStore</h3><p><a href="https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/CoreData/cdProgrammingGuide.html"><strong>CoreData</strong></a> is a great ORM. Lucky me ! I had read <a href="http://nshipster.com/"><strong>NSHipster’s</strong></a> <a href="http://nshipster.com/nsincrementalstore/">article</a> on <a href="https://developer.apple.com/library/prerelease/ios/documentation/CoreData/Reference/NSIncrementalStore_Class/index.html"><strong>NSIncrementalStore</strong></a>. The class that allows to plugin any store type to CoreData by just subclassing and overriding a few methods (Well, its not that easy though). So I went on and wrote the <strong>CKSIncrementalStore</strong>.</p><p><strong>CKSIncrementalStore</strong> manages its own private <a href="https://developer.apple.com/library/mac/documentation/Cocoa/Reference/CoreDataFramework/Classes/NSPersistentStoreCoordinator_Class/"><strong>NSPersistentStoreCoordinator</strong></a> which has an <strong>Sqlite</strong> store type added to it. It fulfills all the data requests from the sqlite store, while at the same time, keeping it in sync with the data on the <strong>CloudKit servers</strong>. So any time a record gets <strong>added</strong> , <strong>removed</strong> or <strong>modified</strong>, the changes are propagated to the CloudKit servers and the changes on the servers are committed back to the Sqlite store. CKSIncrementalStore lets you know when it starts and finishes syncing, by throwing two notifications. You can observe them in code and refresh your objects when it finishes.</p><h4>Conflict Resolution</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/254/1*HZ4MPTD4srwYXDhzMG6-lA.jpeg" /></figure><p>Where there is sync there are conflicts and where there are conflicts there is CKSIncrementalStore to save you from its inflicted wrath.</p><p>CKSIncrementalStore supports Sync conflict resolution policies out of the box.</p><h4>Seeing is believing</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/715/1*GPLGOhJgP5WAOMb8awKwOw.gif" /></figure><blockquote><strong>Update</strong> : CKSIncrementalStore has been merged into a new framework called <strong>Seam</strong>. Please check out the new framework on <a href="https://github.com/nofelmahmood/Seam"><strong>Github</strong></a> for detailed info.</blockquote><p>So now go on and power your apps with CloudKit reusing the knowledge you already have of CoreData and amaze your users with what you build.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9c7806d76230" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>