I am trying to create a reusable component / Cocoa Touch Framework in Swift that would display the current weather based on the user’s location.
Right now I cannot decide which approach should I take.
First approach: A custom UIView that displays the weather and forecast information. And inside this UIView is the logic of downloading the data from a weather API. What this does is that the component is readily usable since you only need to provide the API key and need not to write your code for downloading the data.
Second approach: A custom UIView that displays the weather and forecast information. This is only UI and no logic is written inside. No model, no data download. Basically the idea for this approach is so that you can reuse this view with another web service. So you download your data separately, say in your view controller. Then just pass in the values to the custom UIView.
What would be generally better if having a “reusable weather view” is what we are tryin to achieve? A reusable framework that can be in Cocoapods and be reused by other developers too.