delblanco
04/22/2020, 10:39 AMsuspend
isn't available in swift. In my example I created this fairly simple `UserRepository`:
interface UserRepository {
suspend fun getUser(uri: UserUri) : User
suspend fun getUsers() : List<User>
fun getUsersIosWorkaround() : List<User>
}
On jvm/android all three methods are available though when compiling for iOS the last non suspend function is available. This is the converted protocol as found in `common.h`:
__attribute__((swift_name("UserRepository")))
@protocol CommonUserRepository
@required
- (NSArray<CommonUser *> *)getUsersIosWorkaround __attribute__((swift_name("getUsersIosWorkaround()")));
@end;
They're also missing on the dummy UserRepository implementation inside `common.h`:
__attribute__((objc_subclassing_restricted))
__attribute__((swift_name("MockUserRepository")))
@interface CommonMockUserRepository : CommonBase <CommonUserRepository>
- (instancetype)init __attribute__((swift_name("init()"))) __attribute__((objc_designated_initializer));
+ (instancetype)new __attribute__((availability(swift, unavailable, message="use object initializers instead")));
- (NSArray<CommonUser *> *)getUsersIosWorkaround __attribute__((swift_name("getUsersIosWorkaround()")));
@end;
Presenters definied in common
can invoke the suspend functions so I know they work in the PoC app.
Not sure if this is a bug, bad configuration or by design.. so any help is appreciated!Artyom Degtyarev [JB]
04/22/2020, 10:54 AMdelblanco
04/22/2020, 11:03 AMSam
04/22/2020, 12:46 PM