On SwiftUI

Monday, August 10, 2020

SwiftUI is the future of app development. For the first time there’s unified way to write powerful applications for all Apple platforms.

There is 3 revolutions in personal computing technology.

  1. Mac and GUI.
  2. The open web.
  3. iPhone.

Each of this shifts were possible with a bunch of new technologies. I have a sense that SwiftUI can be one of those building blocks in the next step, democratising technology and opening new ways developers can build their applications. The reason I see its significance is that it combines strength of native development and convenience of the web, it builds up on technologies of the past. The same way open web wouldn’t be possible without computer in each household.

It might be limited to Apple world (fine with me), nevertheless, if SwiftUI proves itself as a success, it will be used to develop for the new platform, possibly AR/VR. The rest of industry will follow in adopting declarative way of programming user interfaces. I can not afford to miss this new revolution, I am very much committed to SwiftUI at this point.

Should Apple allow iOS apps outside the App Store?

Monday, June 22, 2020

Yesterday Brent Simmons wrote The App Store Doesn’t Make Apps Safe. Brent is very well-known and talented Mac and iOS developer, author of excellent RSS reader NetNewsWire. I agree with his argument, Apple could allow iOS users to download apps from the web without compromising security. However, security is not the only concern here.

Update management is the biggest concern for me. I love how the App Store manages updates in a single place. Apps generally do not nag you to update, you can see all release notes and update quickly. You can manage auto-updating with a single switch. There’s other pro-App Store arguments like, App Thinning, license management, Restoring Purchased Products, Family Sharing1, App Store reviews, and lack of third-party payments.

Mac is an excellent example of the system which allows apps from both places. I don’t like this duality. I am not comfortable making decisions where to buy an app. The problem is that half of the apps available on the Mac App Store and another half, usually most popular apps, on the web. In an event Apple allowing web installs, there will be exodus of biblical proportions with biggest apps leaving first to have more control, custom analytics, release automation and to avoid App Store reviews. If we allow apps from the web now, it would be hard to go back.

  1. Many, if not all, Mac apps only allow you to use one license per person. This is not enforced in any way, but it feels wrong sharing your license with family members. 

Why HEY CEO is wrong and Apple is right

Sunday, June 21, 2020

Let’s just go through HEY CEO’s take on Apple’s App Store payment policies.

It’s about the absence of choice.

HEY customers have less choice now, they only can subscribe through the web.

It prevents us from providing exceptional customer service when someone who uses our product needs help.

You should not be forced to contact customer service for a cancellation or a refund. App Store allows to do it in a couple of seconds.

When someone signs up for your product in the App Store, they aren’t technically your customer anymore - they are essentially Apple’s customer.

No, they still your customer, HEY. If you use Square for the payments on the web, your customers don’t become Square customers. Square just handles payments, like App Store does.

We provide hardship exceptions for all sorts of reasons. We discount our software for teachers. We provide free versions for first responders.

This people have to find a time to contact HEY and be dependant on competency of HEY stuff. Why not allow your product to be used for free in a limited way? Or offer discounts for everyone, which is possible with In-App Purchase (IAP) for new and existing subscribers.

Let’s say someone signs up for HEY on an iPhone, pays with Apple’s IAP system, and then decides to switch to an Android phone. Billing is entirely messed up now. They can’t update their credit card through the HEY app on Android because their billing info is stored with Apple. And we can’t help them.

IAP allows Server-to-Server Notifications. If your product available elsewhere, you could verify subscription status through Apple, and offer your customer an option to subscribe through the website, start billing them as soon as IAP subscription expires. I don’t see why HEY can’t do that. It is possible to have several payment methods on a single account. It’s not difficult to unsubscribe from IAP subscription if users decides to switch from iPhone, and this subscription would remain active even when auto-renewal is cancelled.

in app purchases are one of the most hostile customer experiences I’ve seen. Sure, the purchase part is relatively easy (most modern purchase flows are these days), but that’s where Apple stops

IAP is superior in speed, security and privacy to any modern payment flow. No HEY, it doesn’t stops after purchase is complete. IAP handles subscription management, refunds, renewals, Billing Grace Period, Push Notifications, and offers for retaining and attracting new customers.

Update: HEY was approved

As on Jun 22, HEY team adding a free version and update was approved. This proves that strict App Store rules, although sometimes vague and not fairly enforced, contribute to positive changes and superior user experiences than web or Android.

HEY app controversy

Saturday, June 20, 2020

Why Apple doesn’t allow App Store developers to bill through their own systems? The most popular answer is that Apple wants to force them to pay 30% (15% after 1 year) subscription cut. If that’s the only reason, Apple would ease this rule already. Apple hates negative press, and this would help with Antitrust action. It is hard for Apple to hold their ground on this. But they not going to change their mind. At least, I hope, they won’t.

I think Apple shouldn’t change this rule. Developers can do this extra work and take this hit for their customers benefit. It sucks to download an app and realise that you can’t use it, until you create account, it sucks even more if you have to create an account and pay subscription. You should be able to try the product first, and you shouldn’t be forced to give up on your privacy. The fact that developers can’t even add a link to a web payment is annoying, but it works, it’s an effective measure to force developers add In-App Purchase (IAP), and this is is great for Apple customers who now have an easy and quick way to pay.

This rule was created for a good reason — to provide the best user experience possible. App Store was created to be better and safer than the web. I have worked in a company which didn’t want to add IAP in their app initially, and added web-based subscription for a premium tier. Eventually, our CEO changed his mind and we implemented IAP. In the end our customers won and have more choice.

Apple knows this, they know this rule was created to simplify payments, protect user data, and automate refunds. If Apple eases this rules, there would be no motivation for companies to maintain IAP. Every App Store app will switch to their own payment system. It’s going to be a disaster, just like the web. Yes, this will give more money to devs, but it will hurt Apple customers. Customers first, developers second. Instead of raising public stink, HEY app should do the same everyone else is doing, introduce a free tier or add IAP — they have many options which can improve their product.

Removing the fee is also a bad solution. Maintaining App Store curation is not free, and Apple has rights to take this cut, this is how capitalism works, and that’s what allows revenue growth. Playstation, Xbox and Nintendo has been doing this for years and no one seams to complain.

The most common criticism is if HEY app doesn’t allowed to do it, why Netflix, Uber and others can. They can because they are famous, Apple needs them. It’s better to have this inequality than allow everyone charge money themselves. Unprecedentedly, Amazon added IAP for Prime videos, and if this rule wouldn’t exist, Amazon would never do it. I understand that Netflix can’t afford to loose 30% on every sale, they need this margin to invest in new shows. I think it is acceptable for popular companies like Netflix and Amazon to negotiate a lower fee, perhaps, even a zero fee. But this companies has to be as big as Apple is.

What Apple could improve to make this matter better? Maybe they can deprecate StoreKit and allow Apple Pay for digital purchases. Maybe Sign in with Apple can play a role in this new system. It’s confusing, from customers perspective, to have 2 different payment systems on a single platform. Why you can order a food with Apple Pay but can’t buy a digital game? Refunds and subscription management would be problematic in this case, and it makes IAP a superior experience to a traditional credit card. Perhaps, if this is technically possible, and Apple could figure this out and augment IAP with Apple Pay, it could work.

MVC

Friday, March 6, 2020

I don’t think that we choose MVC often enough. Here and there I discover some podcast episodes and some articles which would tell a story how MVC can be used successfully in a large iOS project. I cherish this moments because I think that MVC can work great while been misunderstood and undervalued by many iOS developers.

Bohdan Orlov has written this post on Medium about four iOS patterns: MVC, MVP, MVVP and VIPER. Bohdan warns readers about dangers of MVC and shows alternative patterns advancements. Table below with ratings on a scale from one to five from Bohdan’s perspective. One point is not given to any criteria — even the worst system is better than no system at all.

Criteria MVC MVP MVVM VIPER
Code size 5 4 3 2
Testability 2 3 5 5
Separation 2 3 4 5
Total 9 10 12 12

MVVM and VIPER have the most points. Seniors relying on unit tests, value separation and don’t mind complexity. VIPER is too tedious and complex to keep up with in big and medium teams, but MVVM often comes as a winner.

MVC is misunderstood. Most of developers I’ve met told me that MVC is out of date, primitive and not suited for modern needs. I don’t agree with them, I think that MVC is not causing massive view controller problem when used as intended. Each view controller should serve only single purpose. It’s not costly to add more than one view controller per screen. For difficult screens with many requirements func addChild(_ childController: UIViewController) can be used.

For me personally, product quality is the only thing that matters. I think that maximum amount of effort should be put into making product better through iterative improvements. View controllers are difficult and often impossible to test separately. Unit testing is generally good, but it shouldn’t drive the project design. Separating view controller and view model, designing proper abstract interface between them helps with mocking but is extremely costly in code size and time. When choosing between less code and better code coverage, I would choose less code and I would write less tests. Simpler code is easier to maintain, it will have less bugs and it will enable team to focus on refining the app. I think MVC can work great in many different scenarios, it integrates well with Apple frameworks, it’s easy to start with which helps with iterative process.

Bohdan shows us that with each new pattern amount of code doubles. Each new pattern brings more abstractions and MVC wins with least amount of them. I think the power of MVC in its simplicity. I wish we value simplicity more, it pays back a lot when debugging others people code.

Finally, I agree with Bohdan that we should think carefully before committing to a pattern, and don’t forget that it’s possible to use multiple patterns in a single project:

Therefore, it is natural to have a mix of architectures in same app. For example: you’ve started with MVC, then you realised that one particular screen became too hard to maintain efficiently with the MVC and switched to the MVVM, but only for this particular screen. There is no need to refactor other screens for which the MVC actually does work fine, because both of architectures are easily compatible.

MacBook Pro unable to locate SSD

Monday, February 24, 2020

Dropping MacBook Pro can happen to anyone. It’s a portable machine, after all, and laptop can end up in a different situations, such as hard floor. Hopefully in a closed state.

Mac can take a fall, but sometimes it can lead to a problem, such as the Question mark folder during startup.

Black screen with question mark folder Image source Apple.

Determine is this a hardware problem. Disk Utility or memory reset won’t help if there’s a hardware problem. Unlucky Mac owner, when in dare situation like this, still has options before making a repair appointment.

Opening Retina MacBook Pro (2014) is easier than most people would think. All is required is appropriate star-shaped screwdriver. Get out of jail free card can wait inside. In this case, pictured below, SSD module positioned under funny angle.

MacBook Pro 13 2014 model with back panel opened, showing SSD under funny angle

Concrete MacBook Pro survived the procedure popping it back in, with some side-effect like quite rattling noise during laptop shaking.1 The side-effect possibly can be fixed with small amount of glue and has not been attempted yet by relieved author of this post. Which got out of jail, this time.

  1. Rattling is happening because SSD module screw doesn’t attached to the base any longer. Screw and its nest both attached to the SSD module, but lost connection with the base. 

Astral Chain

Monday, October 14, 2019

The game and Switch with Pro Controller

Astral Chain is the first game I have picked with our new Nintendo Switch. It took 40 hours to complete main story, everything from the start, up to the title screen. I wasn’t rushing through the story and tried to complete as many side quests as possible. I am taking a break now, but there’s still more reasons to pick it up in the future.

Visuals and story

The game looks absolutely fast and stunning, like a current generation game. With very rich details, big maps, interactive physics and very beautiful character models which looks like anime. Entire game feels like you just live in the sci-fi anime show. Some people call the story to be predictable but I like it, it has the right amount of complexity. The world is unique and very deep. Characters are interesting and different. The main protagonist is always silent, inspired by Half-Life. You can choose protagonist gender and even customise the outfit, all of your choices reflected in cut scenes.

Fighting system

Astral Chain is very different to the games I have played before. Fighting system is the most interesting part of the game because you have to control 2 characters at once: you and your Legion. Combos look amazing and they are not automatically move you towards your opponent so not only you have to hit the right combination but also you need to be at the right distance to the enemy. It feels incredibly interactive and deep. There’s many special moves which I didn’t even attempted to do because I have not remembered what button to press. They are kind of like Mortal Combat fatality moves but with shorter amount of actions. Nothing in game hints you, you only can look at combination in the upgrade menu.

My favourite move is binding your enemies with Astral Chain, to do this you have to run a circle around your enemy with your Legion. I have learned to do it fast moving myself and my Legion at the same time, it’s incredibly satisfying, especially when chaining multiple foes.

Interface

The other interesting thing about this game is how Legion and Item Menu works. You can have 1 Legion and 1 item assigned to 2 main buttons. And you can hold the button entering circle menu to pick up a different Legion or an item. Every time you enter the menu, time slows down with cool audio effect for a short period, allowing you to pick the wanted thing. Spend too much time fiddling and enemies will start to attack you. It keeps you in the flow. Did I mention that all game menu systems do not take you out of the game and projected as augmented reality holograms? Awesome.

World exploring

When not fighting Chimera monsters, you are constantly collecting items, completing side quests and even snapping pictures. You can pick up empty cans and recycle them, adopt cats, use public toilets, chase enemies, go through stealth missions, find secret places and so much more… Every bit of progress is recorded and assessed in the end of the level. As a result you given a mark for each quest and chapter you complete. After finishing the game you given average mark as well, I got C, which is one step higher than the lowest D mark.

The game is addictive and interesting. I was motivated to find as much stuff as I could. It almost impossible to complete everything that level can offer, not through the first play-through. I just wish Switch has achievements API.

Minor annoyances

I didn’t like motorcycle levels which felt like an arcade railway shooter. You can’t control speed of you bike, just turn and shoot. Highway is littered with cars and you can hit them on a full speed with almost no damage to you. It felt too simple and unrealistic.

The other thing which annoyed me is jumping sequences. Developers made the right thing by not punishing you for failing our of the map area. It happens a lot and it is incredibly hard to land in a right spot. Floor and controls just feel slippery and not polished. You can’t loose but you have to try again and again.

It’s easy to control legions and they are joy to handle. Except, the Beast Legion, which is just too big and cumbersome. There was no problems in large round areas, but I have experienced issues when navigating through the map, I feel like there’s work could be done to help with animations.

And lastly, your protagonist can crawl but can’t jump and climb over things. Given the very high quality of the gameplay it felt like thing from the past.

Creating your own iOS Swift Package

Wednesday, August 28, 2019

During WWDC 2019 Apple announced that Swift Package Manager (SPM) now supports iOS projects. iOS developers had been waiting for a long time for this feature. In the past, only Mac projects has benefited from SPM. iOS developers have learned to use CocoaPods and Carthage but those tools are not perfect and SPM should allow us to replace any need in third-party dependency manager.

Many big companies separate their code into multiple internal frameworks and reuse them across their application. We have the same approach In the company I am working right now – IG. I have decided to try SPM for managing our dependencies.

There’s 2 kind of dependencies: third-party and internal. SPM supports both. It even supports complex dependency graphs with nesting. It sounded like ideal option until I started to hit some problems.

Starting is easy

It’s easy to get started, all you need to do is to add package.swift file to your project root directory. Open this file with Xcode 11 or newer and it will try to parse it. Xcode project file is no longer necessary and instead of projects you will work with packages. Select File > New Swift Package to create an empty package, you can use generated package.swift. Make sure you can build and test. You might need to fix some errors. For example, I had to add import Foundation to some of my source files. You also will need to specify location for your source if it’s not in default Sources folder. Other problems were much harder to fix.

Problems and limitations

The first thing I noticed is that not all third-party dependencies support SPM. If yours does, you are lucky person but if it’s not — there’s nothing you can do, besides letting them know or abandoning the dependency altogether. For example, I have managed to integrate with Alamofire and SwiftLint but not jazzy. If your dependency is closed source binary it won’t work with SPM at all! If you have something like name.framework in your project you won’t be able to wrap them in your own Swift package.

The second issue is lack of Run Script build phase. If you used to run SwiftLint every time you build your project, this won’t work with Swift package. Alternatively, you could use git hook based approach but this will require a lot of third-party code, and I couldn’t get it to work in a short time.

I also have noticed that you won’t be able to read local files through Bundle class. Following path is nil in Swift package:

let path = bundle.url(forResource: "filename", withExtension: "json")

That is caused by lack of Bundle in Swift package. If you want to read files locally use FileManager. You can separate code which only runs in Swift package with #if SWIFT_PACKAGE condition statement.

And finally, if you depend on any Objective-C code, you won’t be able to build it with your package. I was able to exclude some of my Objective-C code but I am not sure it won’t cause issues later.

Conclusion and benefits

If you can use SPM, you should do it, it’s easy to add a package with new Xcode GUI tool. If you providing a library, you should add SPM support for it. When it works it is great, it allows to set breakpoints and see errors in third-party packages, displays all third-party code (you will be surprised how many nested third-party projects your app depends on). It validates your dependency settings and allows you to remove Xcode project from your package.

Last but not least, before you migrate, make sure you are aware of all limitations.

Sleep timers

Monday, August 5, 2019

Podcasts and audiobook players have sleep timer feature. There’s many ways to express it. I prefer to have least amount of taps. iBooks and Apple Podcasts can work with just 2 taps, while Overcast app has more customised popover interface and needs at least 3 taps or often more.

Podcasts app shows standard alert controller and Overcast shows popover.

Overcasts starts countdown as soon as you begin configuring the interval, this adds unnecessary pressure.

iOS advantage

Thursday, July 11, 2019

From my own experience, I have noticed that people around me are more successful with iPhone than a Mac. Graphical user interface in pair with mouse is intuitive to an extent, but to use Mac comfortably you need to know and remember several fundamental concepts. Some of them I wanted to discuss today is double click action and concept of selected item.

I remember when I got Mac mini for my mom and we would spend some time together using it. With a little guidance she would figure out most of the stuff on her own. She didn’t know a lot, and when she had a question, she just asked me, and I would smile, and say yes, you are right. It was joy for both of us. Unfortunately, it didn’t go smoothly always. We stuck with one trivial task. She wanted to open a document. She needed my help to learn double click. Problem is, once she overcame a challenge and learned how to do it, she started double click everything — Dock applications, web links. Not a great experience.

Another time, much later, I happened to be a witness when someone wanted to save a document in a specific location. Very common thing you find yourself doing on a Mac. I have noticed an apparent problem which required my intervention — file did not save to the selected folder. Well that’s a problem. This made another person frustrated. Believe me, you don’t want to be a clever guy in this situation, this is UX failure. Why it didn’t save? Because you need to double click on a folder first!

iOS has some advantages over macOS. Both Mac and iPhone have a progressive disclosure of complexity which helps novice users get started, and also allows power users stay productive. However, entry barrier on iPhone is much lower. You can do everything on iPhone with a simple tap and swipe. It will take longer yes, but you don’t need to know about double tap, tap and hold, tap-hold and drag. That’s a great thing.

iPad works in the same way. Basic requirements, things you need to know to use it, are very low. It’s forgiving for a novice user. People can pick it up and do more without any help from their nerd friends. iOS and iPadOS have fundamental advantage over Mac.

Altershot 1.7

Wednesday, July 10, 2019

Today I am releasing update for one of my hobby projects. I’ve refined user interface and added support for latest Apple devices.

Altershot is the marketing tool for your screenshots. It simplifies Status Bar appearance to focus viewer attention on your app. Get it from the App Store. Altershot is free and contains no in-app purchases at this moment.

Full list of changes.

  • Added support for iPhone XS Max and XR
  • Added support for all new iPad models with iOS 12 look
  • Added support for new Apple Watch screenshots (Series 4)
  • Larger 1 to 1 screenshots preview
  • Improved Dynamic Type
  • Cut larger portion of the upper screen on iPhone X and newer to produce better looking screenshots
  • Updated About screen with small text descriptions
  • Improved user interface
  • Shorter file names for exported screenshots
  • Fixed issue when removing iPhone X status bar in Photos extension
  • Internal improvements to reduce application size in future iOS versions

Smartphone is great and not enough

Tuesday, July 9, 2019

Recently I have wrote about Mac and how I began to harness its unique power by using BBEdit, clipboard manager, Keyboard Maestro macros, custom launchers, modifying OS behaviour with BetterTouchTool, writing my own Perl and Swift tools.

This is all fine, as far as normal software developer concerned, macOS and its professional hardware gives us everything we need. We don’t want it to change in a fundamental way. We just need Apple to update it on regular basis. However, Apple can not stop on that. They need to empower even more people with technology.

Innovation to make Macintosh fully accessible with only a mouse instead of traditional keyboard was a great decision. This was copied by Windows quickly, so thanks to Mac, more people could use computers than ever before. Many years later, iPhone made computing even more accessible. Google had to start their own photocopiers, you know the story. Now even more people own and use computers (smartphones) daily.

So is there’s room for iPad? Can it compete with smartphone? I believe it can. You see, smartphone has replaced computer for many. But not replaced it completely. Smartphone is one of the greatest inventions of this century, and it’s not enough. Many people still have to rely on their unreliable PC computers to do the job smartphone can’t — access powerful web applications, work with multiple documents at the same time, access file system and connect external devices. This is perfect place for iPad. Assuming, it has third-party applications to support itself.

I wrote how iPad needs more professional applications back in 2014. Now it’s 2019, 5 years later, we have iPadOS with window managemnt, USB access and file system. We have Adobe making Photoshop for iPad and we have Catalyst and SwiftUI to help with native software on iPad and Mac. It’s a huge opportunity, and it’s going to attract new users. If you are developer, I would pay close attention to iPad.

So why would you think someone would replace Windows PC with iPad. I can think of some reasons.

  1. iPad is multi touch first. Irrationaly, it feels good to use it, and entry barrier is lower.
  2. iPadOS new features: window managment, mouse support, file system access, enables more profesionall use cases.
  3. It likely to get more professional apps in the next 5 years.
  4. Excellent battery life and mobility.
  5. iPad can compete on price.

I believe there’s market to be taken of people who didn’t use computers before or don’t really like them. This is people who own Windows PC laptop and looking for something better, faster and more powerful. I see the future where a lot of people would want to carry powerful iPad loaded with professional native apps with them — computer for everything, computer for the rest of us.

← Newer Page 1 of 9