0

I want to use a method as described here iOS different constraints for different devices to resize my constraints according to the iPhone model. Out of the answers given the one that was marked with a tick implemented something called a resolution group. In my code I wrote it like this:

  public func getResolutionGroup() -> ResolutionGroup? {
    switch self {
    case .iPhone6, .iPhone7, .iPhone8:
        return .lr320x568
    case .iPhone6Plus, .iPhone7Plus, .iPhone8Plus
        return .lr414x735
    default:
        return .lr320x568
    }
}

When I tried to use it however it says that ResolutionGroup is undeclared. The person who gave the answer did not state how he implemented. Is it something that's built in xcode or is it something I need to import from github?

HamdyAli
  • 173
  • 3
  • 14

1 Answers1

0

It appears that they just used their own enum:

enum ResolutionGroup {
    case lr320x568
    case lr375x667
    case lr414x736
    case lr768x1024
    case lr1024x1366
}

You'll need to add additional cases for new sizes for the new iPhones and iPads.

vacawama
  • 150,663
  • 30
  • 266
  • 294