How to you use RecyclerView in Swift with Silver?

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!

I was just playing around with Silver/Swift Android syntax, and took a stab at this one. I got the following to compile (but did not run it since it just a play app at the moment). The key in your case would be the override keywords you need.

class MyAdapter: RecyclerView.Adapter<MyViewHolder> {
	
	class MyViewHolder: RecyclerView.ViewHolder {
		init(view: View!) {
			super.init(view)
		}
	}
	
	let context: Context!
	
	init(content: Context!) {
		self.context = context
	}
	
	override func onCreateViewHolder(_ parent: ViewGroup!, _ viewType: Int32) -> MyViewHolder {
		// should use this line, with a valid resource ID
		//let view = LayoutInflater.from(self.context).inflate(R.layout.view_control, parent, false)
		
		// this is temporary just to get it to build. will not do what you want
		let view = View(self.context)
		
		return MyViewHolder(view: view)
	}
	
	override func onBindViewHolder(_ holder: MyViewHolder, _ position: Int32) {
		// given the position value, fill in the holder with the correct data
	}
	
	override func getItemCount() -> Int32 {
		// return how many items we are displaying.
		return 0
	}
}

Good luck if you are still working on this…