“Unleashed.” – Keynote Thoughts and Predictions

One month after this years iPhone and Apple Watch Keynote, we are now set to see the developer’s machine of choice, the MacBook Pro, get a revamp. With all of the different possibilities what changes should we be expect to see with this update?

New Apple Silicon Chip

The MacBook Pro is set to be the first hardware upgraded to the second generation Apple Silicon processor, dubbed the M1X. The major change will see the RAM ceiling raised from 16 GB, and the number of high performance cores, known internally as Firestorm, increase up from the for 4 currently found in the M1 Chip.

The bare minimum I would expect to see was a double of both the RAM and Performance cores, but with the current 16” MacBook Pro topping out at 64GB of RAM we might be set for a quadrupling of RAM if not CPU performance.

Likelihood 10/10

Mini LED Display

Apple’s first product to move to a next generation display was actually the original Apple Watch in 2015, which was Apple’s first device to feature and OLED display. The iPhone followed suit with the iPhone X in 2017, with the entire flagship line migrating across to OLED displays last year. This year Apple have adopted another display technology, Mini LED, in the latest revision of 13” iPad Pro.

The Mac isn’t particular suited to having an OLED display, due to the screen being on for extended periods of time with fixed UI elements being on screen such as the dock and the menu bar, which could create issues with burn in which OLEDs do suffer. Despite Mini LED being the natural choice for the next generation of displays for Macs, they are still much more expensive and harder to produce than LCD displays, so this will probably be a year too early for this change.

Likelihood 5/10

Promotion Display

All of the other Pro Products, that being the iPhone and the iPad, all feature dynamic refresh displays capable of topping out at 120 Hz, so having the MacBook Pro support this with either an LED or Micro LED Display seems like a formality at this point.

Likelihood 8/10

SD Card Slot

A focus of this update is likely to be that MacBook is going to be more pro focussed, and adding back the SD Card Slot shows that Apple are willing to concede that having more than 4 USB-C Points is a positive.

Likelihood 8/10

MagSafe Connector

USB-C has been a great way to charge MacBook Pros since their introduction, not only has the connector become the defect standard so there is usually one around (like a Nokia charger in the UK at the turn of the century), but it also offered the flexibility of being able to charge the MacBook Pro from any of the ports, on both sides.

I am expecting USB-C charging to remain, but with the addition of a magnetic charging port, as let’s be honest it was something that they should have never got rid of and I might have had a few lucky escapes tripping over the charging cable in the years since.

Likelihood 7/10

HDMI Port

Like the SD Card slot, lots of people missed the HDMI slot when it was removed mainly due to the ease of connecting a cable to present onto a larger screen. Even now presenting using the myriad of web based solutions that have been common place in the last 2 years still often leading to laggy and glitchy experience (those fancy Keynote transitions don’t look so good at 3 frames a second), but I think with distributed teams and therefore presentations becoming the norm, this might be one port to far to see added back.

Likelihood 5/10

Removal of the Touch Bar

The Touch Bar is an odd one, and to be honest I personally a fan of it, but the fact remains Apple have essentially ignored it since it was introduced in 2016. The biggest surprise was that it was still present on the 14” Apple Silicon MacBook Pro Introduced last year, as that would have required effort to make it work with the main ARM processor and not the dedicated coprocessors compared to when it was used in an Intel Mac. That all being said ether they either need to double down or get rid of the Touch Bar, and I think this even will signal the later.

Likelihood 6/10

New External Display

The options for Mac customers who want Thunderbolt connectivity and a Retina Screen have essentially just become the $5000 XDR, with LGs Ultra Fine displays becoming impossible to find. I would Apple to unveil a 5K Mini LED Monitor for around $2000 when the laptops make the jump, but as that is unlikely this time round we are likely to be left a bit longer waiting for a standalone display.

Likelihood 4/10

“California Streaming.” – Keynote Thoughts and Predictions

Last year we were treated to 3 Keynotes in the run up to the holidays and it looks like we are in for something similar this time round do too, but this time the iPhone Keynote has made its way to the front of the queue.

iPhone

Last year saw a redesign of the iPhone and iPhone Pro to the flat side aesthetics which are taking over Apple’s hardware lineup. This year the iPhone will get its “S Cycle” update, although probably named the iPhone 13, keeping external changes to a minimum with new camera array and a slightly smaller notch. The sensor-shift image stabilisation which was exclusive to the iPhone Pro Max last year, will make its way across to the whole iPhone lineup this time, with the iPhone Pro Max also having sensor-shift stabilisation on the wideangle lense.

The iPhone is set to gain a Promotion display which will not only top out at 120hz for silky smooth scrolling, but also throttle down to 1hz to preserve battery life and possible enable an always on dimmed display like the Apple Watch.

Apple Watch

The Apple Watch has remained pretty much unchanged externally since its release in 2015, besides when it received a size bump from 38mm and 42mm to 40 and 44mm respectively with the Series 4 in 2018. The Series 4 incorporated a larger display that also pushed the pixels closer to the edges of the watch, but despite the physical size increase this change was barley noticeable when the screen was off. This year the Apple Watch is set to gain the defacto flat sides found on the iPhone, iPad Pro and iPad Air, which will also see the case sizes bump up 1mm to 41 and 45mm. As with the last case update, the screen will be pushed even further towards the edge of the display, so the gain in screen real estate will be greater than the 1mm bump would suggest.

iPad mini

The iPad mini is also set to get the flat side treatment and look like a Mini version of the iPad Air released last with Touch ID in the Side Button, support for the second generation Apple Pencil and A14 Chip. Like the iPad Air I would expect to see the iPad mini suffer from a bit of a price bump as it distances itself from the bottom of the lineup.

iPad

The iPad is set to be updated its 9th revision and incorporate the A13 processor and finally gain a laminated display. The iPad will however keep the its current exterior design with Touch ID in the Home Button and support for the original Apple Pencil. It will also remain the only iPad to still be using lightning.

AirPods 3

AirPods are set to see their third revision and gain a design much closer to the AirPods Pro with smaller steams but lacking the rubber ear tips and therefore echo cancellation of the AirPod Pros. Internally I would expect the AirPods 3 to have improved range and battery life when compared to their predecessor but nothing that would make it an instant upgrade … unless your batteries have gone!

iOS 15

iOS 15 was unveiled at WWDC in June, but has since seen a lot of the features originally announced either taken out with each beta or never make an appearance to begin with. The most substantial feature that is still left in is Focus (think Home, Work, Driving etc), which essentially allows for different profiles (reminds me of my Nokia 3210) with different settings for things such as notifications.

Unlike last year where iOS 14 was released with 24 Hours notice, I expect iOS 15 to be released on Wednesday next week.

WWDC 2021 Keynote Thoughts and Predictions

Back into its more familiar early June time slot, albeit still remote this year, WWDC is set to see some hardware unveiled as well as the usual plethora of OS updates, but what exactly should we be looking for?

iOS

The biggest change to iOS this year is set to be around notifications, with the introduction of Profiles (ahhhh early 2000s features phone lovers rejoice), to have different prioritisation for notifications based on the current context e.g. no emails out side of working hours, no notifications while driving etc.

In addition to Safari pointing out what trackers it has blocked, iOS 15 is set to become more privacy conscious and point out when apps are also doing app tracking, and working around app transport transparency system that was introduced last month.

iOS is set to have a few small UI tweaks, such as how the Navigation Bar transitions on scroll, but the majority of these will come along for free for those using system UI components.

iPad OS

iPad OS didn’t get much love last WWDC, having seen the Magic Keyboard introduced earlier in the year, which meant a revamp to keyboard and more significantly cursor support in a mid cycle update. Now that the iPad Pro features the exact same internals as all the currently available Apple Silicon Macs, one would expect this years iPad update to be a significant one.

The low hanging fruit is a revamp to the widget system which until has be restricted to the left hand panel of the Home Screen. Like the iPhone on iOS 14, I would expect the iOS 15 to allow widgets to be placed anywhere on the Home Screen in a variety of sizes.

In addition to this an overhaul to multitasking and external displays is also desperately need, but I would expect to see minor tweaks rather than an overhaul to these.

macOS

macOS will see its now normal annual update, but unlike last years major UI revamp, expect this year to be a refinement year, with the major changes coming with improvements to Catalyst and SwiftUI.

watchOS

watchOS will naturally inherit the notification improvements from iOS, but what is rumoured is the ability to create Watch Faces using SwiftUI, using the resource efficient architecture that Widgets now use.

MacBook Pro 16

The MacBook Pro 16” is set to be the next Mac to make the transition across to Apple Silicon, and with it being the developer’s laptop of choice, unveiling it at WWDC seems like an obvious choice. Unlike the MacBook Pro 13 that came out last year, this update to the 16” is set to be a ground up revamp, losing the TouchBar and gaining HDMI port. Most surprisingly will be the return of not only an SD Card slot and return of the MagSafe. More significantly this will be the first device to feature the M1X processor, double the top end specs which most significant will allow for 32GB of RAM … aka enough for Xcode, iPhone Simulator and Slack.

AR / VR Headset

Despite the ongoing rumors, and Tim Cook’s Apple’s obvious interest in this area, I wouldn’t be expecting to see any AR or VR related headset unveiled at WWDC this year, but I wouldn’t mind being surprised!

“Spring Loaded.” – Keynote Thoughts and Predictions

After Apple having 3 keynotes in 3 months at the tail end of last year, we now have our first keynote of 2021 but what is set to be unveiled?

iPad Pro

The iPad Pro got a rather lacklustre upgrade last spring, moving from the A12X to A12Z processor, in addition to the inclusion of the LiDAR scanner. This time around both the 11 and 12.9 inch iPad Pros are set to move to the A14X processor, a variant on the iPhone 12’s processor, in addition to a better camera and USB 4 port enabling faster I/O and the ability to drive larger displays. The cellular models of the iPad are also going to make the jump to 5G to enable faster networking, which might be more useful now that the world is starting to open up again.

The 12.9 inch iPad is also set to gain a Mini-LED display, gaining better contrast while still maintaining the high refresh rate the the current iPhone’s OLED display lacks.

Air Tags

Apple announced support for third party support in the find my app last week, so if we where ever going to get the vapourware that is AirTags this would be the event to see them get unveiled.

AirPods

The iconic white earphones included with every iPod lives on nearly 20 years later, in the form of AirPods and AirPods Pro. This revision of the AirPods is set to have a slight design tweak to look like its Pro sibling with smaller stalks, while still omitting the rubber tips and active Echo cancellation.

iPad mini

The iPad mini is set to be updated to match the iPad Air’s design, with reduced bezels, rounded display and a Touch ID home button. This significant update will likely see the iPad mini’s price increase to be closer to that of the iPad Air’s, which will probably limit the appeal of this update.

iMac

Being the developers Mac of choice, the Apple Silicon update of the 16" MacBook Pro is destined to unveiled at WWDC in June, which leads the iMac having not had a significant update for more than a decade the obvious candidate to be announced at this event. Which leads us to the question of wether the M1X/M2 is ready to enable more I/O? Without it, I still feel an update to the smaller iMac is on the cards, with a completely refreshed design.

iOS 14.5

iOS 14.5 has been in beta since February, and contains the infamous ATT (Ad Tracking Transparency) pop ups. This requires apps to request a user’s permission in order to use IDFA (Identifier for Advertisers) which enables cross app tracking. One would think that this controversial change is the major hold up to its release, or a delayed hardware release such as the aforementioned iPad Pro, but this OS update also includes the ability to unlock automatically using and already unlocked Apple Watch when wearing a mask.

I would expect iOS 14.5 to have its release date announced for laster this week.

“One more thing.” – Keynote Thoughts and Predictions

Apple’s 3rd Keynote in 3 months, which is their 4th and most likely final keynote of the year, is now upon us, and it is time for One More Thing. That one more thing will almost certainly be the first Apple Silicon Mac(s), and besides (ironically) the information Apple gave us back at WWDC in June, there isn’t a lot of rumours to go on, so what might the key points of the Apple Silicon Macs?

Battery Life

The most noticeable change with introduction of Apple Silicon powered Macs is battery life, redefining all day battery life to be in the 18 hour territory, rather than the 10 to 12 hours that it is now. This will not only be down to ARMs better performance per watt, but the fact that the Apple Silicon CPUs will also feature the efficiency cores that were first introduced in A10 alongside the iPhone 7.

Perfomance

The A14 CPU found in this year’s iPhone already outperforms all of Intel CPUs currently found in Macs in terms of single core performance, including the $5,999 Mac Pro.

Where the A14 is currently trailing is on multicore perfomance, as at the high end it currently only contains 4 Perfomance and 2 Efficiency cores. While popping this into a MacBook Air, and replacing its 2 (effectively perfomance core) CPU will be a noticeable performance upgrade, it has yet to be seen if Apple can successfully design and have fabricate CPUs with 8 or more perfomance cores, that would be required to give a noticeable boost in performance to the MacBook Pros and iMac, which leads us nicely on to the models…

Models

Besides the year old powerhouse Mac Pro and the (probably doomed) iMac Pro, all models are up for grabs in the first round of updates.

The most likely model to see an update is a thin and light notebook, which will either be the resurrection of the MacBook (which was a perfect fit for an ARM Processor all along) or an update the MacBook Air, as replacing the CPU with the one found in the iPhone 12 would already give a noticeable improvements to both battery life and performance.

The MacBook Air Lineup is already reasonably streamlined, 2 models with different CPUs, with build to order options for the RAM, Hard drive and choice of 3 colours.

I expect the the Apple Silicon Mac’s to become more constrained in terms of customisation, with CPU and RAM fixed for each model, leaving build to order options to just be hard drive capacity and the color.

The other no brainier update is the Mac mini, although I would expect it to be a major step up from the Dev Kit, especially in terms of IO.

The 2 less likely updates are the smaller iMac (which was last updated in March 2019), and the MacBook Pro which saw a substantial update to the larger now 16 inch model last year, and a smaller update to the 13 inch model in May.

The iMac isn’t constrained by battery consumption, so if it does get updated the story will have to be all about speed, and I am not sure in terms of multicore performance the first round of Apple Silicon Mac’s will have a substantial enough performance leap to confuse the message.

The MacBook Pro is so integral to many Pro workflows, that I feel it would be risky to update it on day 1, but then again they did it when they switched to Intel! The more interesting aspect is that the MacBook Pro features a dedicated GPU on the high end, with options up to 8GB of dedicated RAM. If Apple do update the MacBook Pro 16”, they would either solved the integration with external GPUs, or they something a lot more powerful than graphics capabilities of iPad waiting in the wings for when they were less constrained by power.

Apple used the Intel transition to rename its computers to all start with Mac (PowerMac became Mac Pro, PowerBook became MacBook Pro etc), so would be interesting if Apple keeps up its current trend and we see an Apple Book.

iOS Apps

This has already been announced, but expect the keynote to focus on a number of iOS apps being demoed that are now available on the Mac

Cellular

Now that the Macs are running a fork of the iPad and iPhone hardware stack, now would be the perfect time for Apple to offer cellular as an option on their laptops. If this does happen, expect it to come at a premium as the software patents are relative to selling price, so this could be a $200+ option.

Price

Not something that you typically associate with Apple, but the replacement of the pricey Intel CPUs (and potentially AMD GPUs) with Apple Silicon will represent a significant drop in cost of materials for Apple, in particularly at the high end where the CPUs in the MacBook are rumoured to still cost Apple hundreds of dollars.

Do I expect Apple to pass all of these savings on to the customer? No. But, I think it will allow Apple to hit those key price points, such as a $499 Mac mini, $999 MacBook Air etc

Big Sur

Naturally the Apple Silicon Macs will ship with Big Sur, but Intel Macs will also get to experience the new look and feel that it introduces. Big Sur will get its release date at this event, so at least all of us sticking with Intel based machines for a while longer get something to play with.

“Hi, Speed.” – Keynote Thoughts and Predictions

Apple Keynotes are now coming thick and fast, and this is the big one, the iPhone Keynote, but what should we expect to see?

iPhone 12

4 Models

The iPhone lineup is set to grow from 3 to 4 models this year, with 2 iPhone and 2 iPhone Pro models. The iPhone Pro’s will retain its stainless steel rim edging, and an extra camera when compared to the non pro models.

Industrial Design

The iPhone lineup is set to gain the flat edge design of the iPad Pro and the more recently updated iPad Air. Ironically this design takes cues from the iPhone 5, which was released 8 years ago in 2012. This flat edge design will enable Apple to squeeze in a larger display into the same sized device, and when accompanied with a smaller notch will have a noticeable albeit small increase in screen real estate.

Touch ID

Last month the iPad Air was introduced with a Touch ID sensor integrated into its Top button, allowing the iPad Air to have the edge to edge display without incurring the cost of integrating Face ID sensors. On the iPhone Touch ID will added as a secondary biometric authentication option to compliment Face ID, which is super useful now we are all wearing face coverings. Unfortunately with the long lead times of iPhones, this is not a given but something that would of been worth delaying the iPhone for!

ProMotion

Apple introduced ProMotion, Apple’s marketing term for a high refresh display, on the iPad Pro 2 years ago. This not only gave the iPad Pro better scrolling performance, but also to improve the experience when using the Apple Pencil.

Last year’s iPhones failed to get ProMotion as the technology wasn’t ready for the iPhone Pro’s OLED display (the iPad Pro’s display is still LCD). This year the iPhone is set to miss out on ProMotion simply due to a lack of components, which will now doubt be the biggest let down of this years models if the rumours hold true.

5G

This years iPhone lineup is set to integrate 5G antennas, but as with the rollout of any wireless technologies the iPhone 5G antennas will include only a subset of the 5G bands. Due to 5G still being rolled out, this feels more like a checkbox exercise rather than an iPhone with excellent 5G support for the next few years.

LiDAR

The iPhone 12 Pro lineup is set to gain the LiDAR sensor that was added to the iPad Pro earlier this year. LiDAR is obviously another building block in their AR strategy, but as a major focus of every iPhone update is the camera, expect to see the LiDAR integrated to Apple’s image processing pipeline for effects such as portrait mode.

HomePod mini

The reception to the HomePod has been mixed. It is a fantastic speaker, with an average smart assistant, at a hefty price. Amazon with its every expanded Alexa product line up is the current king of the smart assistants, and Sonos with its wealthy of integration and home theatre companion devices, means that the HomePod has a pretty niche audience of Apple fanatics and privacy focused consumers.

Apple are hoping to widen their market with a lower cost HomePod mini retailing at $99. The HomePod mini is set to feature the same smart assistance functionality as its larger sibling, but with a reduced amount of tweeters and therefore loosing a bit of its punch when it comes to sound and volume.

Apple Silicon Mac

During the WWDC Keynote, it was announced that the first Apple Silicon Mac would be available this year, with the full transition completing within 2 years. The unveiling of the first Apple Silicon Mac is significant enough that it doesn’t make sense to share the limelight and media coverage with the iPhone. I would expect Apple to do an unprecedented third Keynote in 3 months, and unveil the first Apple Silicon Mac in November.

macOS Big Sur

macOS 10.16 Big Sur was announced at WWDC back in June, and although we are not expecting to see any new Macs at this event, we are expecting to see macOS Big Sur to get its release day announced for sometime this month.

“Time flies.” – Keynote Thoughts and Predictions

It’s September which means it is time for an Apple Keynote! Unlike every Apple September Keynote since 2012, this Keynote is not expected to see any iPhones unveiled at it, but there still should still be a lot to see.

Apple Watch

Apple is set to unveil the Apple Watch Series 6, which will maintain the 40mm and 44mm designs introduced with the Series 4, and the always on display introduced in the Series 5. The Series 6 is set to gain a blood oxygen sensor, leaning into both the health and fitness aspects that have made the Apple Watch so popular, and unlike the Series 5 it is also set to get a small albeit minor speed boost.

In addition to the Series 6, Apple is also set to unveil a low cost Apple Watch model, which is currently being occupied by the Series 3 in the lineup. Although the new low cost model will use the internals of the Series 4, it will get a bit of rebranded akin to the iPhone SE, so it isn’t considered the old watch in the lineup.

iPad Air

The iPad Air is set to get a redesign to match the iPad Pro’s thinner squared off bezels and curved display. Unlike iPad Pro, the iPad Air is not set to get Face ID support, instead offering Touch ID through the sleep/wake button. This revision to Touch ID will more than likely make its way across to this iPhone’s this year, which will be particularly beneficial with us all wearing Face Masks at the moment.

In addition to the chassis and screen update, the iPad Air is also set to make the switch to USB-C, reiterating that the iPad is a viable platform to get work done on.

Apple One

Now that a lot of people’s free year of Apple TV+ is coming to an end next month, Apple is set to announce an Apple Subscription bundle consisting of Apple Music, Apple TV+, Apple News and Apple Arcade for one monthly fee. Naturally you would expect that the bundle comes with a discount in addition to the convince of one monthly bill, but I would still expect Apple One to be around $25 per month but we can hope for less!

iOS 14

Although there are no new iPhones being unveiled at this event, watchOS 7 which will ship pre installed on Apple Watch Series 6 will require iOS 14. This means for the first time ever we will see a major version of iOS released without a new iPhone (give or take a couple of days anyway). I would expect iOS 14 to get its release date announced for next week, without any additional functionality from what we have already seen in the betas.

Apple Tags

Apple’s UWB and Bluetooth emitting tags have been a rumour for over a year now, but it looks like we are finally going to see them get unveiled. Competitors to the Apple Tag are priced in the $20 - $35 range, so one would imagine that Apple will sell a 3 pack for $99.

WWDC 2020 Keynote Thoughts and Predictions

The Mac’s Transition to ARM

It has been 15 years since Steve Jobs announced Apple’s last major processor transition, taking the Mac away from PowerPC to Intel’s x86 processors, and the arguments this time round are pretty much the same as then. Intel’s x86 processors, like the PowerPC processors of 15 years have stagnated, the performance increases for the last 5 years have been mediocre to say the least, and the efficiency, or as Steve Job’s reiterated throughout his presentation, Performance Per Watt, also isn’t improving. Meanwhile Apple’s A Series ARM based chips found in their iOS hardware has gone from strength to strength, so in addition to Performance Per Watt Apple will also gain control of its own destiny, which we know Apple will love.

Unlike the last transition the majority of apps compiled on Mac’s are for ARM already, that is apps compiled for iOS. I expect the transition to be painless for all apps written in high level languages, the bigger question is around apps that have a lot of low level or legacy code. macOS (or Mac OS as it was then) 10.4 & 10.5 featured Rosetta, which dynamically translated PowerPC instructions into Intel, and with Intel processors being so much faster than the existing PowerPC processors they replaced, it went pretty much unnoticed, so hopefully Apple has something similar up their sleeves this time.

The extra Performance per Watt could result in faster, lighter and cheaper Mac’s, but something tells me they won’t be focusing on the later!

Last time around the transition from PowerPC to Intel took around 13 months from when it was announced. I expect it to take a bit longer this time, with the consumer line switching to ARM in a similar timeframe.

iMac Redesign

The iMac got a 5K Display 5 years ago, a slightly slimmer design 7 years ago, but in reality it has looked the same with its Unibody enclosure for 10 years now.

The iMac is set to finally get a design overhaul, loosing the majority of its bezel and chin, and be transformed to a design resembling an iPad Pro held up on the existing iMac stand. Despite the imminent switch to ARM, this is set to be an Intel based machine with an upgraded CPU and faster RAM, but more significantly dropping the Fusion Drive in favour of a SSD as standard across the line.

iOS and iPadOS 14

The most significant changes are set to be in Messages, with improvements to group chaps allowing you to see when multiple people are typing, the ability to mark conversations as read, and a resurrection of the /me command which was a favourite of IM apps in the naughties.

With the iPadOS going out on its own last year, I would expect to see it continue to gain some additional features compared to iOS, with the Home screen set to get a major overhaul.

In addition to this, this year might be the one that Apple allows third party apps to be set as the default ones for email, web browsing and the calendar.

macOS 10.16

Information about macOS 10.6 has few and far between, but one of them is Messages from iOS coming over to macOS using Catalyst. Although this might spell the end for features such as built in screen sharing to another Mac, it will bring feature parity for display effects, Animoji etc, which for the majority of use cases is more significant.

watchOS 7

The majority of watchOS’s functionality usually comes along with a new generation of the Apple Watch itself, with rumours this year that will be blood oxygen monitoring and sleep tracking. That being said, it might be possible that Apple unlocks the sleep tracking capabilities in watchOS 7.

Implementing the Service Locator Pattern using a Property Wrapper in Swift 5.1

The Services Problem

In every app there is typically a few instances of types (what we will now refer to as a service) that you want to access throughout the app, such as an APIClient or NSPersistentContainer.

If you were developing a small app, you might decide to pass these services around as you navigate through the app.

Either through initialisers:

let detailViewController = DetailViewController(apiClient: apiClient, persistentContainer: NSPersistentContainer)

Or lazily using properties (especially when dealing with UIViewController subclasses):

let detailViewController = DetailViewController()
detailViewController.apiClient = apiClient
persistentContainer.persistentContainer = persistentContainer

While this works fine, it gets a bit cumbersome when you need to add a new service, such as analytics, as it means you need to add it everywhere throughout your app. Moreover intermediate objects end up referencing services they don’t even care about, just because another object further on in the app might take use of it.

Another approach will be to make these types singletons. The major problem with singletons is testability, as you have to reference a concrete type and not a protocol, which makes it impossible to swap them out for mocking during tests.

How I solved this previously was to pass around a container with all of my services, note that I am referring to my APIClient by the API protocol that it implements:

struct Container {
    var apiClient: API
    var persistentContainer: NSPersistentContainer
}

I then pass this around my app, preferably through initializers but sometimes as a property:

let detailViewController = DetailViewController(container: Container)

This avoids the problem when adding a new services and also reduces amount of boiler plate code, but its still not super elegant.

Property Wrappers

When property wrappers were announced, I thought would it be nice if I could just refer to my service using one, such as:

class DetailViewController: UIViewController {
    @Service var apiClient: API
    @Service var persistentContainer: NSPersistentContainer
}

But how do we get there?

Service Locator Pattern

I have looked at a lot of dependency injection implementations in Swift and in other languages, but often found them to be over-engineered, but I concluded at this point I was essentially looking to implement the service locator pattern.

From Wikipedia

The service locator pattern is a design pattern or anti-pattern used in software development to encapsulate the processes involved in obtaining a service with a strong abstraction layer. This pattern uses a central registry known as the “service locator”, which on request returns the information necessary to perform a certain task.

API Design

I am going to keep the API design discussion limited to the interface, but you can grab the implementation at the end of the article.

We are going to start off with a ServiceRegistry to register our services with:

var registry: ServiceRegistry = ServiceRegistry()

We can register a service using an instance of a given type:

registry.register(apiClient)

So the service locator can work well with testing and mocking, we also want to be able register a service but refer to it via a protocol that it implements:

registry.register(apiClient as: API.self)

And you can register a service but resolve it later:

registry.register {
    return APIClient()
}

And you can also support referring to the lazily created service by a protocol that it implements, by specifying the protocol as the return type:

registry.register { () -> API in
    return APIClient()
}

This means we end up with a public API for the Service Registry of:

public struct ServiceRegistry {
    public mutating func register<Service>(_ service: Service)
    public mutating func register<Service>(_ service: Service, as serviceType: Service.Type)
    public mutating func register<Service>(_ block: @escaping (() -> Service))
}

Once we have registered our services with our registry we then want to create our service locator:

let locator = ServiceLocator(registry: registry)

We then want the locator (via generics) to return the service back:

var apiClient: API = locator.make()
var persistentContainer: NSPersistentContainer = locator.make()

This means we end up with a public API for the Service Locator of:

public struct ServiceLocator {    
    public let registry: ServiceRegistry
    public init(registry: ServiceRegistry)
    public func make<Service>(_ serviceType: Service.Type) throws -> Service
}

Now we have this setup we want to make our property wrapper.

The logical first step in creating a property wrapper would be to pass in a ServiceLocator:

class DetailViewController: UIViewController {
    @Service(locator: serviceLocator) var apiClient: API
    @Service(locator: serviceLocator) var persistentContainer: NSPersistentContainer
}

This isn’t very DRY, and also how do we get the service locator there?

To clean this up we are going to add the concept of a shared Service Locator, which we can set on app launch:

ServiceLocator.shared = locator

This will give us global access to our services

We will then use a property wrapper to make this nice an clean.

This means to access a service we can no just use @Service in front of a variable and let are property wrapper and service locator do the work:

class DetailViewController: UIViewController {
    @Service var apiClient: API
    @Service var persistentContainer: NSPersistentContainer
}

This means we end up with a public API for the Property Wrapper of:

@propertyWrapper
public struct Service<ServiceType> {
    public let locator: ServiceLocator

    public var wrappedValue: ServiceType {
        return try! locator.make(ServiceType.self)
    }

    public init(locator: ServiceLocator) {
        self.locator = locator
    }

    public init() {
        self.locator = ServiceLocator.shared
    }
}

Implementation

The implementation is less than 100 lines of code. The only extra implementation detail is my internal ServiceFactory to handle all of resolution approaches. An improvement would be to add a cache to the service locator, so that services only had to be resolved once, but that would of made this example overly complex.

public struct ServiceRegistry {
    public enum Error: Swift.Error {
        case notRegistered(Any.Type)
    }

    private struct ServiceFactory<Service> {
        let block: (() -> Service)

        init(block: @escaping (() -> Service)) {
            self.block = block
        }

        func make() -> Service {
            return block()
        }
    }

    private var factories: [Any] = []

    public init() {

    }

    public init(registry: ServiceRegistry) {
        self.factories = registry.factories
    }

    public mutating func register<Service>(_ service: Service) {
        register(service, as: type(of: service))
    }

    public mutating func register<Service>(_ service: Service, as serviceType: Service.Type) {
        let factory = ServiceFactory { () -> Service in
            return service
        }

        factories.append(factory)
    }

    public mutating func register<Service>(_ block: @escaping (() -> Service)) {
        let factory = ServiceFactory(block: block)
        factories.append(factory)
    }

    internal func make<Service>(_ serviceType: Service.Type) throws -> Service {
        if let factory = factories.first(where: {($0 is ServiceFactory<Service>)}) {
            let service = (factory as! ServiceFactory<Service>).make()
            return service
        }

        throw Error.notRegistered(Service.self)
    }
}

public struct ServiceLocator {
    public static var shared: ServiceLocator = ServiceLocator()

    public let registry: ServiceRegistry

    public init() {
        let registry = ServiceRegistry()
        self.init(registry: registry)
    }

    public init(registry: ServiceRegistry) {
        self.registry = registry
    }

    public func make<Service>(_ serviceType: Service.Type) throws -> Service {
        let service = try registry.make(Service.self)
        return service
    }
}

@propertyWrapper
public struct Service<ServiceType> {
    public let locator: ServiceLocator

    public var wrappedValue: ServiceType {
        return try! locator.make(ServiceType.self)
    }

    public init(locator: ServiceLocator) {
        self.locator = locator
    }

    public init() {
        self.locator = ServiceLocator.shared
    }
}

“By innovation only.” – Keynote Thoughts and Predictions

The summer has flown by, so that means only one thing. The iPhone Keynote, but what should be expect to see?

iPhone

This year we are set to get 3 iPhone Models to replace the iPhone XR, iPhone XS and iPhone XS Max. Unlike previous years, all of the models will be refereed to as the iPhone 11, with the later 2 models being suffixed with Pro.

The iPhone 11, the upgrade to the iPhone XR, will continue to feature the same LCD Liquid Retina Display that it debuted with last year, but it will gain an additional wide angle camera for the equivalent configuration of lasts years iPhone XS and XS Max

The iPhone 11 Pro, the successor to the iPhone XS and XS Max is also set to gain an additional camera in the form of an ultra wide angle camera, meaning that they will both feature a 3 camera configuration. The hope of the 3 camera configuration is that the iPhone will be able capture better low light pictures, and hire quality videos.

In terms of other hardware improvements, the iPhone is set to get Bi-Lateral inductive charging, which will allow you to charge your AirPods directly from your iPhone.

Another major hardware change is the subtle removal of 3D Touch, thus making Haptic Touch the universal way to access contextual content across iOS. I have mixed feelings about this as I actually like and use 3D Touch regularly, but I guess Apple have the numbers to back up removing this feature from this years iPhones.

iOS

iOS 13…. 13.1? The iOS 13 Betas have been a rough ride for developers and beta users this year. From a developer’s perspective the major headline features of Combine and Swift UI, have been subject too numerous revisions and changes form Beta to Beta. In fairness this is the right call for Apple to make, as will have to live with these changes for years to come. The more worrying issues where related to some more foundational features such as iCloud, which has caused data loss for a lot ofusers and resulted in feature changes such as shared folders being bumped from the last betas.

I would expect Apple to start accepting iOS and iPadOS app submissions compiled against the iOS 13 SDK,right after the Keynote, with iOS 13.0 rolling out to customers next week.

In addition to iOS 13, I would expect to see iOS 13.1 too also be announced for release at the end of the month. This will include some of the removed features, such as HomeKit triggered shortcuts reinstated. The iCloud changes? Let’s not mention those.

macOS

iOS isn’t the only update getting released this month, with this years annual update to macOS, Catalina, also set to be given a release date at this event. The highlight of this macOS release is Catalyst, the technology that allows iOS apps to be brought to the Mac. Expect to see a lot of good and not so good iOS apps to make their way over to the Mac in the next few months, and I would expect to see these demoed at the keynote.

Apple Watch

Apple Watch Series 5 is set to get unveiled, with the major change be the inclusion of ceramic and titanium models. Logically these would be Edition Ranges, something that is currently not in the Series 4 line up, but with this in mid I would expect them to be priced in the £1300 to £1500 range.

AppleTV+

AppleTV+ got unveiled earlier in year alongside the Apple Card and Apple News+, but unlike those AppleTV+ has been released yet, in fact we don’t even know the price. With the world’s tech media taking a keen interest in the iPhone unveiling its seems logical that Apple would take the opportunity to show off its latest subscription service. Will we see some more content? More than likely. Will we find out the price? Im less sure.

Apple Arcade

At WWDC in June Apple Announced another subscription service, Apple Arcade, and like AppleTV+ we are yet to find out a price. Unlike AppleTV+ I am expecting to find out the the price, more than likely $4.99 a month, and will be released along side iOS 13 (or maybe 13.1) this month. The most interesting is what content Apple have managed to acquire for its subscription service, as Apple requires mobile exclusively for all games on Apple Arcade, its is mostly going to be completely new content.

Apple Tag

Although there are rumours of a redesigned MacBook Pro, boasting a 16” display, and even AR Glasses being imminently announced, I think the most likely completely new product to be announced at this event is Apple Tag. Apple Tags are set to be UWD Bluetooth devices that can be attached to items, which periodically broadcast their existence to all iPhone, so that they can be found using the Find My app. Not revolutionary but useful nevertheless.

 
Page 1 of 8