Posts

Post marked as solved
3 Replies
2.2k Views
Hi, So I have been recently work on some research for a Health Care application where HIPPA compliance is a requirement. I had done research into FireBase and that seemed good, but as of May 2018 it is not HIPPA compliant. I was looking around and Apple CloudKit seems like a good option, however I could not find any information from Apple's developer pages about CloudKit on whether it was HIPPA compliant or not?
Posted
by mkhan094.
Last updated
.
Post not yet marked as solved
10 Replies
7.6k Views
I'm working on parsing a JSON file into a dictionary: // JSON Payload File { "orderPlaced": "done", "prep": "pending", "shipped" : "pending" }Here is my code to make a dictionary from that file: if let path = Bundle.main.path(forResource: "JSONPayload", ofType: "json") { do { // Data from JSON file path let data = try Data(contentsOf: URL(fileURLWithPath: path), options: []) // JSON dicrtionary being made let json = try JSONSerialization.jsonObject(with: data) as! [String: Any] print(json) } catch let jsonErr { print("err", jsonErr) }Expected output: ["orderPlaced": done, "prep": pending, "shipped": pending]The actual output is: ["shipped": pending, "orderPlaced": done, "prep": pending]Is there a way I can re-order my dictionary or have it ordered from the start. I'm assuming the latter request might not be doable since dictionaires from my understanding are un-ordered. Maybe the only thing I can do is re-order after the dictionary is made, but how would i do that? Do I have to modify my JSON file and the Swift code or just one or ther other?
Posted
by mkhan094.
Last updated
.
Post marked as solved
2 Replies
2.7k Views
Hi,Does anyone know how to add images inline in a post. Sometimes I have a question and it is best explained with accompanying text and an image or screenshot. Do Apple Developer Forums even support images... if so, @AppleDeveloperForums... please add this feature.. Thanks!
Posted
by mkhan094.
Last updated
.
Post not yet marked as solved
2 Replies
1.8k Views
Hi,Working on a simple problem where I want to sum all the elements in an int array. All the numbers in the array are positive. I came accross the reduce method online and I noticed the following syntax:let items = [2, 4, 5, 7] let sum = items.reduce(0, +) // result is 18I understand that the first argument is the initial result (in my case 0). I'm having a hard time understand the nextPartialResult closure which is the second argument. I also don't understand the "+" syntax, I'm guessing that shorthand for summing all the elements in the array. I don't want to just use that code without understanding what it means...Any help would be appreciated!Thanks!
Posted
by mkhan094.
Last updated
.
Post marked as solved
4 Replies
7.5k Views
I had a question about the $0 syntax in Swift. Haven't had a chance to use it much, however, I am working with things like filter, flatmap, and compactmap, so I see them more often. Any documentation reference or resources on these topics would be super helpful in understanding!Thanks!
Posted
by mkhan094.
Last updated
.
Post not yet marked as solved
4 Replies
2.8k Views
Hi,I'm working on a project where I have tabular data provided in an excel file (.xlsx). I am trying to figure out how to bring in or model that data in Swift so I can query a specific row and column combination. I had a couple of thoughts on this:1. Use a third party library like CoreXLSX to read the data directly from the excel file2. I found Apple's MLDataTable API pretty interesting. Can this be used for non machine learning tasks? From the documentation, it looks like its use-case is for machine learning rather than being a general purpose data table class?Thanks!
Posted
by mkhan094.
Last updated
.
Post not yet marked as solved
1 Replies
1.9k Views
I am working on building a color wheel picker UI for an iOS app. While there are several great Color Wheels that the developer community has written, I am actually trying to build a Color Wheel from scratch to understand how these color wheels and UIs are made. One of the first things is figuring out how to convert HSB values to RGB. I made a quick Swift Playground to get started:// ColorExperiments Playground import UIKit // A HSB color where: // H = 5 degrees out of 360 degrees // S = 91% -> 0.91 // B = 100% -> 1.0 var hueColor = UIColor.init(hue: 5/360, saturation: 0.91, brightness: 1.0, alpha: 1.0) // The RGB equivalent should be // R = 255 // G = 42 // B = 23I tried looking into the UIKit documentation and online, maybe I missed it, but is there an API in UIColor that allows me to convert the HSB to RGB color? I found some third party functions. I'm guessing UIColor should have something since the Swift Playgrounds sidebar shows me the my hueColor variable as the RGB equivalent unless that's some private function that Apple is using.Thanks!
Posted
by mkhan094.
Last updated
.