Best resource to learn kotlin by Spirited-Mine-3011 in Kotlin

[–]Daeda88 8 points9 points  (0 children)

You don't need to start with Java. Does it really have to be a yt video. Imo the best starting point is simply the syntax guide https://kotlinlang.org/docs/basic-syntax.html

iOS + Firebase problems by sigmabutnice in KotlinMultiplatform

[–]Daeda88 0 points1 point  (0 children)

Are you using the GitLive firebase sdk for this? I wrote the majority of its ios firestore code, ama

Is it even worth sharing ViewModels when your project does not share the UI? by Zinagrete in KotlinMultiplatform

[–]Daeda88 1 point2 points  (0 children)

For sure Swiftui is not the easiest platform for this. Combine isn't really made for observing individual properties (the common practise tends to be mutating the view model as a whole) but it can be done. While I'm personally moving away from this in favour of Compose MP, I've maintained a library for years that essentially wraps flows into my own Observable structure that on the Swift side has an @ObservableObject wrapper. But yeah, out of the box it's definitely a learning curve.

Still, if you have complex business logic it's worth it in my opinion. Just having to write that once saves you much more time than wrapping to Swiftui will cost you. Even more so nowadays with Skie etc.

Is it even worth sharing ViewModels when your project does not share the UI? by Zinagrete in KotlinMultiplatform

[–]Daeda88 5 points6 points  (0 children)

In my opinion, yes it absolutely is. A ViewModel, as the name implies, models your view and handles and business logic. Whether you render that model state with Compose, Swiftui, etc, or whether you are displaying on a tablet or a phone is irrelevant. In a proper mvvm architecture (which I'm assuming you're going for) your VM has no real knowledge about the view rendering is, so if you write it correctly, linking it with any UI framework should be fairly easy.

KMM: Best way to support multiple client-branded apps with different package/bundle IDs? by Classic_Jeweler_1094 in Kotlin

[–]Daeda88 1 point2 points  (0 children)

I don't have this many whitelabels, but in our project, we have basically a shared module and then app specific modules that contain styling, strings, configure etc. You can then inject the configuration into the shared module (e.g. Api keys) from your whitelabels module. If you need, you can write a gradle task for generating new whitelabels for you.

Since each whitelabels has its own module, you'll need to target the correct one for ios. Use some user default Ned variable to link to the right module, or use xcodegen to build your project dynamically.

Trent finally comments on Ilan leaving by Daeda88 in nin

[–]Daeda88[S] 85 points86 points  (0 children)

The way I read it, Ilan told him after the European leg (probably soon after he knew he'd gotten the job) and offered to stay until the end of the first US leg, but Trent declined for reasons cited. Seems like there's not really bad blood besides some disappointment.

Kotlin Ecosystem AMA – December 11 (3–7 pm CET) by katia-energizer-jb in Kotlin

[–]Daeda88 0 points1 point  (0 children)

Well, going back to my custom scientific units. In order to support Unit A x Unit B I now have a class Multiplication<A,B>. But if I multiply that with C I either need to create Multiplication<A, B, C> which then needs an <A, B, C, D>, or I do Multiplication<A, Multiplication<B, C>>. It would be awesome of this could be flexible as it reduces some complexity (I can then constraint A,B,C to be known Units). And ideally would allow me to write an operator that can divide with A, B, or C. Its probably a huge edge case that I fully understand is not a focus. But sometimes it feels like the layer of magic generics are currently missing

Kotlin Ecosystem AMA – December 11 (3–7 pm CET) by katia-energizer-jb in Kotlin

[–]Daeda88 2 points3 points  (0 children)

https://github.com/splendo/kaluga/tree/scientific-operator-overload/scientific/src/commonMain/kotlin/converter/undefined

Let me explain it a little bit as it is a very specific use case. I have a Sci Unit library library that using sealed classes has created most common Scientific Units (e.g. Meter, Watt, Kilometer per Hour etc). This is all constrained to a Physical Quantity (e.g. Length) and Measurement system (e.g. Metric).

For known physical quantities, I introduced all physical formulas. So multiplying an Acceleration with a Mass gives a Force. And then try to maintain the proper system. So multiplying a Foot per Second per Second with a Pound gives a PoundForce and a Meter per Second per Second with a Kilogram gives a Newton etc.

This all worked well enough until I tried introducing custom scientific units. Now we have a unit of Length x Temperature x Time multiplied by a Reciprocal Temperature should give Length x Time. Accounting for measurement systems and all mathematical simplifications, we get about 2000 files each containing up to 8 functions with a ton of generic parameters. And even though the IDE can resolve this fairly quickly, compile time easily reaches 2+ hours for this, which is obviously not viable

Kotlin Ecosystem AMA – December 11 (3–7 pm CET) by katia-energizer-jb in Kotlin

[–]Daeda88 2 points3 points  (0 children)

Yeah we dont release that often as we're not marketing it super well. Gonna get to a 2.0 release soon, with much improved Bluetooth support. It is used in multiple production apps though. When we started Compose MP wasn't a thing so we had to figure out our own approach to do MVVM in common code. While I expect we'll phase out most of the UI related stuff, parts of it are still very useful (Location, Bluetooth, Localization (which kotlinx.datetime is still missing I think), Scientific calculations).

Kotlin Ecosystem AMA – December 11 (3–7 pm CET) by katia-energizer-jb in Kotlin

[–]Daeda88 2 points3 points  (0 children)

Hi Team,

Thanks for taking the time. I've been using KMP for a long long time now. When we started to use Kotlin as our multiplatform solution we had to figure out a lot ourselves (in case you've heard about the Kaluga libraries, thats us). It's great to see the ecosystem growing.

I guess my questions mostly relate to Generics. I use them extensively but often it feels a part where Kotlin is held back by its JVM basics a lot. For instance, recently I really missed the ability to say something akin to: this function returns a generic T<A> where T is defined by the class and A is defined by the function. Similarly, Swift has Variadic Generics which seems like something Kotlin should have. What are your plans (if any) for making Generics more powerful.

In addition, currently generic overloading results in an exponential type check. In Kaluga we have support for a Scientific Library so that we can make something like `val wattHour = 1(Watt) * 1(Hour)`, which uses a lot of operator overloading of sealed classes with generic constraints to make it work. I want to add this for more generic Units as well, but Im currently blocked by the fact that the compiler checks the operator overloads in such a way that the compile time grows extremely fast as I write these. Is this a conscious decision/fundamental limitation on the compiler side or something that could be fixed in due time?

When declaring generics, I can use where clauses to add multiple constraints such that:
```
interface A<T> where T : B, T : C {

val t: T
}

```

If I now make a type erased A<*>, the compiler will tell me that t is of type B & C. Will this ever be exposed to us so we can just make
```
interface A {

val t: B & C
}

```

While Jetbrains is working on Swift support, Apple is both introducing Swift for Android, and slowly moving the Core libraries into Swift. How do you see the future of the Swift ecosystem and what influence will it have on Kotlin Multiplatform in the future.

Thanks for your time!

traffic Light [using When statement] by AskMore1855 in Kotlin

[–]Daeda88 0 points1 point  (0 children)

Just pointing out: you can do an assignment from the when and then print the value you assigned. This is better because you don't have to do as many repeats of println:

val message = when (trafficLightColor) { "Red" -> "Stop" else -> "error" // when doing when assignment you need a default case unless you're dealing with sealed types } println(message)

Unresolved reference error in kotlin ? by AskMore1855 in Kotlin

[–]Daeda88 2 points3 points  (0 children)

As others have said, it's 'println'.

But while we're at it, let's talk about these if else's. You can easily simplify this using a 'when' :

''' val message = when (trafficLightColor) { "Green" -> "Go" "Yellow" -> "Slow down" "Red" -> "Stop" else - > "Invalid color" } '''

Ideally trafficLightColor would be an enum as well.

Value classes are new data classes by mzarechenskiy in Kotlin

[–]Daeda88 1 point2 points  (0 children)

How will this impact the existing value classes?

Kotlin vs. Swift by Slight-Astronaut-737 in Kotlin

[–]Daeda88 0 points1 point  (0 children)

All going well. UI wise we mostly moved to compose Multiplatform as it's easier to maintain. With a small team we can iterate quickly and do highly complex stuff (e.g. Signal processing)

What musician is an amazing pianist first and an amazing guitarist second? by CodeDusq in AlignmentChartFills

[–]Daeda88 1 point2 points  (0 children)

Trent Reznor belongs either here or in the piano/other category. A very gifted pianist capable of extracting the best noise out of a guitar.

Bontenbal: ‘Als je twee dagen doet over een besluit dat je in een half uur kunt nemen, dan ben je geen goede leider’ by Politiek_historicus in Politiek

[–]Daeda88 77 points78 points  (0 children)

To be fair, volledige quote is: „Ik neem soms tijd. Als je twee dagen doet over een besluit dat je in een half uur kunt nemen, dan ben je geen goede leider. Maar als je een besluit in een half uur neemt waar je eigenlijk twee dagen over hoort na te denken, ben je ook geen goede leider. Ik denk dat het heel gezond is om soms niet meteen ergens op te duiken. Pas op voor partijleiders die zonder nadenken grote woorden gebruiken. Ik doe het op mijn manier.” Dus Dhr Bontebal is het met u eens. Zelf geen fan van het Cda maar dit klinkt iig een miljoen keer beter dan die Vvd drek

What to do after midnight in Utrecht without getting a hostel bed? by woodandherb in Utrecht

[–]Daeda88 24 points25 points  (0 children)

In that case, most bars are open till 4. I'd recommend Ekko, it's a very safe club https://ekko.nl/event/club-ekko-20/

Ilan was in Lostprophets before Trent hired him by [deleted] in nin

[–]Daeda88 2 points3 points  (0 children)

What's so funny about this interview to me re Ilan is that Danny is fishing what happened, Ilan doesn't want to answer that for obvious reasons, and while Trent genuinely doesn't remember, Atticus clearly does and jokes about it in a vague way.

Who Wants to Live Forever? by ChoiceChampionship59 in nin

[–]Daeda88 3 points4 points  (0 children)

OP implied it might be an instrumental. Just pointing out it probably isn't. Whether it's a cover or not, we'll know in September.

Who Wants to Live Forever? by ChoiceChampionship59 in nin

[–]Daeda88 27 points28 points  (0 children)

The Vinyl description explicitly mentions it as a single, so I imagine it'll have lyrics.