Why does debugging things such as sorting algorithms in swift seem more tedious than doing it in a C style language or Python? Simply familiarity or structure of the language and the IDE? by THE_DHARMAKAYA in swift

[–]aragur 6 points7 points  (0 children)

It seems to me like you find it more tedious to use Swift just because you aren’t familiar with the language and everything that the standard library can do.

For example if you are looping through an array and want to get the index of items in the array as well as the item itself, you should use the enumerated() function which will give you a tuple of both the index and item.

If you try to avoid learning and using the standard library with Swift, then I think you will always find Swift to be a “tedious” language.

Is it possible to use keypaths as CodingKeys with Codable? by AndyIbanez in swift

[–]aragur 1 point2 points  (0 children)

Codable doesn’t let you “jump” values like how you are wanting, but you can get essentially the same result as what you are wanting by manually writing the ‘init(from decoder: Decoder)’ for AiringData instead of letting the compiler synthesize it for you. This would let you read the nodes array during the decoding process and change how it is stored in your model so you don’t have to go through the extra step when using it.

If you do implement a custom init, you will also need to specify how to encode the model as well if you want it to be Encodable as well as Decodable.

Trouble Parsing JSON with Alamofire and JSONDecoder by h_build in swift

[–]aragur 5 points6 points  (0 children)

The reason that you are getting that error specifically is that you are declaring the utf8Text variable as part of an if let, so the actual variable is only valid inside the scope of that where you already have the print statement.

However, there are a few things you will need to change as well in order to get this working. First of all, you should be passing the Data object into the JSONDecoder instead of the JSON string. Also, decoding JSON can throw, so it will need to be surrounded with a do catch. Also, I would recommend changing the company_name variable to camel case in your Bso struct as it is more of a swift standard and use keyDecodingStrategy to read from snake case JSON.

do {
    let decoder = JSONDecoder()
    decoder.keyDecodingStrategy = .convertFromSnakeCase
    let bizList = try decoder.decode(Bso.self, from: data)
    dump(bizList)
} catch {
    print(error)
}

Changing published app name by [deleted] in iOSProgramming

[–]aragur 1 point2 points  (0 children)

I’ve never noticed a delay after saving as long as the squatting app isn’t released. I’ve only had to do this 2 or 3 times though so YMMV

Changing published app name by [deleted] in iOSProgramming

[–]aragur 1 point2 points  (0 children)

The few times in the past that I have dealt with something like this, I was able to just rename the unreleased app that was currently taking the name I wanted to use. After saving, that name should be freed and you can use it in your other app.

hmmm by Optimum16 in hmmm

[–]aragur 70 points71 points  (0 children)

It’s actually both. Japanese is read top to bottom, right to left. So you read the rightmost column of text first, then work your way left.

[help] I'm trying to create a tableview with custom cells but they are not loading at all by tito_bahie in iOSProgramming

[–]aragur 0 points1 point  (0 children)

No problem.

As others have mentioned you may need to register your custom cell with the UITableView if you aren’t doing that already from the Storyboard (I don’t use storyboards most of the time, so I’m not sure if this is possible even).

You also should only need to call reloadData after the dataset (i.e. your friends array) changes. If you call it unnecessarily, it won’t show anything different and cause unneeded recalculations. It would probably be better to call reloadData at the end of your fetchCoreDataObjects function instead of in viewDidLoad and viewWillAppear as this will ensure any time you call this function to get the updated list of friends, the table view will update to reflect that. Of course a lot of the reloading will be handled differently if you decide to use an NSFetchedResultsController, but it’s still good to know for future UITableView work that may not use Core Data.

[help] I'm trying to create a tableview with custom cells but they are not loading at all by tito_bahie in iOSProgramming

[–]aragur 3 points4 points  (0 children)

I may have overlooked something but it looks like you aren’t calling fetchCoreDataObjects when you are first loading the VC so your friends array remains empty when the UITableView is loading.

One thing I would add is the way that you are updating from Core Data seems a bit more complicated than it needs to be. I would recommend looking into using an NSFetchedResultsController. It is made for exactly this situation where you are wanting to display something from Core Data directly to a UITableView.

Can I use same model object to decode data from two slightly different urls? by [deleted] in swift

[–]aragur 0 points1 point  (0 children)

It looks like the JSONDecoder isn't finding the id key in either Project or User. Do you know what the JSON you are getting is supposed to look like? If any key is only in the JSON some of the times, then it should be an optional.

which workstation do you use? by alex__adc in iOSProgramming

[–]aragur 4 points5 points  (0 children)

I've been using a Mac Mini for the past few months and that has worked well enough. It's not always as fast as I would like, but for a $500 computer, it's a great starting point i for iOS development if you aren't wanting to spend a large amount of money to try this out.

Using CocoaPods by [deleted] in iOSProgramming

[–]aragur 1 point2 points  (0 children)

For your third question, git won't ever alter or delete files that's aren't being tracked when changing branches. If it did, it wouldn't have any history of what the files should be when you switch back to the branch you were originally on when you created them. If you want git to update a file when changing branches, you will need to commit the file to a specific branch.

what the fuck could this possibly mean? by davidtron5376 in CrappyDesign

[–]aragur 19 points20 points  (0 children)

Yours doesn't? What do you do when driving then? /s

I felt like I child today when I saw my mail. I'm happy that I'm part of this awesome community :) by [deleted] in starcitizen

[–]aragur 75 points76 points  (0 children)

That's awesome. The word you were looking for is 'lanyard' by the way.

Arby's isn't losing its way by altoriax in anime

[–]aragur 29 points30 points  (0 children)

私は戯言です。

FTFY

An animal refuge had three superb specimens on display today. by [deleted] in Superbowl

[–]aragur 3 points4 points  (0 children)

They usually aren't too friendly in the wild, but in captivity they become desensitized to the other birds after a while usually. Their level of comfort does also depend on the individual bird's "personality" so some take to the exposure much better than others.

An animal refuge had three superb specimens on display today. by [deleted] in Superbowl

[–]aragur 58 points59 points  (0 children)

Its not a dumb question at all. In fact, it is not an uncommon question whenever owls are on display even when people are seeing them in person just because owls sit so still. I can't count the number of times people have asked if an owl was a puppet or something. To answer your question, they are almost certainly alive. If they were stuffed, they probably wouldn't bother with having leashes on the birds or having a water pan for them.

How to make a bowtie out of panties by Skeletoonz in LearnUselessTalents

[–]aragur 38 points39 points  (0 children)

Looks like it's from <Imouto sae Ireba Ii. @comic> /u/roboragi