ivan.savytskyi
04/27/2020, 4:57 AMList<SomeType?>
is translated to objectiveC / Swift as [Any]
. @kpgalligan as far as I remember you were working on adding generics support, could you please advise?basher
04/27/2020, 5:47 AMbasher
04/27/2020, 5:47 AMSam
04/27/2020, 3:07 PMivan.savytskyi
04/28/2020, 5:23 AMList<SomeType?>
be translated as [SomeType]
on ObjC side?basher
04/28/2020, 5:43 AMivan.savytskyi
04/30/2020, 1:16 AMSam
04/30/2020, 1:47 AMivan.savytskyi
04/30/2020, 4:02 AMlistOfThings.get(index) == null
. Interesting that Github API GraphQL schema defines list of commits in history as Array<Commit?>
.ivan.savytskyi
04/30/2020, 4:16 AMSam
04/30/2020, 7:28 AMkpgalligan
04/30/2020, 12:58 PMkpgalligan
04/30/2020, 1:00 PMSam
04/30/2020, 2:54 PMkpgalligan
04/30/2020, 2:55 PMkpgalligan
04/30/2020, 2:55 PMkpgalligan
04/30/2020, 2:55 PMivan.savytskyi
05/01/2020, 12:23 AMdata class FriendsConnection(
/**
* The total number of friends
*/
val totalCount: Int?,
/**
* The edges for each of the character's friends.
*/
val edges: List<Edge?>
) {
fun edgesFilterNotNull(): List<Edge> = edges.filterNotNull()
}
in this sample for List<Edge?>
we generate synthetic accessor fun edgesFilterNotNull(): List<T>
that filters out nulls and returns non optional list. So if user doesn't care about nulls in the arrays (in most cases this is true), we just provide access to non optional list that makes swift happy to translate it to [Edge]
.Sam
05/01/2020, 3:16 PMNSArray
with a null in it. In ObjC, attempting to insert a null into an NSArray crashes a program. I’m guessing it inserts a KotlinNothing
in there but not sure.