It is very piggy dependent - it can be anywhere from a few weeks to years.
Once they take food from you that is a sign they are starting to trust you. It really is just a case of taking it at their pace.
I have four boys.
My eldest two are 5 years old. They are not keen on being handled but after 4.5 years with me they obviously trust me and will come to the bars to greet me, will take food from me but they don’t want to be held. They may tolerate a quick head stroke but that is it.
It took one of them six weeks to take food from me. He quickly progressed after that.
It took the other one 18 months before he was brave enough to take food from me for the first time. He was a labour of love. I accepted that he may never went to but continued with the piggy whispering tips and persevered every day. It finally paid off.
My youngest two are now 5 months old. They came to me at 9 weeks old and had been handled quite a bit before I got them. They were both literally climbing into my hands for cuddles and strokes, taking food from me from day 1.