I currently have a helper class that helps me get the App information, up until now the class didn't need any dependencies but now I need to use class, AppLaunchCount
as shown in the code below. The way I have it now works fine but I feel that that's not the best way to do it.
AppInformation class
class AppInformation{
func appVersion()->String{
}
func operatingSystem()->String{
}
func deviceModel()->String{
}
func isNewUser()->Bool{
var newUser:Bool?
let launchCount = AppLaunchCount()
if launchCount.count > 1{
newUser = false
}else{
newUser = true
}
return newUser!
}
}
AppLaunchCount Class
class AppLaunchCount{
// counts the app launches
}
My only guess would be to inject AppLaunchCount
as shown in the following code snippet but I don't want to pass AppLaunchCount
when checking other stuff like appVersion()
etc.
init(launchCount: AppLaunchCount){
self.launchCount = launchCount
}
What would be the best approach to use class AppLaunchCount
inside AppInformation
for when calling the isNewUser()
method?
Aucun commentaire:
Enregistrer un commentaire