Category Archives: Xcode

Big iOS learning classic is back again

The very well-known Stanford University’s course CS193p (Developing Applications for iOS using SwiftUI) formerly using Swift, has been broadcasted again this year.

This is the second time the curse is entirely done in SwiftUI. The course is very similar to last years’ but has some new approaches and updates that might worth repeating.

Continue reading Big iOS learning classic is back again

Change created by commented code tag in XcodE

Change created by tag in Xcode… Simple TIP!

If you want to change the header commented code tag

//  Created by {my name here} on 8/4/20.
//  Copyright 2020 __{my company name here}__. All rights reserved.

This name and company template is usually filled with your User and Company, the one is set on: System Preferences –> Users & Groups –> Current User

But if you have a different User, like a private or trivial one, regardless, you can change this name and other variables in the file header by creating a property list file called: IDETemplateMacros.plist

Continue reading Change created by commented code tag in XcodE

Locate real Watch Icons AssetS

It’s sometime confusing for new developers (or rather new Watch iOS developers) to find exactly where to set the Watch Icons. Well… it’s actually pretty simple.

It may be a bit unclear, because if you use a standard XCode template App, you may find two Assets.xcassets. The first would be under the WatchKit App and the second one under the Watch Kit Extension, usually where you insert your code logic.

Continue reading Locate real Watch Icons AssetS

Buddybuild vs Xcode Server best Continuous Integration system. Current pick, security, risks, maintenance

I am currently setting up a Continuous Integration system for a complex iOS project. Ultimately, I came down to these two options, as I want to stay in Apple’s realm.

This is no easy fly question, I have read a lot about the matter, but the evil is on the details, I want to waive all the pros and cons before moving forward and start a complex implementation.

Continue reading Buddybuild vs Xcode Server best Continuous Integration system. Current pick, security, risks, maintenance

What’s new in Swift 5.0

A new version of the Swift programming language is coming: Swift 5.0. It’s slated to be released early 2019, with a fair number of changes. How does this Swift update affect practical iOS development? And who’s making these changes anyway?

In this article, we’ll walk through some of the proposed and accepted changes for Swift 5.0. We’ll also discuss how the process of making changes to the Swift language works, and why that’s relevant for iOS developers.

Version 5 of Apple’s Swift language used for iOS and MacOS application development will arrive in 2019 with ABI (application binary interface) stability in the standard Swift library a primary focus.

ABI stability is half of what is needed to support binary frameworks. The other half, module stability, will be a “stretch goal” for Swift 5 and may not make it into the release, Apple’s roadmap notes.

Continue reading What’s new in Swift 5.0

iPhone Device & Screen Sizes and Resolutions +Xr

To get the screen dimensions (in points) of the current device:

CGRect screenBounds = [[UIScreen mainScreen] bounds]; 
// Macros: 
#define screen_width [ [ UIScreen mainScreen ] bounds ].size.width #define screen_height [ [ UIScreen mainScreen ] bounds ].size.height 
let screenBounds = UIScreen.main.bounds 
let screen_width = screenBounds.width 
let screen_height = screenBounds.height 

To get the screen scale:

CGFloat screenScale = [[UIScreen mainScreen] scale]; Swift: let screenScale = UIScreen.main.scale

Non-retina devices have a scale of 1.0. Retina devices have a scale of 2.0 or 3.0.

Some dimensions common to all screen sizes:

Status Bar
20 pts
Navigation Bar44 pts
Nav Bar/Toolbar Icon20 x 20 pts (transparent PNG)
Tab Bar49 pts
Tab Bar Icon30 x 30 pts (transparent PNGs)

Points vs. Pixels

Apple introduced retina displays starting with the iPhone 4. You don’t have to modify your code to support high-res displays; the iOS coordinate system uses points rather than pixels, so the dimensions and position in points of all UI elements remains the same across all devices.

iOS supports high resolution displays via the scale property on UIScreen, UIView, UIImage, and CALayer classes. If you load an image from a file whose name includes the @2x modifier, its scale property is set to 2.0. Similarly an image with a @3x modifier has a scale of 3.0. Otherwise the scale defaults to 1.0.

Retina Graphics

To support high-resolution graphics on devices with retina displays, you need @2x and @3x sized images:

60 x 20
120 x 40
180 x 60

To refer to an image in your code (or in Interface Builder), just use the filename of the standard sized image. iOS will automatically detect and use the @2x or @3x version if the device supports it:

<br>imageView.image = [UIImage imageNamed: @"button.png"]; Swift: imageView.image = UIImage(named: @"button.png")