Monthly Archives: June 2019

Dark Mode?

With macOS Mojave Apple introduced Dark Mode. Some applictions support it. I was mildly sceptical, thinking it was just some kind of fashion statement.

But there is an argument that goes like: “if I am going to stare into a lamp all day, I want as much of it to be as dark as possible”. It makes some sense. You would not want to stare into a lamp in the first place, why then let your display default to white everywhere?

There is also an explanation to why we ended up here: designers are educated for printed designs, which is usually on white paper, thus they prefer white background for computers as well, for aesthetic reasons. Everyone is not a designer, but we all mimic good design.

And you probably know that back the old days computer displays were black with green text. So it is plausible that people who want to make computers more modern and appealing prefer white displays, while people who are more nerdy or old fashioned like darkness.

What I have written so far may seem logical. But it does not matter. What matters is (from the perspective of a programmer):

  1. What is truly more ergonomical, to you?
  2. Is it enough to stick with either light or dark mode? Or should you switch depending on your surrounding environment?
  3. Can you get a consistent good dark mode experience, otherwise it is mostly annoying and better avoided entirely?
  4. How to design your product so it appeals to your customers?

Switching your OS to a dark mode is easy. If you are using XCode, Photoshop or some other product that supports dark mode, that is also easy. Terminal applications (frequently used by programmers) are highly customizable and has often never left dark mode in the first place.

How about the browser? Well, not the browser itself, but the web pages and web applications it delivers to you. Well, for Firefox and Chrome there is a plugin called “Dark Reader”. It works reasonably well for me. Read the FAQ/manual when you install it!

A problem is that when my eyes are used to bright content, a dark page with white text is no problem. But when I am used to a dark display and suddenly the entire display turns white for some reason, it is unpleasant.

As a developer I can of course wonder: how do we want web pages to be built so they work nicely both in light and dark mode?

  1. Each web page has a dark mode (will never happen)?
  2. Web pages should follow good light mode practices, so they look good when using a dark mode extension?
  3. Should any web pages be coded dark?

And as a developer, if my OS/Desktop, development tools, terminal and web browser is set to dark mode… what about the web application I am currently developing? I can’t possibly write CSS and whenever I refresh the result is passed through a black-box-dark-mode filter, that would be a very awkward development experience. So whenever I switch to the (web) application I am developing, the display will turn annoyingly white.

On Contrast

I had the idea that high contrast is easier on the eye. But I realise it is not. Absolutely white text on absolutely black background is quite hard on my eyes. However, ligth grey text on dark grey background is quite comfortable. Apple Terminal comes with a few different (color) profiles. Many of them are surprisingly colorful. I imagine I don’t want the cognitive input that colors give me, it distracts my mind, but perhaps I am wrong about it.

Xcode findings

As I start experimenting with Xcode I realise that it is a tricky beast.

Xcode 10.2.1

I realised Xcode 10.2.1 used 100%+ CPU. I fixed that by reinstalling it completely.

Reainstalling Xcode I had managed to mess upp the simulators.
Error: Unable to boot device because it cannot be located on disk
Solution: Run in Terminal: xcrun simctl erase all

Xcode 7.3.1

Xcode 7.3.1 Fails to start on macOS 10.14.5.

A first iOS app with Xcode 10.2.1

Ten years too late I decided to look into iOS development. It is too late, because the Klondyke era of becoming a millionaire on simple apps is probably over. On the other hand Swift has arrived and reached version 5 so it should be a good time to get started.

What I have is

  • Mac OS 10.14.5
  • Xcode 10.2.1
  • iPhone 6s, iOS 12.2 to deploy to
  • iPad 3, iOS 9.3.5 (obsolete by Apple standard)
  • 20 years of programming experience
  • Very limited experience with Swift 5
  • No experience with Xcode, Objective-C or macOS development

I am mostly a backend-programmer, who have to do HTML/CSS/JavaScript as well. Xcode is creepy. I have thought about a few appoaches

  1. Buying a book (but a challenge to find a book with relevant complexity, mix of tutorial/reference, for Xcode 10 / Swift 5)
  2. Apples obsolete tutorial (but I was put off by the fact that it is written for Swift 3)
  3. Just playing around with Xcode (just kidding – that is too scary)
  4. Some online course, like Udemy (but it is not my way)
  5. A simple trumpet tutorial

I went for (5). It was good, because in a few hours it took me all the way from starting Xcode to running something on my iPhone.

Building for the simulator and running works. And I managed to deploy to my iPhone (it is actually quite self explanatory: connect the iPhone, select it as destination in Xcode, and later in the iPhone under settings -> general -> device management you allow the app to run).

The short version is that it all went well! But…

Obsolete iPad 3

I failed to build for my obsolete iPad 3. What happens is that all is fine, and then I come to this screen:

I type my password, and immediately it (building/signing) “Failed with exit code 1”. I can imagine two options right away

  1. I need a real developer license (not Personal Team) to do this
  2. I need an older version of Xcode to build for 9.3
    (and in that case I might need to use older project format, and perhaps not even Swift 5, I don’t know)
  3. I got some indication that with a Personal (free) developer license I can only deploy to a single test device, that would perhaps not include old devices

It actually only builds for Deployment target 12.2, no older versions in the list.

Update: Page 60 of the free Apple Book “App Development With Swift” tells clearly that a free account only supports a single device. So it is clearly a waste of time to ignore that restriction and try to deploy to my iPad.

Xcode

I have spent a few hours with this now. I wrote 4 lines of code. I have ctrl-clicked on things, dragged-and-dropped-things, added properties to things, added resources, opened panels and used shortcuts. If you are used to things like Visual Studio it will probably feel somewhat familiar. But for me, who mostly use Vim, it is very scary.

Update: Xcode turned out to use 100%+ CPU constantly. I completely removed it and reinstalled it, and it seemed to help.

Computer Requirements / Performance

I did these experiments on a MacBook Pro 6,2 (that officially does not support macOS 10.14). It has an SSD drive and 8GB or RAM. Building takes almost 10 seconds, but starting the simulator and loading the app takes almost a minute. The computer clearly gets warm. Neither Xcode nor the simulator consumes much memory (Activity Monitory says about 200Mb each). Obviously, if you run the simulator much in your daily work, a faster CPU is worth it.

I think my 1440×900 display may be the biggest problem if I want to do anything real thought.

Conclusion

I have mixed feelings, it could be worse and better. I clearly need to find a way to be quickly guided through building different types of apps. I think I need a few days being guided through Xcode until both Xcode and the different project artifacts feel somewhat natural.

I have a simple app I want to build for myself, but right now it feels much to intimidating.

I found that Apple has released a free online book (available in their Books application) called App Development with Swift. That seems to be a good option.