matomo-org / matomo-sdk-ios

Matomo iOS, tvOS and macOS SDK: a Matomo tracker written in Swift
MIT License
388 stars 164 forks source link

UIDevice Extension #102

Closed brototyp closed 7 years ago

brototyp commented 7 years ago

An extension to return:

Discussion: Is an extension the best idea? There might be conflicts with the main application in which the piwik-sdk is used. I guess it is better to use a separate class.

thorstenstark commented 7 years ago

Yeah, moving all that stuff, including the extensions from UIApplication, to a seperate class sounds reasonable. What do you think about "AppContext" as name for this class?

brototyp commented 7 years ago

I am not sure if I would move all those methods into one class. If you want to do that i would name it just Context because the device platform doesn't really have anything to do with the Application itself. An alternative would be:

class Context {
  class Application {}
  class Device {}
}

... with all methods inside are class methods. This way everything is the same (the Context), is different (Device, Application) and is still easily accessible (Context.Application.version or Context.Device.platform).

thorstenstark commented 7 years ago

That's a good idea.