tylerwilson
07/05/2018, 4:28 PMolonho
07/05/2018, 7:13 PMtylerwilson
07/05/2018, 7:20 PMclass DeclarationsViewModel(val declarations: List<Declaration>) {
// how many declarations we have
val count: Int = declarations.size
}
this gets translated to:
@interface SWLDeclarationsViewModel : KotlinBase
@property (readonly) int32_t count;
@end;
then i want to use in my UITableViewController (in Swift) like so:
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return self.viewModel?.count ?? 0
// return Int(self.viewModel?.count ?? 0)
}
but I get an error like so:
Cannot convert return expression of type ‘Int32’ to return type ‘Int’
tylerwilson
07/05/2018, 7:20 PMtylerwilson
07/05/2018, 8:44 PMdrofwarcs
07/05/2018, 10:38 PMdrofwarcs
07/05/2018, 10:48 PMtylerwilson
07/05/2018, 10:52 PMdrofwarcs
07/05/2018, 10:56 PMsvyatoslav.scherbina
07/06/2018, 8:24 AM<http://kotlin.Int|kotlin.Int>
!= NSInteger
. For example, the second one is 64-bit integer on some platforms, while the first one is always 32-bit. So this feature should be designed carefully first.