Image for post
Image for post
Photo by American Public Power Association on Unsplash

Being on the way of working with TCA in a potentially large application, the benefits of using TCA become more and more obvious in a variety of scopes.

In this article, I’d like to share my experience in “Thinking TCA” by building a small component that presents a Form row that can be tapped; when tapped, it expands and shows a picker for a set of values; after picking a value, the row display is updated. And the row can be collapsed, certainly…


A very subjective view on a change of strategy

Preface: It is not so easy to identify a solution that fits a customer’s needs. If and when you succeeded by establishing a Jira/Confluence/Bitbucket environment that works perfectly well, it is even more frustrating if something happens like it did some days ago, knowing that the customer will never accept that. From many comments I read throughout the last days, it seems that this frustration is shared by many, so I decided to write this small and very subjective article.

Jira, Confluence, Bitbucket — tools used by many. Several companies I’ve met so far (including some DAX30 companies) use these tools for various purposes. They could be purchased at the best price with a 10-user license, which made them very interesting for small teams and small application areas. They could check if their use cases could be mapped with these tools. Once it became clear that the tools met the needs, they could be successively expanded. The usability is quite good, the administration is usually relatively stress-free, the flexibility pretty high. In addition, over time an ecosystem has developed that provides many additional functions, so that over time a system could be built that exactly met the needs. …


An introductory view of my first experience

Image for post
Image for post
Photo by Przemyslaw Marczynski on Unsplash

(Be warned: This is long stuff, and it’s not complete code. It’s more of a journey into concepts and usage, so it’ll take you some time.)

There seems to a new source of hype growing. While iOS/macOS architectures were mainly driven by MVC, MVVM, or Clean Swift (or others) up until now, SwiftUI, introduced two years ago, sets a different paradigm, where many of these architectures don’t perfectly fit in.

Over the years, we’ve experimented with a variety of approaches in order to find the right one for our application, which needs a heavy rework due to architectural and therefore maintenance problems. However, none of the classic approaches really helped, mainly because it’s a pretty large business application with tons of storage entities, where many functionalities shall be reusable in different contexts — with a growing rework of the application using SwiftUI, more and more problems occurred in keeping everything clean and separated. …


Again, I ran into a problem with Xcode that is not too obvious to solve. So I’d like to share my experience with you, so that you can prevent this situation.

The situation: You’re starting tests, and you get a result like this:

Image for post
Image for post

No update of the test result indicators — just black diamonds.

Well, I tried several searches, without a result. Nothing helped. The diamonds remained black.

Then, I remembered a similar problem long time ago with a different codebase (the above appeared with a new project I set up).

And I got a clue what was happening.

(Drum roll…


Image for post
Image for post

Although the TextField provides several standard features, you might want to have a floating label as shown above.

How do you do this with SwiftUI?

Step 1: Create a view

Just the standard business. We need two values: the placeholder text, and the text to display.

Step 2: Add a model

The model is set based on the given initial values.

And we need some initialization for it:

Step 3: Build the view

Now we can use the model’s properties to build the basic view:

What we’re doing here: we overlay the text for the placeholder and the text field, thus separating both. …


Jump to different points in your list

Image for post
Image for post
Photo by Glenn Carstens-Peters on Unsplash.

Using a SwiftUI list is a convenient way to use all the auto-mechanisms to insert, remove, or move rows.

However, if you add a new entry, there is no official way to scroll to the bottom of the list where the new entry was added. So, I tried to find a solution. You’ll find a couple of questions on Stack Overflow but no real nice solution (I did not want to replace the list with a wrapped UITableView).

By chance, I found a library called Introspect that gives access to most of the UIKit stuff behind the SwiftUI elements.

My idea was now to get access to the UITableView behind a list and then to just use a custom function named scrollToBottom. …


Note 19-mar-2020: In the meantime, I went much deeper into the question how a scrollable tab view with animations can be realized using pure SwiftUI. I came up with a solution that is published on GitHub.

While the solution described in my previous article is working pretty well for the displayed tabs, it has a problem when the “More…” tab is used and a view controller from there is selected. In this case, the didSelect delegate function will not be called.

I’ll describe here a modification to the above solution that is also able to handle that situation.

ViewControllers instead of TabItems

First, we modify the IRTabBar so that it gets the required view controllers directly, instead of providing the tab bar…


Image for post
Image for post
Photo by Russ Ward on Unsplash

Note 19-mar-2020: In the meantime, I went much deeper into the question how a scrollable tab view with animations can be realized using pure SwiftUI. I came up with a solution that is published on GitHub.

Please also note that there is a follow-up article on this one.

SwiftUI provides a TabView. However, checking for the currently selected tab, and reordering of the tabs lead to problems if you want, as an example, save and restore the new sort order on app restart.

So, I tried to design a TabBar which can be used pretty conveniently as replacement for the original TabView. …


Image for post
Image for post

When rebuilding our app, we first tried to work with an existing Tab Bar which we wrapped to use it as View in the new SwiftUI parts of our application.

However, this causes some boilerplate code, so I tried to use SwiftUI’s original `TabView`. While it is pretty easy to set up the view, it turned out that it is not so easy to react on the event of tapping a tab item in order to execute some custom code, such as save the selection and restore it on app restart.

First Try: `@State`

(I’ll just focus on the important stuff, so not all code is shown here required to have the examples work.) …


Image for post
Image for post

In this article I’ll present a solution what we worked out to start required services that depend on each other. While this is not very spectactular and solutions are available, we focused on setting this up using the new Combine features, especially Futures and Promises.

The example I will use consists of a CloudService, checking if iCloud is available, and a DatabaseService, that sets up a CoreData storage depending on the iCloud availability.

Be warned: The story will take some of your time to read and understand. It reflects my current understanding, so it is possible that there are things that a more experienced programmer might optimize. …

About

Gerhard Schneider

Helping companies and humans to evolve, and trying to be agile in an own product development.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store