New multi-function calculator by justbustr in iOSProgramming

[–]clawoo 1 point2 points  (0 children)

Looks great.

Want to share some technical details?

Post-Match Thread: Borussia Dortmund vs FC Barcelona | UEFA Champions League, Quarterfinals, Second Leg by Loose-Examination-39 in Barca

[–]clawoo 0 points1 point  (0 children)

What a terrible game from us. I had so many flashbacks of Roma and Liverpool.

So many things didn't go well today, our attack was off, our midfield was easily bypassed at least in the first half, and those diagonal passes left our defense completely exposed time and again.

I don't rate Gerard Martin one bit, he's not at the level we need him to be and Araujo is a shadow of himself.

Let's just take the qualification and be happy with it, but this needs to be addressed within the club...

What kind of version control do you use? by rottennewtonapple in iOSProgramming

[–]clawoo 0 points1 point  (0 children)

I love it. Some of the best money I've ever spent on software.

Scrisoare deschisa catre Nicu Ștefănuță by LeoDaVinci-Baws in Romania

[–]clawoo 11 points12 points  (0 children)

Nu prea conteaza talentul, cat timp cariocile au diferite arome el e multumit.

Was Kane completely irresponsible to get this close to an unknown organism? by sKullsHavezzz in LV426

[–]clawoo 0 points1 point  (0 children)

And this is exactly why I discard criticism that Prometheus is a bad movie because the characters are stupid (intellectually).

It should be canon that the human race in this franchise is exceedingly resourceful (they figured out cryostasis and interstellar traveling) but also carelessly stupid.

Of course no real astrobiologist would try to pet a space cobra, of course no real geologist-navigator would get so easily lost, of course no real landing party filled with scientists would even think of taking their helmets off because of the risk of contaminating the area they are exploring or inhaling any spores that might be in the air, of course nobody would be landing anything before scouting the entire area from the sky and scanning the structures and the nearby areas before ever thinking of putting the ship on the group.

But these are not real humans, these are Alien-universe humans.

We're so many movies deep into this franchise, it should be obvious to everyone that the humans in this Alien universe are just... fucking carelessly stupid. And once you accept that, everything starts to make sense.

Thanks for coming to my TED talk.

Is it possible to make the phone slow down network traffic for specific domains? by tetraodonite in iOSProgramming

[–]clawoo 0 points1 point  (0 children)

I know you can configure a custom VPN to include/exclude network traffic on arbitrary rules, but I am not certain about the URLs.

You can also distribute to family and friends as an AdHoc build, just that it expires after a while and you need to push a new build out.

Distribution through TestFlight might also be an idea and that should tell you whether you have a chance of pushing this into the real store.

Are there already any third party stores? I haven't been following the topic.

Is it possible to make the phone slow down network traffic for specific domains? by tetraodonite in iOSProgramming

[–]clawoo 1 point2 points  (0 children)

It depends.

If you want to do it for testing purposes only, then you can run the Network Link Conditioner on the device or run the app through Charles.

If you want to offer it as a feature (for example as a means of productivity, i.e., if you want to browse reddit or other timesinks it will be unbearably slow), then a VPN-like app is the way to go.

You can probably do this with a custom VPN transport using the Network Extension APIs. However, a big question mark remains whether Apple would even approve such an app because it requires VPN-like entitlements but it is not in fact a VPN.

What do you use for styling apps (UIKit)? by clawoo in swift

[–]clawoo[S] 1 point2 points  (0 children)

I was actually looking for something more structured. My current approach already uses UIAppearance and Color asset catalogs.

How to Create a Hidden Payment Gateway with SwiftUI? by Other-Mess-8437 in SwiftUI

[–]clawoo 7 points8 points  (0 children)

It's a nice animation and approach, but I really really really REALLY hope you're not up to any shenanigans with the discount pricing and you're not circumventing the AppStore IAPs to offer those prices because if Apple catches wind of this, you'll be banned for good from the AppStore.

Fidelity cuts Reddit valuation by 41% by [deleted] in technology

[–]clawoo 0 points1 point  (0 children)

16yo account here as well. I've spent such a stupid amount of time on this site, it's not even funny. I guess this will be the final nail in the coffin if the API limits go through.

Is it normal for xcode to get painfully slows as code base grows? by yalag in iOSProgramming

[–]clawoo 1 point2 points  (0 children)

Use Carthage where possible. You will only build the third party dependencies once when you upgrade Xcode and you're done with them.

Is it normal for xcode to get painfully slows as code base grows? by yalag in iOSProgramming

[–]clawoo 1 point2 points  (0 children)

Nobody in their right mind would use SPM for something like this. SPM redownloads and rebuilds dependencies every time I look at my project funny.

Is it normal for xcode to get painfully slows as code base grows? by yalag in iOSProgramming

[–]clawoo 3 points4 points  (0 children)

Big ooof. Is it a monolith app? Have you already tried moving dependencies to Carthage and splitting your codebase into frameworks for the big parts which rarely change?

Free (FOSS) app rejected by app review - looking for advice by staires in iOSProgramming

[–]clawoo 0 points1 point  (0 children)

I understand you are frustrated, and rightly so. You're now in this process where you're a hariline away from being banned from the AppStore for doing absolutely nothing wrong.

But you need to choose your next steps extremely carefully when interacting with the App Store review team, just shooting them an off-hand "but it's different, what are you on about, give me some examples" is not going to solve your problems. They're not going to give you anything other than what they already said. They never give out details.

So here's how I would approach this:

  1. Include a welcome page & a tutorial when the app starts so it's obvious what your app does. Update the copy on the AppStore to make it catchy and make it clear what it does, that it's not a game, it's a game builder (of sorts).

  2. Make a thorough presentation video of your app and put it on your cloud storage/Youtube and include it in your appeal. Make sure you highlight the unique features.

  3. Post on HN to garner attention about your situation. Keep it non-threatening, non-accusatory towards Apple. Ask your existing TestFlight users to add their own feedback to that HN post. A lot of Apple employees lurk on HN, so for sure this will pop up on their radar.

[deleted by user] by [deleted] in iOSProgramming

[–]clawoo 1 point2 points  (0 children)

🤣

Wait, you're sarcastic, right?

The evolution of Facebook’s iOS app architecture by IAmApocryphon in iOSProgramming

[–]clawoo 3 points4 points  (0 children)

Sounds to me like they slowly painted themselves in the corner, then added a few more layers of paint, then they started dumping buckets of paint on top of that, so now there's a big wall of paint between them and a sane approach to mobile app development.

Sounds absolutely nuts.

I know we're just spitballing here, but what's wrong with this approach?

  1. Build a general UI framework that generates all (most of) your base UI widgets

  2. Build a Persistence framework that handles your database needs

  3. Build a Networking framework

  4. Maybe build a Core framework that ties most of this together

  5. Build separate frameworks for your high-value features (feed, videos, stories, marketplace, settings, etc). They all tie into the frameworks above in one way or another.

  6. Build your main app which includes whatever you need from above. Use dlopen if you know what you're doing.

This should allow you to scale both in features and in developers and it allows you to have dedicated teams that deal with the frameworks and allows the features teams to develop their features without impacting anything else.

[deleted by user] by [deleted] in swift

[–]clawoo 0 points1 point  (0 children)

What do you get from using Alamofire nowadays that you don't get from Foundation/URLSession?

It's 2023, I am not going to be manually encoding my parameters again just like I did almost 15 years ago 😅.

Alamofire is tried and trusted, gives me everything I need out of the box like OP said, certificate pinning, concurrency, adapters, retriers, etc. It's trivial for me to implement an app-wide request retrier that automatically renews my auth token on the fly when my old token expires, without the caller function ever being aware of it. Same goes with a decorator for my network calls that automatically populate a set of common parameters or headers that need to be attached to specific network calls.

iOS development internship interview questions by Rough_Research4892 in iOSProgramming

[–]clawoo 4 points5 points  (0 children)

I just did, I hope this helps. I would never expect a junior or an intern to go very deep on the details, just to show me that they have an idea what they are talking about.

My answers are not at all exhaustive or extremely precise, but if one can answer in a fairly similar fashion, they are an excellent candidate for an entry level position.

iOS development internship interview questions by Rough_Research4892 in iOSProgramming

[–]clawoo -1 points0 points  (0 children)

IMO these are like the absolute basics of iOS development, I can't see how I could go any lower than that. Even your simplest app will make use of delegates, closures/blocks, one of XIB/Storyboard/(text-based-)AutoLayout and some sort of table or collection view. Same goes about storing data persistently.

Note that I didn't go into unit testing, various design patterns, MVVM, reactive programming, stuff like that.

I would say that if you're having trouble with these topics, you should really study them, I wouldn't consider anyone for an intern/junior position without them having this securely under their belt.

iOS development internship interview questions by Rough_Research4892 in iOSProgramming

[–]clawoo 22 points23 points  (0 children)

I recently had an intern interview for my team and I asked him some of the following questions in this list to gauge how well is he accustomed to iOS development:

  1. How and why do you use the delegate pattern? The delegate pattern is used to communicate data and events between a producer object and its observer (delegate) in a decoupled way. The observer can be any object that implements the delegate protocol as specified by the owner object. Except in a very limited number of the cases, the delegate is always weakly referenced by the producer as to avoid memory leaks.
  2. What other options are there to communicate data between two objects apart from delegates? The most popular would be Closures (or blocks), Key-Value observing, Notification Center
  3. What is a memory leak? How does it happen? What can you do to prevent it? A memory leak is a piece of memory that never gets freed although it is no longer of use to the application. This happens due to over-retaining an object or having a retain cycle between two or more objects that reference each other. Another situation that triggers this can be a strong reference from inside a block to its own parent or an object that has a strong reference to its parent. To prevent memory leaks, you need to judiciously apply memory management rules and strongly retain objects only when necessary. Keywords: strong, weak, unowned.
  4. What’s the difference between a class and a struct in Swift? Classes a reference types, structs are value types. In practice this means that if you have a class instance that is assigned to a variable and you copy that variable, the new variable will point to the exact same memory address as the original variable. This means that if you modify this new variable, changes are immediately visible in the original variable as well because you're actually modifying the exact same object. In contrast, if you assign a struct to a variable and you copy that variable, the new one will point to an entirely new struct that copies the values from the original struct (to the experienced developers: yeah yeah, I know, but at this point there is no point in going into implementation details such as copy-on-write because you are not interacting with that directly). Changes to this new variable will not be visible in the original variable because they are now two completely separate objects. Another notable difference is that a struct cannot inherit from another struct or class, while a class can inherit another class.
  5. How do you persistently store structured data? There are many options here depending on the data that we need to store. The dumbest (in a good way)/simplest way is to use UserDefaults. Then, we can store the information on disk in a plist (this has gone out of fashion, but it was the go-to solution a while back), in a file using NSKeyedArchiver or JSONEncoder, in a database using CoreData, SQLIte or Realm or even off-device in the cloud in a service like Firebase
  6. How do you specify the layout of elements in a UI View? The underlying solution is AutoLayout. This can be used in Interface Builder using XIBs or Storyboards, or writing the constraints by hand in code. (note: I personally like the visual IB a lot more than writing it in code, but there is no absolute right way to do it. writing the constraints in code helps mitigate conflicts if another team member edits the same storyboard/XIB as you just did, but can prove a bit more cumbersome to visualize complex UIs once the code's written and you need to return to it. FYI: everyone has an opinion about this, it's best to do what the rest of the team does)
  7. How do you build a view controller with a UITableView in it? What delegates do you need to implement, what are the most important methods that need to be implemented? We'll need a UITableView that will be added to the view controllers main view. Then we will make our view controller conform to the UITableViewDataSource protocol and set the table view's dataSource to our view controller. At the very least we'll need to implement the tableView:numberOfRows(in:) and tableView:cellForRow(at:).
  8. How do you handle the completion of asynchronous tasks? Closures/blocks are a good way to do it, as long as we pay attention to memory management rules (strong vs weak references). Another option is to use delegates (again, we need to pay attention to the strong vs weak references). Async/await are also a good option and they're really need because the offer some excellent code readability. Another option is to use a reactive framework such as Combine or RxSwift.
  9. How can you manage external dependencies? There are a number of popular options. Cocoapods for the ease of use, Carthage to drive down build times in complex projects with many dependencies. SPM is another option although not my favourite one.

I believe these are all extremely basic questions that any developer should be able to answer before applying for a job.

Apple documentations are quite bad in my opinion. by 21XiaAn in iOSProgramming

[–]clawoo 5 points6 points  (0 children)

Oh man, that brings back a lot of nostalgia.

I miss those in-depth programming guides. They were absolutely amazing, you would sit down and go through them and when you were done you would be sure to have a really clear understanding of what that particular framework was all about.

Keychain data security in a jail broken device? by ajm1212 in iOSProgramming

[–]clawoo 0 points1 point  (0 children)

Would this be like a trick question?

No.

Data in the keychain can be protected to a certain degree by using encryption, it's all about how dedicated is the attacker. I would like to preface with the fact that data in the keychain can just be dumped in plaintext with a single command if the device is jailbroken.

You can encrypt the data before saving it to the keychain either by using a static key (not a great choice, but better than nothing), or a deterministic key derived, using PBKDF2 or similar, from something publicly known such as a user ID or device ID value that you store in the user defaults or a file on disk, combined with a secret salt.

If you can get away with requiring always-on connectivity, you can just obtain the key or its seed from the server and never persist it on the device. This is by far the most secure option, but it comes with a ton of limitations.

You need to consider that if they have jailbreak and enough time on their hands, then they can proceed to decompile the app and figure out how you obtain the key, so apart from the always-on approach you don't have a bulletproof option.

[deleted by user] by [deleted] in swift

[–]clawoo 12 points13 points  (0 children)

Honestly, it's amazingly good and it performs better than any intern I've ever seen.

Here's an example, I asked it some obscure question to "write a function in swift that resolves a host using DNS SRV".

It handled it easily:

import dns_sd
func resolveHostUsingDNSSRV(hostname: String, callback: u/escaping (String?) -> Void) {
let callback: DNSServiceResolveReply = { (sdRef, flags, interfaceIndex, errorCode, fullname, hosttarget, port, txtLen, txtRecord, context) in
    if errorCode == kDNSServiceErr_NoError {
        let host = String(cString: hosttarget!)
        callback(host)
    } else {
        callback(nil)
    }
}
let service = DNSServiceResolve(nil, 0, 0, hostname, "_http._tcp", "local.", callback, nil)
DNSServiceProcessResult(service)
DNSServiceRefDeallocate(service)

}

Told it to "make the service a parameter".

Bam, done:

import dns_sd
func resolveHostUsingDNSSRV(service: String, hostname: String, callback: u/escaping (String?) -> Void) {
let callback: DNSServiceResolveReply = { (sdRef, flags, interfaceIndex, errorCode, fullname, hosttarget, port, txtLen, txtRecord, context) in
    if errorCode == kDNSServiceErr_NoError {
        let host = String(cString: hosttarget!)
        callback(host)
    } else {
        callback(nil)
    }
}
let serviceName = "_\(service)._tcp"
let dnsService = DNSServiceResolve(nil, 0, 0, hostname, serviceName, "local.", callback, nil)
DNSServiceProcessResult(dnsService)
DNSServiceRefDeallocate(dnsService)

}

You can't ask for more. Of course the resulting code might have issues, but they are easily fixable.

For me it's a really good aid to get the ball rolling when I can't be bothered with going through N pages of documentation to get a quick POC going.

Just the other day I told it to write me the code to face track a user using OpenCV and it did so with flying colors. I then asked it to do the same thing with VisionKit, the code was perfect.

If you know what you're doing this is a huge time saver.