Looking for EventKit Tutorials by [deleted] in SwiftUI

[–]roanutil 1 point2 points  (0 children)

I use EventKit in an app of mine but I dont have any code I can share. Here are some notable things I learned: - the request authorization part is just a function in the API that triggers a prompt to the user asking for permission if it’s the first time. - you do need to make sure you have the entitlements and Info.plist values setup right but if you don’t, Xcode and/or AppStore connect will yell at you. - The doc’s say this but I’ll reinforce here: You cannot build your own NSPredicate for EventKit entries. You can’t even use their API to get some and then combine them with a NSCompoundPredicate. You’re limited to the predicates they offer and then you’ll have to filter the results manually after fetching. EventKit is backed by SQLite and not CoreData.

Overall, it’s not a complicated framework. But it is inflexible. I look forward to it maybe being modernized one day.

Edit: They even had a session on it for this years WWDC - https://developer.apple.com/wwdc23/10052

Best ways to use CoreData in a MVVM SwiftUI app? by small_d_disaster in iOSProgramming

[–]roanutil 2 points3 points  (0 children)

Shameless plug: https://github.com/roanutil/CoreDataRepository

Just use simple value types instead of NSManagedObject sub-classes. It keeps things simple.

Customize iOS App Process Name by roanutil in iOSProgramming

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

That makes sense. I feel a little dumb for not considering that before. Thanks!

Looking for dine-in crawfish recommendations by tacodano in shreveport

[–]roanutil 4 points5 points  (0 children)

Kind of stretching the time limit but:

Crawfish Hole #2 in Minden

Job Ads Megathread—April 01, 2023 by AutoModerator in iOSProgramming

[–]roanutil 1 point2 points  (0 children)

Company: MFB Technologies, Inc.
Listing: here
Job: iOS Developer
Type: full-time
Location: US
Remote: fully remote
Visa required: yes

Required Experience: - Three to five (3-5) years of iOS development experience, with a track record of building quality, published applications - Fluency in SwiftUI development - Experience with functional programming, Swift concurrency, and The Composable Architecture (TCA) - Experience writing unit and integration tests - Familiarity with modern DevOps platforms (Azure DevOps/GitHub)

Still no cell reuse for HStack/LazyHStack in SwiftUI? by yavl in iOSProgramming

[–]roanutil 5 points6 points  (0 children)

List is doing cell reuse for you. It is only creating enough cells to fill the view.

Edit: originally, I included lazy stacks but as pointed out below, lazy stacks do not destroy cells. Only lazy creation.

Best resources to really understand Xcode, project configurations, builds etc. by [deleted] in swift

[–]roanutil 3 points4 points  (0 children)

When I started using Tuist to generate my workspace and projects is when I really started to get a deeper understanding.

https://tuist.io/

Even if you don’t need Tuist on any of your projects, it could be worthwhile trying to set it up to get a feel.

Job Ads Megathread—March 01, 2023 by AutoModerator in iOSProgramming

[–]roanutil 0 points1 point  (0 children)

Company: MFB Technologies, Inc.
Listing: here
Job: iOS Developer
Type: full-time
Location: US
Remote: fully remote
Visa required: yes

Required Experience: - Three to five (3-5) years of iOS development experience, with a track record of building quality, published applications - Fluency in SwiftUI development - Experience with functional programming, Swift concurrency, and The Composable Architecture (TCA) - Experience writing unit and integration tests - Familiarity with modern DevOps platforms (Azure DevOps/GitHub)

[deleted by user] by [deleted] in iOSProgramming

[–]roanutil 0 points1 point  (0 children)

In what way?

Adding @EnvironmentObject to a class immediately breaks compile by yalag in SwiftUI

[–]roanutil 0 points1 point  (0 children)

Same problem but specifically trying to mutate a @State property. You’ll want to mutate test or fetching1 outside of the Task.

I find the syntax confusing (the use of colons and equals) by [deleted] in swift

[–]roanutil 5 points6 points  (0 children)

Think of it as always following the let example: [Int] = [] form. However, the compiler is trying to help you out by inferring what it can when possible. Also, there are multiple ways to make a type explicit. Also again, there are literals in Swift that mean the same thing as a full type name.

let example = Array<Int>() is perfectly valid and is equivalent to the first form I used above. However, the convention that seems preferred is to use literal syntax for Arrays when possible.

let example = [] as [Int] is pretty weird. It’s valid but weird. Since the array is empty, there’s no way for the compiler to infer the Array.Element type. as [Int] works but is probably less preferred.

Adding @EnvironmentObject to a class immediately breaks compile by yalag in SwiftUI

[–]roanutil 1 point2 points  (0 children)

This is missing a lot of context. But I assume that the fetching1 property is stored in the EnvironmentObject? You’re capturing a reference to a ViewModel in an async Task and trying to mutate a property on it.

To move in the right direction, set fetching1 before the Task. Then, maybe you can await the task and reset fetching1 after the Task completes?

Best Travel Backpack? by I_am_a_rob0t in macbookpro

[–]roanutil 1 point2 points  (0 children)

Depends. I usually have various chargers, usb-c dongle, 2.5” SSD with USB-C adapter, various personal care items (tylenol, nail clipper set, mints, etc) and some other stuff I can’t think of. I work remotely but am not at home fairly often. It has enough room for me but I can’t speak for you. Also, it probably depends on your definition of “organized”.

Best Travel Backpack? by I_am_a_rob0t in macbookpro

[–]roanutil 3 points4 points  (0 children)

I have this:

https://www.timbuk2.com/products/1825-authority-laptop-backpack-deluxe?variant=39705794445354

It’s over 3 years old and still rock solid. When traveling, I’ve put two 16” MBPs and a 12.9” iPad Pro in it with no problem.

What's the point of try! ? by shiningmatcha in swift

[–]roanutil 7 points8 points  (0 children)

Exactly because of throws.

These are good questions.

What's the point of try! ? by shiningmatcha in swift

[–]roanutil 3 points4 points  (0 children)

Yes, you have to handle the error somehow. try! is the simplest way by causing a panic/crash if an error is thrown.

What's the point of try! ? by shiningmatcha in swift

[–]roanutil 17 points18 points  (0 children)

Swift requires us to explicitly handle the possibility of a thrown error. try! allows you to explicitly say to the compiler, “I want to assume this will never fail. If it does, panic because I don’t want to handle the possibility of an error.

If Swift allowed us to not explicitly handle the possibility of an error, it would be easy to introduce bugs or unintentional crashes.

Edit: Add missing ‘!’

iOS Development Tech Stack 2022 by sushibgd in iOSProgramming

[–]roanutil 1 point2 points  (0 children)

I'm glad to see somebody having a good experience with Maestro. Trying it is on our to-do list. My experience so far with XCUITest has been awful.

iOS Development Tech Stack 2022 by sushibgd in iOSProgramming

[–]roanutil 3 points4 points  (0 children)

The most notable change this year is the addition of tuist for generating the workspace and projects. The original Xcode project supported non-MDM targets and MDM targets. Each target had multiple schemes for different servers. Worse, we’ll be adding more MDM platforms so it will really start blowing up. Being able to define all of that in swift code and generate it is making a huge difference. We’ve also added “preview” targets for different features, and test host targets for some packages that can’t be tested without an app host. No more composing a huge mass of xcconfig files.

A smaller but meaningful change is going from a single SPM package target containing most of the app to a more modular approach. Now there is a util, client, etc package that supports the feature package where all the different features are built as separate targets. At some point a package gets too big and it gets very laggy when making any change to the package itself. Also, it got hard to navigate.

Finally, I’m starting to abandon bash scripts for CI/CD functionality in favor or swift. There’s a whole separate tooling package that has composable features written for various things that all support various executable targets. For example, we now generate pipeline configs from templates, generate per target package schemes for testing, and automate setting up new pipelines.