SwiftUI experiment — XcodeProjects

Dmitriy Kalachniuk
Mac O’Clock
Published in
4 min readJun 19, 2020

--

(image by Apple Inc.)

👋

Hi there. I want to tell you about my light tool that saved me a lot of time during the development process. 🏃‍♀️ 🚄

Problem

Due to our structure of all our modules that we use at work (18 different frameworks stored as pods) I need to call “pod install” and “pod update” way to often… Also during development of the apps I have to switch between my frameworks and app. If I need to switch between branches in the framework then again I need to perform “pod install”. It takes time… so I spend a lot of time on

cd <project path>

pod install

To speed up this process first I created aliases in my bash profile so instead of <project path> I wrote in terminal

cd <project name>

Better… but can we do it even faster?

SwiftUI

It is been a year since SwiftUI rolled out and I all the time wanted to play with it. Well, I started with simple mac app just to play around with a simple list in it. It worked pretty well. Of course you have to google a lot of stuff before something is working in SwiftUI. At least when you try it for the first time… So do you want to have a table view? You google “table view swiftui”. You want rounded corners? You google “round corners swiftui”. It took some time but it worked. After you use functions and structures of SwiftUI, you become familiar with them so next time it is working faster.

Luckily, I found great resource to quickly find a correspondent swiftui element from UIKit – https://fuckingswiftui.com/

I created the list of all my projects and then beautiful idea came to my mind! I can click on this project and then my app will call “pod install” for this project in the terminal. Ok google, let’s do it! “how to call terminal from mac app”. I found a lot of results about Apple Script and actually you can achieve a lot of things with it. Really cool. After some coding I can call my lovely command in terminal for particular project! Wow! But i need to spend some time in order to bring my mac window in front of everything and then click on particular project. Again time 🕒

Tadam🎆 I found a great project by Gui Rambo called StatusBuddy. It is a mac app that provides you with a status of all apple apis like AppStore Connect, etc. Very handy! But what is even more important for me is that this app stays all the time “active” and you can access it in your tool bar. Very handy for my project.

So now all my projects are easily accessible and i can spend couple of seconds in order to update my dependencies in the project. Great! I love it 😊. Time to show it to my teammates and receive feedback!

SwiftUI issues

Feedback was good. “handy app but you need to add more commands”. Also “add drag and drop”

“Ok google, drag drop swiftui”. Mind blowing 🤯 you can add drag and drop to the list with just few lines! Amazing 🤩! 2 mins and you have drag and drop in your list! Well! What is next in todo list? 😀

Then you start adding more commands and you suddenly receive error in Xcode:

Argument passed to call that takes no arguments

What is it? Well, you can not have more then 10 elements in your view. Is it workaround? Of course! Great ios community will help you! Just wrap elements in “group” and then it will be only “one” element.

Compile and run and …

What??? What just happened? So apparently some auto layouts are broken in swiftUI and it will just not work. 😔 (if you know how to fix number of elements in MenuButton, please let me know)

Outcome

So I added couple of commands that I use the most like “pod install”, “pod update”, “open in Sourcetree”. I started to use it in my daily basis. It is saving me a lot of time during the development. I’m happy 😊 I practiced with SwiftUI and I enjoyed it. I still don’t think that SwiftUI production ready but we will be there and very soon.

So, if you want to speed up something during your work, you know what to do — write your tool!

And of course, check out my project. I will be happy if it saves your development time!

--

--