info

  • iPhone Screen Sizes (iOS 16)

    When developing for iPhone today, if you can set a minimum version of iOS 16.2 then you need to be prepared to support the following phones and their respective screen sizes.

    That’s ten different screen sizes from an iPhone 81 to an iPhone 14 Pro Max.

    Device Logical Dimensions Scaling Factor Physical Dimensions
    iPhone 14 Pro Max 430 x 932 @3x 1290 x 2796
    iPhone 14 Pro 393 x 852 @3x 1179 x 2556
    iPhone 14 Plus
    iPhone 13 Pro Max
    iPhone 12 Pro Max
    428 x 926 @3x 1284 x 2778
    iPhone 14
    iPhone 13 Pro
    iPhone 13
    iPhone 12 Pro
    iPhone 12
    390 x 844 @3x 1170 x 2532
    iPhone 13 mini
    iPhone 12 mini
    375 x 812 @3x
    (downsampled)
    1080 x 2340
    iPhone 11 Pro Max
    iPhone XS Max
    414 x 896 @3x 1242 x 2688
    iPhone 11 Pro
    iPhone XS
    iPhone X
    375 x 812 @3x 1125 x 2436
    iPhone 11
    iPhone XR
    414 x 896 @2x 828 x 1792
    iPhone 8 Plus 414 x 736 @3x
    (downsampled)
    1080 x 1920
    iPhone SE (3nd gen)
    iPhone SE (2nd gen)
    iPhone 8
    375 x 667 @2x 750 x 1334

    Comparing devices for “how much they can show on the screen” you should look at the Logical Dimensions column.

  • Preparing to Ignore Files with Git and Xcode

    Source code version control is a core competency of the modern developer. But sometimes the system and the environment can get in the way.

    When using Xcode (or other tools) with services such as GitHub the default situation is to associate a folder with a new repository, including all files and subfolders contained within. This might also include some files or folders you might not want to include.

    For example, macOS uses hidden files named .DS_Store (Apple’s Desktop Services Store) to manage information about the state of local folders, and Xcode places files in xcuserdata/ folders which trbck the state its own UI.

    Both of these are useful for the local user, but are unlikely to be so for others who might be working on your project code.

    Before Your First Project

    If you want to prevent all of your local projects including selected files or folders in their repositories, then you can update Git’s global settings.

    Step One: create a .gitignore file

    Create a file named .gitignore_global in your local user root directory. For example, by using the following command in the Terminal:

    touch ~/.gitignore_global
    

    Note the _global suffix to highlight to future you that this affects all repositories.

    Step Two: add the required rules to the .gitignore file

    Using your preferred text editor, add the name of each file or folder that you want to be excluded from all of your Git repositories. For the examples above, the file would contain (with #-prefixed comments included):

    # macOS
    .DS_Store
    
    # Xcode
    xcuserdata/
    

    There are other options, such as using wildcards, which can be explored as extended reading.

    Step Three: Configure Git to use the .gitignore file

    Use the Terminal to tell Git to use this list of files folders to be ignored when creating all new local repositories:

    git config --global core.excludesfile ~/.gitignore_global
    

    Ignoring by Project

    You might want to ignore files on a project by project basis.

    The process is the same, but in each project root folder you should include a .gitignore file, formatted as above.

    Fixing Files that Slip Through the Net

    If you had already linked your Xcode project via Git, and after setting up your global, or per-project, ignore files, perhaps now have the odd erroneous file such as .DS_Store in one of your repositories, you can remove the individual files from your repository:

    git rm --cached .DS_Store
    

    This will need done for each rogue file in your local repository, with files being removed from your remote repository on the next git push.