From time to time I discover a new way of coding something that significantly improves readability & minimizes how much I need to code. Here’s one of such latest discoveries. Typically to find a value in an array (or in an array of dictionaries) with a specific condition I would do a for loop with […]
Tag Archives: array
Sorting Multi Dimensional Array (Swift 3)
Hello all, This one I’ve found specially useful when working with Core Data fetched arrays. Let’s say that we want to sort the result of a fetch request based on the value of the field “gold”, we would therefore do the following: let dwarfGoldBags = … //Contains the result of a fetch request with one of the […]
Easy Core Data CSV Exporter in Swift
A new app I’m working on has a Core Data back end and I wanted to implement a quick way to export all the entities into a CSV file and dump it into the Desktop. Here are the snippets to do it: 1. Make sure you get the NSObjects you want to export (in this case […]