This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension Binding where Value == Double { | |
/// Returns a new version of the binding that scales the value logarithmically using the specified base. That is, | |
/// when getting the value, `log_b(value)` is returned; when setting it, the new value is `pow(base, newValue)`. | |
/// | |
/// - Parameter base: The base to use. | |
func logarithmic(base: Double = 10) -> Binding<Double> { | |
Binding( | |
get: { | |
log10(self.wrappedValue) / log10(base) | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.content.Context | |
import android.content.Intent | |
import android.content.IntentFilter | |
import androidx.lifecycle.Lifecycle.Event.ON_DESTROY | |
import androidx.lifecycle.Lifecycle.Event.ON_START | |
import androidx.lifecycle.LifecycleObserver | |
import androidx.lifecycle.LifecycleOwner | |
import androidx.lifecycle.OnLifecycleEvent | |
import android.content.BroadcastReceiver as StockReceiver |