I am trying to use a RecyclerView in my Silver project, but I am running into some issues because the Swift syntax seems quite different from the Java syntax. Here is what I am used to doing in Java:
// In Java
private class MyRecyclerAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
public MyRecyclerAdapter(Context context) {
....
}
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
....
}
....
}
The trouble with swift is I am not certain how to specify RecyclerView.ViewHolder to the RecyclerView.Adapter. Here is what I have so far (where VH was autocompleted, by Silver, but can’t be found):
public class MyRecyclerAdapter: RecyclerView.Adapter {
public override func onCreateViewHolder(arg1: ViewGroup!, _ arg2: Int32) -> VH! {
...
}
public override public override func onBindViewHolder(arg1: VH!, _ arg2: Int32) {
....
}
public override public override func getItemCount() -> Int32 {
...
}
}
Any suggestions would be appreciated!