Let say you have a product which contains bunch of variants and you want to show the starting price of each product in your app. Let say the product and variant model looks like this:

Next, create an extension for the product class and define a function like this:

You can call this function from the instance of your product. That’s it :)

About

Muhammad Zeeshan

📱iOS Developer, Swift enthusiast 🌐 https://mzeeshan.me

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store