I've not had experience of my own toddler obviously, but I have got 10 years experience of working as a support worker with adults with learning disabilities and challenging behaviour , and I've always seen a correlation between the strategies that help toddlers and help these vunerable adults. Apologies if I'm about to teach anyone to suck eggs here....
Giving medicine is always hard. The way I approach it is through a all encompassing attitude to my relationship with the person. In that I am there to help them and once I have their trust over a period of time, then I make it clear that in the rhings we do together there are things that are negotiable and things that aren't and I want to help them understand that so they don't get stressed. Medicine is a non negotiable.
The first few times that you the person is refusing to take the medicine it is horrible and you do feel like you're hurting them, but you have to do it for their own good and you have to make them understand that you aren't ever going to give up regardless of how much they create. So sometimes to begin with it takes literally hours of trying.
So staying calm and firm, attempting to give the medicine in a strong and unemotional way, just calmly stating what you are going to do and why and that you won't give up because it's very important. And then withdrawing to give them time to calm down each time they refuse and kick off after calmly and firmly saying that you will not spend time with them while they are angry and refusing until the medicine is taken, so you'll be back in 10 minutes (or whatever timescale is appropriate) to try again. Advice them on how to calm down (deep breaths etc). Then leave them to settle.
Then return when they have calmed down and try again, and repeat the same routine again and again. Don't ever get into an argument or big conversation, don't get angry or emotional, just be calm and firm. Don't feed into the stress they feel, just keep going trying calmly and withdrawing when necessary. don't change strategy, save any praise or fun for when they've cooperated.
It's important to have the different between the way you interact when they are cooperating (like the sun's shining) and when they aren't (like it's gone behind a cloud). You aren't ever nasty or cross with them, it's simply that until they do as you say that you can't be smily and fun, you can only be calm and firm (but still caring).
Then when eventually they cooperate (and they will. even if it takes hours of two people trying. I defy any toddler to be more stubborn than someone with severe autism or schizophrenia) , then praise them to the heavens and keep bringing up how well they did and how proud you are of them. Act like the sun has come out and make sure they feel the difference.
They will be really relieved that you have taught them to have a way out of the stress they feel. It may feel that at the time you're being horrible and breaking them, but you aren't, you're helping them learn how to deal with stress and anxiety of things they don't like. making it safe and enabling them to develop skills in coping with difficult situations in life where they can't get their own way. You're not being nasty.
Make sure that in other situations that aren't so important that they get their own way sometimes and understand the difference. Always tell them that it's because it isn't as important as medicine (and other non negotiables).
This approach takes lots of time and patience and support for you in dealing with the stress and emotion of the process , but does work and it means you are teaching them skills and strategies for coping with life.
I hope I haven't just totally patronised everybody there!