Saturday, December 21, 2024
HomeiOS Developmentios - How one can repair a number of targets situation in...

ios – How one can repair a number of targets situation in a single place and entry everywhere?

[ad_1]

In my Xcode, I’ve 3 Targets known as target1, 2, 3.

I do know to use the situation for every Goal.

#if Target1
#else Target2
#else Target3
#endif

However the above situation wants to use the whole undertaking in a number of locations.

How one can place this situation in a single place and entry it in the whole undertaking?

As a result of if we made any modifications we have to change everywhere, so if we obtain above requirement if we modify in a single place that is sufficient.

I’ve carried out the under operate however getting the error: Can not discover kind 'File' in scope

//Single operate in Utility class
    var getProjectName: String {
#if Target1
        return "Target1"
#elseif Target2
        return "Target2"
#elseif Target3
        return "Target3"
#else
        return ""
#endif
  
//Use case 1
change BUtility().getProjectName {
case "Target1":
case "Target2":
case "Target3":
default:
    break
}

[ad_2]

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments