<?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[ThPint - Medium]]></title>
        <description><![CDATA[A group of developers ready to make big stuffs! - Medium]]></description>
        <link>https://medium.com/thpintgroup?source=rss----66ccac9b7b6c---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>ThPint - Medium</title>
            <link>https://medium.com/thpintgroup?source=rss----66ccac9b7b6c---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 22:58:43 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/thpintgroup" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Read, update and delete data with CoreData]]></title>
            <link>https://medium.com/thpintgroup/read-update-and-delete-data-with-coredata-d1b17e62addf?source=rss----66ccac9b7b6c---4</link>
            <guid isPermaLink="false">https://medium.com/p/d1b17e62addf</guid>
            <category><![CDATA[nsobject]]></category>
            <category><![CDATA[database]]></category>
            <category><![CDATA[core-data]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[swift]]></category>
            <dc:creator><![CDATA[Mattia Cardone]]></dc:creator>
            <pubDate>Mon, 17 Oct 2022 07:10:31 GMT</pubDate>
            <atom:updated>2022-10-17T07:13:14.604Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*H50H7p8PHQUvf-79EG7B2g.jpeg" /></figure><p>Core Data is used to save your application’s permanent data for offline use, to cache temporary data, and to add undo functionality to your app on a single device. To sync data across multiple devices in a single iCloud account, Core Data automatically mirrors your schema to a CloudKit container. This article will explain how to save, update and delete with CoreData.</p><p>To use CoreData when you create a project, you have to select “Use Core Data”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/732/1*wPl_YAEwOVi_PDFpdxbpLA.png" /></figure><p>When the project is created, see in your project navigator. There will be the Core data database with the same name of the project like in the figure below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/510/1*sG-uiPmz6XgevsGQ3p1JfQ.png" /></figure><p>Click on it. It is time to add a new entity or add the attributes to your entity. In this project i will save three strings and one Image. The type of image in core data is “Binary Data”. So after added the attributes, we will have a situation like this :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/518/1*28LoG6X_lEiCV4Q0WISiZA.png" /></figure><p>Now we are ready to create the right functions to save, update and delete from core data.</p><p>To have a clean code, create a new swift file “CoreDataManager” that contain all the functions we need. First create a struct that rapresents our Entity(in this case, “EventiEntity”).</p><pre><strong>struct</strong> EventsItem {</pre><pre><strong>       var</strong> title:String?</pre><pre><strong>       var</strong> description:String?</pre><pre><strong>       var</strong> imagine: Data?</pre><pre><strong>       var</strong> url: String?<br>}</pre><p>Now, add a class “CoreDataManager” which implements NSObject. NSObject is the base class for most Objective-C objects. In Swift you would inherit from it if you want your Swift object to be an Objective-C object (with all the advantages and drawbacks that implies), but don’t have a more specific Objective-C object in mind.</p><p>Then we add a function to get the context. The class will return a type “NSManagedObjectContext”(A context consists of a group of related model objects that represent an internally consistent view of one or more persistent stores. In fact, NSManagedObjectContext is an object space to manipulate and track changes to managed objects) that rapresents our context. So the class looks like this :</p><pre><strong>class</strong> CoreDataManager: NSObject {</pre><pre><strong>   private</strong> <strong>class</strong> <strong>func</strong> getContext() -&gt; NSManagedObjectContext {</pre><pre><strong>     let</strong> appDelegate = UIApplication.shared.delegate <strong>as</strong>! AppDelegate</pre><pre><strong>     return</strong> appDelegate.persistentContainer.viewContext</pre><pre>   }</pre><pre>}</pre><p>Now, we can create the save function. So, create a class function with 4 parameters : 3 types will be Strings and one Data(It is possible cast an UIImage to Data, so we can use both of them as parameter).</p><pre><strong>class</strong> <strong>func</strong> storeObj(title:String,description:String, img: Data, url: String) {</pre><pre><strong>let</strong> context = getContext()</pre><pre><strong>let</strong> entity = NSEntityDescription.entity(forEntityName: &quot;EventiEntity&quot;, in: context)</pre><pre><strong>let</strong> managedObj = NSManagedObject(entity: entity!, insertInto: context)</pre><pre>managedObj.setValue(title, forKey: &quot;nomeEvento&quot;)</pre><pre>managedObj.setValue(description, forKey: &quot;descrizioneEvento&quot;)</pre><pre>managedObj.setValue(img, forKey: &quot;imagineEvento&quot;)</pre><pre>managedObj.setValue(url, forKey: &quot;urlEvento&quot;)</pre><pre><strong>do</strong> {</pre><pre><strong>try</strong> context.save()</pre><pre>print(&quot;saved!&quot;)</pre><pre>} <strong>catch</strong> {</pre><pre>print(error.localizedDescription)</pre><pre>}</pre><pre>}</pre><p><strong>NB</strong>. A “class func” is called on the type itself, while just “func” is called on the instance of that type.</p><p>We have done ! The save function is ready to use. Now fetch our objects.</p><p>Pay attention : create the right function for you. If you have to fetch all objects of the database you will need no parameters. Even if you have to fetch an object through the name or something else, you have to add a parameter. In this tutorial i will create a function with two optional parameters. The first one is an Int to decide which attribute to search for, the second one is a string that represents the string to find. Clearly, the function must return an Array of our struct. The parameters are optional, so if you don’t use them, you will fetch all the objects.</p><pre><strong>class</strong> <strong>func</strong> fetchObj(selectedScopeIdx:Int?=<strong>nil</strong>,targetText:String?=<strong>nil</strong>) -&gt; [EventsItem]{</pre><pre><strong>var</strong> aray = [EventsItem]()</pre><pre><strong>let</strong> fetchRequest:NSFetchRequest&lt;EventiEntity&gt; = EventiEntity.fetchRequest()</pre><pre><strong>if</strong> selectedScopeIdx != <strong>nil</strong> &amp;&amp; targetText != <strong>nil</strong>{</pre><pre><strong>var</strong> filterKeyword = &quot;&quot;</pre><pre><strong>switch</strong> selectedScopeIdx! {</pre><pre><strong>case</strong> 0:</pre><pre>filterKeyword = &quot;urlEvento&quot;</pre><pre><strong>case</strong> 1:</pre><pre>filterKeyword = &quot;descrizioneEvento&quot;</pre><pre><strong>default</strong>:</pre><pre>filterKeyword = &quot;titoloEvento&quot;</pre><pre>}</pre><pre><strong>var</strong> predicate = NSPredicate(format: &quot;\(filterKeyword) contains[c] %@&quot;, targetText!)</pre><pre>fetchRequest.predicate = predicate</pre><pre>}</pre><pre><strong>do</strong> {</pre><pre><strong>let</strong> fetchResult = <strong>try</strong> getContext().fetch(fetchRequest)</pre><pre><strong>for</strong> item <strong>in</strong> fetchResult {</pre><pre><strong>let</strong> rem = EventsItem(title: item.nomeEvento!, description: item.descrizioneEvento!, imagine: item.value(forKey: &quot;imagineEvento&quot;)! <strong>as</strong>! Data, url: item.urlEvento ?? &quot;&quot;)</pre><pre>aray.append(rem)</pre><pre>print(&quot;titolo:&quot;+rem.title!+&quot;\n descrizione:&quot;+rem.description!+&quot;\n url:&quot; + rem.url!)</pre><pre>}</pre><pre>}<strong>catch</strong> {</pre><pre>print(error.localizedDescription)</pre><pre>}</pre><pre><strong>return</strong> aray</pre><pre>}</pre><p>To fetch the right object in this function we’ve to set the NSFetchRequest’s predicate :</p><pre><strong>let</strong> fetchRequest =</pre><pre>NSFetchRequest&lt;NSManagedObject&gt;(entityName: &quot;EventiEntity&quot;)</pre><pre>fetchRequest.returnsObjectsAsFaults = <strong>false</strong></pre><pre>fetchRequest.predicate = NSPredicate(format: &quot;\(filterKeyword) contains[c] %@&quot;, targetText!)</pre><pre><strong>let</strong> result = <strong>try</strong>? context.fetch(fetchRequest)</pre><p>A definition of logical conditions for constraining a search for a fetch or for in-memory filtering. This is the definition of “NSPredicate”. The format is literally how it has to search; in this case, we are searching through a String, so we use “%@”. (For example, if we searched through an id, an integer, we should use “%d”).</p><p>Go to Update Function. To do this we have to find an object(in this case through the name of the event) and then update the data. In this case we have five parameters, because we have also a string that rapresents the name of the event with whom we find the row to modify(we will use the NSPredicate like before).</p><pre><strong>class</strong> <strong>func</strong> UpdateObj(nomeVecchio:String,nomeNuovo: String, descrizione:String, img: Data, url: String) {</pre><pre><strong>let</strong> context = CoreDataManager.getContext()</pre><pre><strong>let</strong> fetchRequest =</pre><pre>NSFetchRequest&lt;NSManagedObject&gt;(entityName: &quot;EventiEntity&quot;)</pre><pre>fetchRequest.returnsObjectsAsFaults = <strong>false</strong></pre><pre>fetchRequest.predicate = NSPredicate(format:&quot;nomeEvento == %@&quot;,nomeVecchio)</pre><pre><strong>let</strong> result = <strong>try</strong>? context.fetch(fetchRequest)</pre><pre><strong>if</strong> result?.count == 1 {</pre><pre><strong>          let</strong> dic = result![0]</pre><pre>          dic.setValue(nomeNuovo, forKey: &quot;nomeEvento&quot;)</pre><pre>          dic.setValue(descrizione, forKey: &quot;descrizioneEvento&quot;)</pre><pre>          dic.setValue(img, forKey: &quot;imagineEvento&quot;)</pre><pre>          dic.setValue(url, forKey: &quot;urlEvento&quot;)</pre><pre><strong>          do</strong> {</pre><pre><strong>             try</strong> context.save()</pre><pre>             print(&quot;saved!&quot;)</pre><pre>            } <strong>catch</strong> {</pre><pre>          print(error.localizedDescription)</pre><pre>      }</pre><pre>   }</pre><pre>}</pre><p>Finally, we arrived at delete function. Let’s see how to create it.</p><pre><strong>class</strong> <strong>func</strong> deleteItemWithIndex(titolo: String) {</pre><pre><strong>let</strong> context = getContext()</pre><pre><strong>let</strong> coord   = context.persistentStoreCoordinator</pre><pre><strong>let</strong> fetchRequest = NSFetchRequest&lt;NSFetchRequestResult&gt;(entityName: &quot;EventiEntity&quot;)</pre><pre>//Here is the field on which u need to chk which record u want to delete just pass here in value ( acutal value) unique key = field in coredata</pre><pre><strong>let</strong> predicate = NSPredicate(format: &quot;nomeEvento == %@&quot;, titolo)</pre><pre>fetchRequest.predicate = predicate</pre><pre><strong>let</strong> deleteRequest = NSBatchDeleteRequest(fetchRequest: fetchRequest)</pre><pre><strong>do</strong> {</pre><pre><strong>try</strong> coord!.execute(deleteRequest, with: context)</pre><pre>}</pre><pre><strong>catch</strong> {</pre><pre>print(error.localizedDescription)</pre><pre>}</pre><pre>}</pre><p>In this case, we use the NSPredicate to find the object to delete. Then we use a NSBatchDeleteRequest(A request that deletes objects in the SQLite persistent store without loading them into memory.) with our fetchRequest to delete it.</p><p><strong>NB</strong>. If you want clean all the database, you can use :</p><pre><strong>class</strong> <strong>func</strong> cleanCoreData() {</pre><pre><strong>let</strong> fetchRequest:NSFetchRequest&lt;EventiEntity&gt; = EventiEntity.fetchRequest()</pre><pre><strong>let</strong> deleteRequest = NSBatchDeleteRequest(fetchRequest: fetchRequest <strong>as</strong>! NSFetchRequest&lt;NSFetchRequestResult&gt;)</pre><pre><strong>do</strong> {</pre><pre>print(&quot;deleting all contents&quot;)</pre><pre><strong>try</strong> getContext().execute(deleteRequest)</pre><pre>}<strong>catch</strong> {</pre><pre>print(error.localizedDescription)</pre><pre>}</pre><pre>}</pre><p>That’s it. Now you can manage your data.</p><p>References :</p><p><a href="https://developer.apple.com/documentation/coredata">Core Data | Apple Developer Documentation</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d1b17e62addf" width="1" height="1" alt=""><hr><p><a href="https://medium.com/thpintgroup/read-update-and-delete-data-with-coredata-d1b17e62addf">Read, update and delete data with CoreData</a> was originally published in <a href="https://medium.com/thpintgroup">ThPint</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Take data from a local file.json and display it in a Collection view]]></title>
            <link>https://medium.com/thpintgroup/take-data-from-a-local-file-json-and-display-it-in-a-collection-view-ca6760f2ea9b?source=rss----66ccac9b7b6c---4</link>
            <guid isPermaLink="false">https://medium.com/p/ca6760f2ea9b</guid>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[codable]]></category>
            <category><![CDATA[collectionview]]></category>
            <category><![CDATA[json]]></category>
            <dc:creator><![CDATA[Mattia Cardone]]></dc:creator>
            <pubDate>Fri, 05 Mar 2021 12:15:29 GMT</pubDate>
            <atom:updated>2021-02-26T01:28:04.784Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JxjbysaQHi7-vJ5eQFbiJA.jpeg" /></figure><p>This is a tutorial to take data from a local file.json and fill a collection view with it.</p><p>JSON, an acronym for JavaScript Object Notation, is an open standard file format. It is used for the exchange of data between client/server applications, using human-readable text to store and transmit data objects consisting of attribute-value pairs and array data types. The JSON is the file format most used in data transmission.</p><p>If your app communicates with a web application, information returned from the server is often formatted as <a href="http://www.json.org/">JSON</a>. You can use the Foundation framework’s <a href="https://developer.apple.com/reference/foundation/nsjsonserialization">JSONSerialization</a> class to convert JSON into Swift data types like Dictionary, Array, String, Number, and Bool. However, because you can’t be sure of the structure or values of JSON your app receives, it can be challenging to deserialize model objects correctly.</p><p>Well, let’s start the tutorial!</p><p>First create an app project with storyboard. Drag and drop in the project your json file and look the structure of it(it is very important, because we will create a struct with the same structure).</p><pre><em>[<br>{<br>“Strain”: “100-Og”,</em></pre><pre><em>“Type”: “hybrid”,</em></pre><pre><em>“Rating”: 4,</em></pre><pre><em>“Effects”: “Creative,Energetic,Tingly,Euphoric,Relaxed”,</em></pre><pre><em>“Flavor”: “Earthy,Sweet,Citrus”,</em></pre><pre><em>“Description”: “$100 OG is a 50/50 hybrid strain that packs a strong punch. The name supposedly refers to both its strength and high price when it first started showing up in Hollywood. As a plant, $100 OG tends to produce large dark green buds with few stems. Users report a strong body effect of an indica for pain relief with the more alert, cerebral feeling thanks to its sativa side.”</em></pre><pre><em>},</em></pre><pre><em>...]</em></pre><p>As you can see, you have 6 attributes( five Strings, one decimal), so your struct will be like this :</p><pre><strong>struct</strong> Cannabis : Codable {</pre><pre><strong>let</strong> Strain : String</pre><pre><strong>let</strong> `Type` : String</pre><pre><strong>let</strong> Rating : Decimal</pre><pre><strong>let</strong> Effects : String</pre><pre><strong>let</strong> Flavor : String</pre><pre><strong>let</strong> Description : String</pre><pre>}</pre><p><strong>NB : Pay attention! You have an array of this struct.</strong></p><p>The struct has to be Codable. What is the word “Codable” ? It is a type that can convert itself into and out of an external representation(in our case, the representation is the json). So, defining this struct “Codable” allow us to automatically synthesize the code required to encode or decode an instance of that type.</p><p>Then open the storyboard and create a CollectionViewController. Customize your collectionView like you want, and add the object that you want to display in it. In this case, I created an collectionView with a static image and two labels, one for the string “Strain”, one for the “Type”. The Cell will look like the follow picture.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/928/1*zoFCq8c8JaM-OWVAPW289Q.png" /></figure><p>Remember of connect the SourceData and the Delegate of the collectionView to the view. Create one swift file for the cell, set the StrainCell.swift as the class of the cell in the “Identity Inspector” and connect the labels to the StrainCell.swift.</p><pre><strong>import</strong> UIKit</pre><pre><strong>class</strong> StrainCell: UICollectionViewCell {</pre><pre><strong>@IBOutlet</strong> <strong>weak</strong> <strong>var</strong> strainLabel: UILabel!</pre><pre><strong>@IBOutlet</strong> <strong>weak</strong> <strong>var</strong> typeLabel: UILabel!</pre><pre><strong>@IBOutlet</strong> <strong>weak</strong> <strong>var</strong> weedImage: UIImageView!</pre><pre>}</pre><p>Now we have to create the DataLoaderClass in which we will decode our file.json and fill an array of the struct created before. So create an array of “Cannabis”.</p><pre><strong>public</strong> <strong>class</strong> DataLoader {</pre><pre>@Published <strong>var</strong> userData = [Cannabis]()</pre><pre>}</pre><p>In this class we will add a function that take the data from the JSON.</p><pre><strong>public</strong> <strong>class</strong> DataLoader {</pre><pre><strong>var</strong> userData = [Cannabis]()</pre><pre><strong>init</strong>() {</pre><pre>load()</pre><pre>}</pre><pre><strong>func</strong> load() {</pre><pre><strong>if</strong> <strong>let</strong> fileLocation = Bundle.main.url(/service/forresource: &quot;cannabis&quot;, withExtension: &quot;json&quot;) {</pre><pre>// do catch in case of an error</pre><pre><strong>do</strong> {</pre><pre><strong>let</strong> data = <strong>try</strong> Data(contentsOf: fileLocation)</pre><pre><strong>let</strong> jsonDecoder = JSONDecoder()</pre><pre><strong>let</strong> dataFromJson = <strong>try</strong> jsonDecoder.decode([Cannabis].<strong>self</strong>, from: data)</pre><pre><strong>self</strong>.userData = dataFromJson</pre><pre>   } <strong>catch</strong> {</pre><pre>print(error)</pre><pre>        }</pre><pre>     }</pre><pre>  }</pre><pre>}</pre><p><strong>NB. <em>cannabis.json</em> is the name of the local file JSON.</strong></p><p>With this code we take the data and with it we fill the array userData. So we are ready to set up our collection view with this array.</p><pre><strong>class</strong> ViewController: UIViewController, UICollectionViewDataSource, UICollectionViewDelegate, UISearchBarDelegate {<br></pre><pre><strong>@IBOutlet</strong> <strong>weak</strong> <strong>var</strong> collectionView: UICollectionView!</pre><pre><strong>let</strong> strains = DataLoader().userData<br></pre><pre><strong>func</strong> collectionView(<strong>_</strong> collectionView: UICollectionView, numberOfItemsInSection section: Int) -&gt; Int {</pre><pre><strong>return</strong> strains.count-1</pre><pre>}<br></pre><pre><strong>func</strong> collectionView(<strong>_</strong> collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -&gt; UICollectionViewCell {</pre><pre><strong>let</strong> cell = collectionView.dequeueReusableCell(withReuseIdentifier: &quot;Cell&quot;, for: indexPath) <strong>as</strong>! StrainCell</pre><pre><br>//customizing the cell</pre><pre>cell.layer.borderWidth = 1</pre><pre>cell.layer.borderColor = UIColor.lightGray.cgColor</pre><pre>cell.layer.backgroundColor = UIColor.clear.cgColor</pre><pre>cell.layer.cornerRadius = 10</pre><pre>cell.layer.masksToBounds = <strong>false</strong></pre><pre>cell.layer.shadowColor = UIColor.black</pre><pre>.cgColor</pre><pre>cell.layer.shadowOpacity = 0.5</pre><pre>cell.layer.shadowOffset = CGSize(width: 0.0, height: 1.0)</pre><pre>cell.layer.shadowRadius = 4.0</pre><pre>cell.strainLabel.text = strains[indexPath.row].Strain</pre><pre>cell.typeLabel.font = UIFont.italicSystemFont(ofSize: 20.0)</pre><pre>cell.typeLabel.text = strains[indexPath.row].Type.uppercased()<br></pre><pre><strong>return</strong> cell</pre><pre>}<br></pre><pre><strong>override</strong> <strong>func</strong> viewDidLoad() {</pre><pre><strong>super</strong>.viewDidLoad()</pre><pre>collectionView.reloadData()</pre><pre>}<br></pre><pre>}</pre><p>Now we have a working Collection View with the right Data in the labels. To finish I added the cellDetails in another view in which I take also the other attributes of our struct for the selected row of the collection. So the important is pass in the correct way the indexPath of the selected row.</p><p>At this point, we have to create a new viewController in the storyboard and put in it six labels to retrieve the data. Connect the cell with the new controller. Return to the CollectionView.swift and add this override of the prepare function and a integer(where we save our indexPath).</p><pre><strong>var</strong> id: Int = 0</pre><pre><strong>override</strong> <strong>func</strong> prepare(for segue: UIStoryboardSegue, sender: <strong>Any</strong>?)</pre><pre>{</pre><pre>// Determine what the segue destination is</pre><pre><strong>if</strong> segue.destination <strong>is</strong> DetailsView</pre><pre>{</pre><pre><strong>let</strong> paths = collectionView?.indexPathsForSelectedItems</pre><pre><strong>let</strong> row = paths![0].row</pre><pre><strong>let</strong> vc = segue.destination <strong>as</strong>? DetailsView</pre><pre>vc!.id = 0</pre><pre>vc!.id = row</pre><pre>}</pre><p>Now create new swiftFile and call it DetailsView.swift. Assign this file to the new controller in the storyboard and connect the labels created before. Then modify the swift file like this :</p><pre><strong>import</strong> UIKit</pre><pre><strong>class</strong> DetailsView: UIViewController {</pre><pre><strong>var</strong> id: Int!</pre><pre><strong>@IBOutlet</strong> <strong>weak</strong> <strong>var</strong> flavorDetailLabel: UILabel!</pre><pre><strong>@IBOutlet</strong> <strong>weak</strong> <strong>var</strong> strainDetailLabel: UILabel!</pre><pre><strong>@IBOutlet</strong> <strong>weak</strong> <strong>var</strong> descriptionDetailLabel: UILabel!</pre><pre><strong>@IBOutlet</strong> <strong>weak</strong> <strong>var</strong> effectsDetailLabel: UILabel!</pre><pre><strong>@IBOutlet</strong> <strong>weak</strong> <strong>var</strong> typeDetailLabel: UILabel!</pre><pre><strong>override</strong> <strong>func</strong> viewDidLoad() {</pre><pre><strong>super</strong>.viewDidLoad()</pre><pre><strong>let</strong> storyboard = UIStoryboard(name: &quot;Main&quot;, bundle: <strong>nil</strong>)</pre><pre><strong>let</strong> secondVC = storyboard.instantiateViewController(withIdentifier: &quot;Collection&quot;)  <strong>as</strong>! ViewController</pre><pre>strainDetailLabel.text = secondVC.strains[id].Strain</pre><pre>descriptionDetailLabel.text = secondVC.strains[id].Description</pre><pre>typeDetailLabel.text = secondVC.strains[id].Type.uppercased()</pre><pre>effectsDetailLabel.text = secondVC.strains[id].Flavor</pre><pre>}</pre><p>That’s it ! We have finish !</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ca6760f2ea9b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/thpintgroup/take-data-from-a-local-file-json-and-display-it-in-a-collection-view-ca6760f2ea9b">Take data from a local file.json and display it in a Collection view</a> was originally published in <a href="https://medium.com/thpintgroup">ThPint</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>