Comments (4)
your generated swift code outdated. in kotlin source you have some new cases in sealed, but in swift code this cases not used yet
from moko-kswift.
@Alex009, Hi, Thank you for quick reply! Here's my sealed class UIState and UserPremium used in MutableStateFlow<UIState>(UIState.Empty)
sealed class UIState<out T> {
object Loading : UIState<Nothing>()
object Empty : UIState<Nothing>()
data class Data<T>(val value: T) : UIState<T>()
data class Error(val throwable: Throwable) : UIState<Nothing>()
}
data class UserPremium(val isActive: Boolean, val state: SubscriptionState)
enum class SubscriptionState {
AVAILABLE, BILLING_ISSUE, CANCELLED, ERROR
}
and generated UIStateKs:
public enum UIStateKs<T : AnyObject> {
case data(UIStateData<T>)
case empty
case error(UIStateError)
case loading
public var sealed: UIState<T> {
switch self {
case .data(let obj):
return obj as MultiPlatformLibrary.UIState<T>
case .empty:
return MultiPlatformLibrary.UIStateEmpty() as! MultiPlatformLibrary.UIState<T>
case .error(let obj):
return obj as! MultiPlatformLibrary.UIState<T>
case .loading:
return MultiPlatformLibrary.UIStateLoading() as! MultiPlatformLibrary.UIState<T>
}
}
public init(_ obj: UIState<T>) {
if let obj = obj as? MultiPlatformLibrary.UIStateData<T> {
self = .data(obj)
} else if obj is MultiPlatformLibrary.UIStateEmpty {
self = .empty
} else if let obj = obj as? MultiPlatformLibrary.UIStateError {
self = .error(obj)
} else if obj is MultiPlatformLibrary.UIStateLoading {
self = .loading
} else {
fatalError("UIStateKs not synchronized with UIState class")
}
}
}
is there anything I need to change? I's not clear for me why is it working on simulator but not in festflight build
from moko-kswift.
strange. what value you have in UIState<T>
when fatalError throws?
from moko-kswift.
Unfortunately, I can't get the value in debug environment. It crashes only in testflight build
from moko-kswift.
Related Issues (20)
- How can I implement SealedToSwiftEnumFeature for xcframework? HOT 3
- Is it necessary to name a multiplatform lib exactly 'MultiPlatform Library' HOT 2
- Unable to generate extensions Pair
- excludeLibrary/includeLibrary should use group+name value
- Compile Swift code inside Kotlin framework HOT 1
- Generated Swift.podspec should read deploy target version for xcode 14 HOT 1
- Add extension field to Kotlin sealed class for conversion to Swift enum
- Generate extension functions for classes which have public functions accepting sealed classes instances as parameters
- Invalid generation of enums when sealed class/interface declaration is nested in other class and it's subtypes are not inside sealed class
- Generate code for extension with lambdas
- Generic class inside sealed class not generated properly
- At which phase code is actually being generated? I need to run build 2 times HOT 2
- Build warnings caused by unneeded force cast
- Add support for single swift file generation in multimodule project to simplify manual linking of generated swift code to XCode project
- Add configuration of generated swift files path inside gradle plugin
- Swift code does not generating when calling kSwift{moduleName}Podspec task
- Generated enum does not conform to Codable HOT 3
- trying to convert Kotlin data classes to swift struct
- Kotlin 2.0 on link step crash HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from moko-kswift.