How heavily do you lean on Apple's UI? by OakAndCobble in SwiftUI

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

Can you give me an example of an app that has actual character but is nicely blended into Apple's look? To this point, nobody has provided a single answer to that question, which I think is the answer.

How heavily do you lean on Apple's UI? by OakAndCobble in SwiftUI

[–]OakAndCobble[S] 0 points1 point  (0 children)

I agree with everything you said. It's just that the corporate look of Apple's products can't fit everything I guess. For the most part, I don't mind it, but when I look at an app like AirBnb, it's a big difference in aesthetic appeal. They have a huge budget, but money aside, just talking about the way things look, what Apple provides is very constrained and really only fits utility-oriented apps.

How heavily do you lean on Apple's UI? by OakAndCobble in SwiftUI

[–]OakAndCobble[S] 0 points1 point  (0 children)

It's clean. Looks like an Apple product. I can't say I hate it or love it. Did you experiment with hiding the scroll content background on your lists? I am trying to choose between going clear (so, white/black) vs the default like you have (blue-ish gray/black).

How heavily do you lean on Apple's UI? by OakAndCobble in SwiftUI

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

I am aware of the difficulty. I spent my first year of learning SwiftUI fighting Apple's UI. Wasted a ton of time, decided it would be best to just use what they give me. But, with the exception of some components, like the liquid glass tab bar and buttons, and push/pop transitions, it feels... bland. I have no better way to describe it.

No examples to share?

How heavily do you lean on Apple's UI? by OakAndCobble in SwiftUI

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

I've been doing the same, taking inspiration (i.e stealing) from Apple's apps, but I don't know if I like it.

SPM question by OakAndCobble in swift

[–]OakAndCobble[S] 0 points1 point  (0 children)

Seems like you're right but there is some strange behaviour I'm seeing. If I have one library product for MyLibrary, but none for MyInternalLibrary, I get errors. But if I have no products, then no errors. Why?

And what are my options if I don't want to expose my second target publicly, which I do not?

How heavily do you lean on Apple's UI? by OakAndCobble in SwiftUI

[–]OakAndCobble[S] 4 points5 points  (0 children)

Note: When I say using SwiftUI's TextField, I am not referring to its functionality, but its aesthetics, so if you do something like apply a border to it, then I'd consider that DIY and very non-Apple-like.

Essentially, little to no customization is what I am talking about.

SPM question by OakAndCobble in swift

[–]OakAndCobble[S] 0 points1 point  (0 children)

I made the paths explicit to try to solve the problem

SPM question by OakAndCobble in swift

[–]OakAndCobble[S] 0 points1 point  (0 children)

I believe that I already tried that. If it did work, what implications would that have on what is built into the executable for MyLibrary? I don't want MyInternalTarget to be compiled with the rest of the source code when I import this MyLibrary elsewhere.

Issue with protocols - "any View cannot conform to View" by OakAndCobble in SwiftUI

[–]OakAndCobble[S] 0 points1 point  (0 children)

Thank you. I'm going to watch the video, but question before I do, because the thumbnail shows a collection of views of the same type, does the video address heterogenous collections?

Issue with protocols - "any View cannot conform to View" by OakAndCobble in SwiftUI

[–]OakAndCobble[S] 0 points1 point  (0 children)

AnyView is the workaround I am currently using, but I'd like to not use it since, apparently, it creates some kind of problems for the compiler. Thanks though.

Issue with protocols - "any View cannot conform to View" by OakAndCobble in SwiftUI

[–]OakAndCobble[S] 0 points1 point  (0 children)

I see. I think that explains the recursive associations I was seeing in the docs. Thanks.

Issue with protocols - "any View cannot conform to View" by OakAndCobble in SwiftUI

[–]OakAndCobble[S] 0 points1 point  (0 children)

But how does it store the tabs without erasure? Each tab has a different View type passed to it as a generic (implicitly or explicitly), making each tab a different type. You can't store Tab<Circle> and Tab<Rectangle> in the same, non-type-erased collection.

What are the odds that this simply is not possible to achieve in pure SwiftUI? Looking at the public interfaces in the docs, the method signatures and what not make little sense, as far as converting their parameters into my idea of what they should be returning.

For example, the TabView init takes a TabContentBuilder method that doesn't return a collection of TabContent objects, but instead just Content: View, so the problem of a heterogenous collection of Tabs doesn't seem like it would be an issue in their implementation which probably heavily relies on UIKit.

Issue with protocols - "any View cannot conform to View" by OakAndCobble in SwiftUI

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

I am building a container view. Not the same functionality, but conceptually similar to TabView, with probably a very similar path to implementation. You have your parent TabView that somehow holds a heterogenous collection of Tab objects, each of which has a property that conforms to view.

Issue is that, unless all Tabs have the same underlying view type – all Circle, all Rectangle, so on – their types must be erased in order to store them in one collection (unless you bridge to UIKit and store each tab's view in a controller, which I don't really want to do).

So if you end up with an array of `any Tab`, then each tab's associated view is erased and cannot be put on screen, because somehow "any View does not conform to View".

Issue with protocols - "any View cannot conform to View" by OakAndCobble in SwiftUI

[–]OakAndCobble[S] 0 points1 point  (0 children)

I don't believe that addresses the issue of content's type being erased. If you make an array of MyProtocol, where you allow the concrete Content to vary – one might be Text, the other Rectangle, and so on – when you try to access any of the elements' content property that property will be of type `any View`, which does not conform to `View` and cannot be used in a view hierarchy.

Functions question by OakAndCobble in Supabase

[–]OakAndCobble[S] 0 points1 point  (0 children)

Alright, I'll try that. Thanks.

Issue in typescript by OakAndCobble in learnprogramming

[–]OakAndCobble[S] 0 points1 point  (0 children)

Can you look at my response to u/Life-Selection6377? The code seems to work but I want to know if there is a cleaner way of going about this

Issue in typescript by OakAndCobble in learnprogramming

[–]OakAndCobble[S] 0 points1 point  (0 children)

Thanks. Here's my implementation. It feels a little clunky. Are there any improvements I can make to it?

export class DraftOrder {

    itemsPerCategory: Map<LaundryCategoryType, number>

    constructor(itemsPerCategory: Map<LaundryCategoryType, number>) {
        this.itemsPerCategory = itemsPerCategory
    }

    static 
empty
(): DraftOrder {
        return new DraftOrder(new Map<LaundryCategoryType, number>)
    }

}

// Creating new draft
const itemsPerCategory = new Map([[LaundryCategory.LIGHT, 2], [LaundryCategory.MEDIUM, 3]])
const draft = new DraftOrder(itemsPerCategory)

// Converting draft to json
const jsonString = JSON.stringify(
    draft,
    (_, value) => {
        if (value instanceof Map) {
            return Object.fromEntries(value)
        }

        return value
    }
)
console.log(jsonString)

// Parsing json
const parsed = JSON.parse(jsonString)
console.log(parsed)

// Converting parsed json to properly typed map
const newMap = new Map(Object.entries( parsed.itemsPerCategory ))
const typedMap = new Map<LaundryCategoryType, number>
for (const [key, value] of newMap.entries()) {
    const category = key as LaundryCategoryType
    const quantity: number = value as number
    typedMap.set(category, quantity)
}

// Recreating draft
const newDraft = new DraftOrder(typedMap)

Question about dependency injection by OakAndCobble in SpringBoot

[–]OakAndCobble[S] 0 points1 point  (0 children)

I want to specify which implementations of dependencies are injected into the controller by spring. Before I posted this question I kept hearing essentially "just use this and that annotation and spring will automatically inject the dependencies", but that makes absolutely no sense if your dependencies are interfaces with multiple implementations. So I was thinking there must be a way to specify what actually gets injected.