russhwolf / multiplatform-settings

A Kotlin Multiplatform library for saving simple key-value data
Apache License 2.0
1.69k stars 67 forks source link

no-arg version: function 'invoke()' is not found #56

Closed dbaroncelli closed 4 years ago

dbaroncelli commented 4 years ago

I) included: implementation("com.russhwolf:multiplatform-settings-no-arg:0.6") in CommonMain

but when I try to instantiate Settings, it gives me the error: Expression 'Settings' of type 'Settings.Companion' cannot be invoked as a function. The function 'invoke()' is not found

russhwolf commented 4 years ago

I think I gave you the wrong import on Slack. Add import com.russhwolf.settings.invoke

You'll also probably want to use version 0.6-1.4.0-rc instead of 0.6 to make sure the native side is compatible.

dbaroncelli commented 4 years ago

yes, it works now

it's strange that it's needed to write that import manually

isn't it possible to make the import automatic?

russhwolf commented 4 years ago

In version 0.6.3, I've deprecated Settions.Companion.invoke() in favor of a top-level Settings() function. It should have the same caller syntax but import better in the IDE.