# mic.st > Hello! I am Michael 👋 Writing about developing for iOS, visionOS, Accessibilty and anything around. --- ## Pages - [sitemap](https://mic.st/blog/sitemap/): - [Feature Requests](https://mic.st/blog/feature-requests/): Here you can submit new ideas or vote on existing ones. You can also send an email via contact@mic. st... - [Cookie Policy (EU)](https://mic.st/blog/cookie-policy-eu/): - [CPACC](https://mic.st/blog/cpacc/): - [Imprint & Privacy Policy](https://mic.st/blog/imprint-privacy-policy/): - [Portfolio](https://mic.st/blog/portfolio/): Personal Portfolio by Michael Steudter that includes links to iOS Apps, web projects, designs, summaries of features and technologies used. - [Portfolio_old](https://mic.st/blog/portfolio-old/): - [About Michael](https://mic.st/blog/about-michael-steudter/): Short story about Michael Steudter's journey to becoming an iOS developer after learning metal work and building machines. - [Privacy Policy](https://mic.st/blog/privacy-policy/): Who we are Our website address is: https://mic. st/blog. What personal data we collect and why we collect it Comments... --- --- ## Posts - [Error establishing a database connection on Wordpress Blog](https://mic.st/blog/error-establishing-a-database-connection-and-how-to-fix-this/): Walkthrough for fixing Error establishing a database connection error on a Wordpress blog using a mariadb database. - [iOS App Store ranking improvements with simple ASO techniques](https://mic.st/blog/ios-app-store-ranking-improvements-with-simple-aso-techniques/): Avoid common pitfalls when doing App Store Optimization. Tips on how to easily get started with ASO for ranking higher in the iOS App Store. - [Create a labeled TextField in SwiftUI](https://mic.st/blog/labeled-textfield-in-swiftui/): Short article or tutorial about how to create a labeled TextField in SwiftUI by using LabeledContent and LabeledContentStyle. - [Developing iOS Apps for Kids](https://mic.st/blog/developing-ios-apps-for-kids/): Intro into developing iOS apps in the kids category of the App Store. The review process or guidelines are a stricter to ensure kids' safety. - [Paywalls on visionOS or Vision Pro](https://mic.st/blog/paywalls-on-visionos-or-vision-pro/): Article about paywalls on visionOS or Vision Pro. Also some tips regarding monetization and pricing in general. - [Develop and Release a visionOS App without Vision Pro](https://mic.st/blog/develop-and-release-a-visionos-app-without-vision-pro/): Techniques for improving 2D interfaces with some new and easy to use SwiftUI features for developing and releasing your first visionOS App. - [Afternoon project with Raspberry Pi Pico Inky](https://mic.st/blog/afternoon-project-with-rasperry-pi-pico-inky/): It is really easy to get a Raspberry Pi Pico and Pimoroni's Pico Inky pack up and running. With the Pico W, even calling APIs is easy! - [SwiftUI and "The compiler is unable to type-check this expression in reasonable time ... "](https://mic.st/blog/swiftui-and-the-compiler-is-unable-to-type-check-this-expression-in-reasonable-time/): Collection of tips and tricks to mitigate the dreaded "The compiler is unable to type-check this expression in reasonable time" SwiftUI error. - [Accessibility improvements for UISearchController](https://mic.st/blog/accessibility-improvements-for-uisearchcontroller/): Article about improving accessibility for UISearchController. In general, think twice before conditionally hiding interactive elements. - [SwiftUI .ornaments modifier for visionOS App on Vision Pro](https://mic.st/blog/swiftui-ornaments-modifier-for-visionos-app-on-vision-pro/): Short article for quickly getting ornaments up and running inside any visionOS app. Most important: Set up a .plain window style. - [Connect Mac formatted (HFS+) USB drive to Raspberry Pi](https://mic.st/blog/connect-hfs-mac-formatted-usb-drive-to-raspberry-pi-and-access-its-data/): Short post describing all steps needed to connect an HFS+ formatted USB stick or drive to your Raspberry PI for accessing its contents. - [Quickly unxip files, e.g. Xcode](https://mic.st/blog/quickly-unpack-xip-files/): Short tip on how to quickly unpack or unxip any xip file, e.g. for a new Xcode beta release you want to quickly unpack. - [Barrierefreiheitsstärkungsgesetz (BFSG) for Apps, Websites or Digital Services](https://mic.st/blog/barrierefreiheitsstarkungsgesetz-bfsg-in-apps-or-digital-services-and-products/): Overview of how the German accessibility law Barrierefreiheitsstärkungsgesetz (BFSG) might affect apps, websites or services. - [Draw line graphs and charts in SwiftUI](https://mic.st/blog/draw-line-graphs-in-swiftui/): This article describes how you can use SwiftUI for drawing a simple line graph or chart with axis, ticks and labels. No 3rd SDK party needed! - [Using ChatGPT for Swift iOS development](https://mic.st/blog/how-to-use-chatgpt-for-swift-ios-development/): My experiences so far of using ChatGPT in the context of Swift iOS development. Examples for one problem statement in an app (with prompts). - [Fix LLDB issues in Xcode](https://mic.st/blog/fix-broken-lldb-in-xcode/): Thoughts about broken LLDB support of Xcode and how to deal with it. TLDR:Just use print() when LLDB seems broken. - [Preparing for CPACC exam by IAAP](https://mic.st/blog/how-to-prepare-for-cpacc-exam-by-iaap/): Post about how to prepare for CPACC exam by IAAP and which are probably the most difficult parts of the exam you should not underestimate. - [Micro-commits and how to continue where you left](https://mic.st/blog/how-to-remind-myself-of-where-i-stopped-coding-yesterday-micro-commits/): Short post about how to quickly get into the right spot of your codebase after stopping coding the day before and the power of micro-commits. - [European Accessibility Act in short](https://mic.st/blog/european-accessibility-act-in-short/): Short article about the European Accessibility Act, its consequences and possible first steps for conformance. - [(Mobile) Accessibility Links](https://mic.st/blog/mobile-accessibility-links/): List of links regarding mobile accessibility topics which will be frequently updated whenever I find something interesting. - [How to fix "Error establishing a database connection"](https://mic.st/blog/how-to-fix-error-establishing-a-database-connection-for-wordpress/): After updating some Wordpress plugins I got this error. This post has an easy solution for that. TLDR: Restart your server. - [How to update a website's SSL certificate running on debian using an Apache server](https://mic.st/blog/how-to-update-a-websites-ssl-certificate-running-on-debian-using-an-apache-server/): Renewing your SSL certificate for a website using Apache on a Debian server is easy if you know where the files are located. - [Animate UIBezierPath using CABasicAnimation](https://mic.st/blog/how-to-animate-uibezierpath-using-cabasicanimation/): A walkthrough on how to create simple but nice looking layer animations using UIBezierPath and CABasicAnimation of Swift's Core Animation. - [How to use the RelativeDateTimeFormatter in Swift](https://mic.st/blog/how-to-use-the-relativedatetimeformatter-in-swift/): In this blog post you will learn how to use the RelativeDateTimeFormatter in Swift for getting strings like "last week" from dates. - [How to sort an array of objects by date property](https://mic.st/blog/how-to-sort-an-array-of-objects-by-date-property/): This post will teach you how to sort an array of objects by a date property including how to conform to Comparable protocol. - [How to fix not updating wordpress posts caused by caching plugins](https://mic.st/blog/how-to-fix-not-updating-wordpress-posts-caused-by-caching-plugins/): Wordpress caching or optimization plugins they can make your newest posts unavailable. Here I show you how to fix not updating wordpress posts. - [How to get your first ever app approved in Apple's App Store](https://mic.st/blog/my-first-intransparent-app-store-review-adventure/): A short summary about the very long and intransparent App Store review for my first app. I give some tips about how to handle this difficult first review. - [How to easily animate updates of a tableview in Swift](https://mic.st/blog/how-to-easily-animate-updates-of-a-tableview-in-swift/): In this post you will learn how to easily animate updates of your tableview with different animations in just a few lines of code. - [Connect AM2320 temperature and humidity sensor to Raspberry Pi](https://mic.st/blog/connect-temperature-and-humidity-sensor-am2320-dht11-or-dht22-to-raspberry-pi/): Learn how to setup your Raspberry Pi to measure temperature and humidity with a sensor and how to read out measurements with Python. - [Draw graphs and charts in Swift easily with CareKit](https://mic.st/blog/draw-graphs-easily-with-carekits-ockcartesianchartview/): Learn to draw graphs and charts in Swift easily with CareKit, an open-source SDK by Apple. You just need an arrays of CGPoints to draw a nice looking graph. - [Minimal setup of Raspberry Pi Zero W with ssh over wifi connection.](https://mic.st/blog/minimal-setup-of-raspberry-pi-zero-w-with-ssh-over-wifi-connection/): You want a minimal Raspberry Pi setup without connecting a keyboard/mouse or screen? Here is a simple guide for setup over wifi using ssh. - [Fix crashing when opening projects in XCode 11.3](https://mic.st/blog/fix-crashing-when-opening-projects-in-xcode-11-3/): Today I had some problems with a project that I wanted to continue working on today. Yesterday everything went fine... - [How to play sounds when Unit Tests in XCode finish with success or failure](https://mic.st/blog/how-to-play-sounds-when-unit-tests-in-xcode-succeed-or-fail/): Currently I work on a project that has a lot of tests that take some time to finish. Usually I... - [Customizing your app's navigation bar titles buttons and background](https://mic.st/blog/customizing-your-apps-navigation-bar-titles-buttons-and-background/): The default navigation bar you get when implementing a UINavigationController does it’s job but often you want to customize it... - [How to use new iOS 13 system fonts like New York](https://mic.st/blog/how-to-use-new-ios-13-system-fonts-like-new-york/): At the WWDC19 there was introduced a lot of font related cool stuff for iOS13. One great thing is the... - [How to solve failing installation of wordpress plugins](https://mic.st/blog/how-to-solve-failing-installation-of-wordpress-plugins/): I wanted to install a wordpress plugin via the wordpress panel and I failed due to missing FTP rights. An... - [Hello, this is Michael! 😃](https://mic.st/blog/started-my-first-blog-%f0%9f%98%83/): Today I started my first blog. 🥳 In this blog, I will collect stuff that I found interesting to share... --- # # Detailed Content ## Pages ### sitemap - Published: 2025-05-23 - Modified: 2025-05-23 - URL: https://mic.st/blog/sitemap/ --- ### Feature Requests - Published: 2024-04-26 - Modified: 2024-04-26 - URL: https://mic.st/blog/feature-requests/ Here you can submit new ideas or vote on existing ones. You can also send an email via contact@mic. st (Longpress address to copy or send mail) --- ### Cookie Policy (EU) - Published: 2024-02-16 - Modified: 2024-02-16 - URL: https://mic.st/blog/cookie-policy-eu/ --- ### CPACC - Published: 2022-12-15 - Modified: 2022-12-15 - URL: https://mic.st/blog/cpacc/ --- ### Imprint & Privacy Policy - Published: 2021-06-02 - Modified: 2021-06-02 - URL: https://mic.st/blog/imprint-privacy-policy/ --- ### Portfolio > Personal Portfolio by Michael Steudter that includes links to iOS Apps, web projects, designs, summaries of features and technologies used. - Published: 2020-05-06 - Modified: 2024-11-05 - URL: https://mic.st/blog/portfolio/ iOS Apps Overview screen Analytics screen Creating a new room Home Renovation App Landingpage with all the features and release information: https://homerenovation. tips Technologies used SwiftData SwiftUI Apple Sign In Google Sign In In App Subscriptions using Revenue Cat Parse Framework Idea for this app During the process of buying a house I searched for an app that keeps track of the renovation budget in a really simple way. I did not find anything, that is why I decided to create someting. Also I did neither use the rather new SwiftData framework nor SwiftCharts. This app seemed like a good opportunity to try both of these. Features The basic idea is that you can have buildings, that can have floors, these floors do have rooms and the rooms do have renovations. This is the underyling relationship for everything. On top of this, you can track progress of renovations in a simple "todo" or "done" way. This is summed up across all renovations, rooms and floors to draw nice little graphics. Renovations always can have an estimated cost amount and a spent amount. This is currently just summed up and in a couple of places you can switch between both values to quickly compare them. E. g. if a certain floor, room or a whole building is above budget. There is an analytics screen that shows the different amounts in some interactive donut charts. Based on the timestamps for renovations I am planning to also include some time of historical overview... --- ### Portfolio_old - Published: 2020-03-01 - Modified: 2020-05-06 - URL: https://mic.st/blog/portfolio-old/ --- ### About Michael > Short story about Michael Steudter's journey to becoming an iOS developer after learning metal work and building machines. - Published: 2020-03-01 - Modified: 2024-11-11 - URL: https://mic.st/blog/about-michael-steudter/ I do work currently as an iOS Engineering Manager on a banking app. Progressed from mechatronics to studying Human Factors to developing iOS Apps. Besides that I do maintain some private app projects. See https://mic. st/blog/portfolio/ for more information on these. --- ### Privacy Policy - Published: 2020-03-01 - Modified: 2020-03-01 - URL: https://mic.st/blog/privacy-policy/ Who we are Our website address is: https://mic. st/blog. What personal data we collect and why we collect it Comments When visitors leave comments on the site we collect the data shown in the comments form, and also the visitor’s IP address and browser user agent string to help spam detection. An anonymized string created from your email address (also called a hash) may be provided to the Gravatar service to see if you are using it. The Gravatar service privacy policy is available here: https://automattic. com/privacy/. After approval of your comment, your profile picture is visible to the public in the context of your comment. Media If you upload images to the website, you should avoid uploading images with embedded location data (EXIF GPS) included. Visitors to the website can download and extract any location data from images on the website. Contact forms Cookies If you leave a comment on our site you may opt-in to saving your name, email address and website in cookies. These are for your convenience so that you do not have to fill in your details again when you leave another comment. These cookies will last for one year. If you visit our login page, we will set a temporary cookie to determine if your browser accepts cookies. This cookie contains no personal data and is discarded when you close your browser. When you log in, we will also set up several cookies to save your login information and your screen display choices. Login... --- --- --- ## Posts ### Error establishing a database connection on Wordpress Blog > Walkthrough for fixing Error establishing a database connection error on a Wordpress blog using a mariadb database. - Published: 2025-05-14 - Modified: 2025-05-21 - URL: https://mic.st/blog/error-establishing-a-database-connection-and-how-to-fix-this/ - Categories: Wordpress I have to admit that I do not really regularily write into this blog. Usually, whenever I have an idea, I write down a first draft and finish the post later, sometimes weeks later. Some days ago I had such an idea and realized that the blog was completely unreachable. Not sure for how long actually. The only thing it showed was this error saying "Error establishing a database connection" (see image below). The error show when entering https://mic. st, saying "Error establishing a database connection". Update: If you are lucky, everything is a little easier to fix as described in my older article: https://mic. st/blog/how-to-fix-error-establishing-a-database-connection-for-wordpress/ Investigating the error As nothing did work anymore from a frontend perspective, I quickly went into the webserver to find out what's going on. First of all, it was years ago since setting up the wordpress website so I was not even aware which kind of database was actually supposed to run. After finding out that it's "mariadb", I just wanted to try restarting the database service. A quick Google search lead to this: https://mariadb. com/docs/server/service-management/operations/start-stop-status/ Restarting can be done using: sudo systemctl restart mariadb Unfortunately, this just did not work. It exited with following error: Job for mariadb. service failed because the control process exited with error code. See "systemctl status mariadb. service" and "journalctl -xe" for details. As mentioned in the error, running systemctl status mariadb. service can give you a little more information about what did actually go wrong. As the... --- ### iOS App Store ranking improvements with simple ASO techniques > Avoid common pitfalls when doing App Store Optimization. Tips on how to easily get started with ASO for ranking higher in the iOS App Store. - Published: 2025-02-04 - Modified: 2025-02-04 - URL: https://mic.st/blog/ios-app-store-ranking-improvements-with-simple-aso-techniques/ - Categories: iOS Development - Tags: ASO, good-practice, iOS, Marketing When reading through iOS related subreddits, I often get the feeling that a lot of basic techniques regarding App Store Optimzation (or in short ASO) are seemingly not well known. Now and then there are comments or questions regarding ASO popping up in any of these subreddits: https://www. reddit. com/r/iOSProgramming/, https://www. reddit. com/r/iosdev/, https://www. reddit. com/r/SwiftUI/ or https://www. reddit. com/r/swift/. Doing ASO involves some work but it is no rocket science. The great thing about ASO is that it costs nothing (in contrast to ads). With very low effort you can improve your iOS App Store ranking. The best thing: You do not need to become an expert for seeing results. By avoiding common pitfalls you can often enough multiply your impressions or downloads. Let's get right into it! The article assumes that you did already upload an app to the App Store and you are able to find the input fields I am mentioning. Most importantly you should know where to change the app's title, its subtitle and keywords. TL;DR The App Store values keywords in the following order: App's title App's subtitle App's list of keywords Do never ever double any keywords across any of these three places. This is penalized by the algorithm. This also includes plurals or other forms of a word. E. g. do not use "travel" and "traveling" together, pick one of them. Do find a good balance between actually searched for keywords (high enough popularity) and having a change to actually compete for... --- ### Create a labeled TextField in SwiftUI > Short article or tutorial about how to create a labeled TextField in SwiftUI by using LabeledContent and LabeledContentStyle. - Published: 2024-08-28 - Modified: 2024-11-05 - URL: https://mic.st/blog/labeled-textfield-in-swiftui/ - Categories: iOS Development Today, I wanted to create a labeled TextField in SwiftUI. More specifically the label should appear as a small text above the TextField. My first quick hack was to just add a label above a TextField. Obviously, we can do better. Let me show you how. LabeledContent As a major thing in SwiftUI is its declarative syntax, it is not a big surprise that there is already an official element which does exactly what we want, i. e. labeling content. And it is also named like that. According to the official docs, it is "A container for attaching a label to a value-bearing view. " (see https://developer. apple. com/documentation/swiftui/labeledcontent). It is really exactly what we want. I mean almost. Default behavior The following snippet shows the bare minimum (with some styling of the textfield): LabeledContent { TextField("", text: $text) . textFieldStyle(. roundedBorder) . frame(width: 200) } label: { Text("Name") } It is a labeled Textfield but it is not exactly looking like what we wanted. It will result in something like this: LabeledContent wrapped around a TextField in SwiftUI As we see, the default layout is horizontal and not our desired vertical layout. Also there is a huge margin we do not want. Can we modify this? Yes, of course. Custom LabeledContentStyle A lot of SwiftUI elements can be modified by using an associated style configuration. Luckily, this is also possible for LabeledContent. By doing this instead of building a custom View, we still get all the nice SwiftUI sugar... --- ### Developing iOS Apps for Kids > Intro into developing iOS apps in the kids category of the App Store. The review process or guidelines are a stricter to ensure kids' safety. - Published: 2024-04-09 - Modified: 2024-04-09 - URL: https://mic.st/blog/developing-ios-apps-for-kids/ - Categories: iOS Development - Tags: iOS, Swift I do stumble now and then across (more or less great) apps for smaller children, kids or toddlers. You have probably seen these as well. I never released any app for the kids category but I was curious how it is done. So I started developing my first iOS app for kids. Match Pair Toddler Puzzle Game This mouthful of a title is not that fancy to look at. But it does its job. The title together with its subtitle ("Cute Animals, Cars & Fruits") is obviously just for app store optimization. The actual idea came when my own kid started to grasp the game of memory®. Small side note: The name memory® is a trademark of the German company Ravensburger. Consider this before releasing any similar games. I was contacted by Apple when my initial title contained something referring to this name. In my own version of this simple game you can add photos from your own camera roll. This is a paid feature (more the shop on that later). All of the default images are AI generated content. If you go that route in a kids app, pay extra attention to what is actually generated. In case you are interested in the final app, here is the link to it: https://apps. apple. com/us/app/match-pair-toddler-puzzle-game/id6479583158 The kids app store In the kids category you will see a lot of similar looking apps. To oversimplify: The common theme are vibrant colors plus cuteness overdose. I don't want to say it is... --- ### Paywalls on visionOS or Vision Pro > Article about paywalls on visionOS or Vision Pro. Also some tips regarding monetization and pricing in general. - Published: 2024-02-13 - Modified: 2024-04-15 - URL: https://mic.st/blog/paywalls-on-visionos-or-vision-pro/ - Categories: visionOS, iOS Development, Testing - Tags: Swift, SwiftUI, visionOS Lately, I released my first visionOS app. Actually, my personal deadline was the US release date (2nd of February 2024) and gladly everything worked out. You can read a little bit about it in my other article: https://mic. st/blog/develop-and-release-a-visionos-app-without-vision-pro/. One thing I struggled a little bit the last few days before submitting it for app review was the question: How do paywalls actually look like on visionOS or VisionPro? Do they have to be somehow different to the commonly known paywall (e. g. see the great collection at https://www. paywallscreens. com/ as a reference) ? What am I doing with all the space available? Do we have to somehow make them "spatial" (whatever that means), i. e. see https://superwall. com/blog/a-new-frontier-of-app-monetization-spatial-paywalls ? I will somehow try to give a few of my thoughts on this but also a little bit of monetization and pricing in general in this article. Why monetize at all (as an indie developer)? A lot was written about that already, e. g. see https://www. swiftjectivec. com/pricing-indie-ios-apps-according-to-perks-of-a-wallflower/. Basically to me it all comes down to: Do not undersell yourself, your work or the result of your work which is your app. I am barely listening to any podcasts, maybe one or two times a year but what actually made it click for me was a "SubClub" episode with Jake Mor (founder of Superwall, see https://superwall. com/). You can find the episode I am talking about here: https://www. everand. com/listen/podcast/614439392. Unfortunately, the sound quality is not so great but... --- ### Develop and Release a visionOS App without Vision Pro > Techniques for improving 2D interfaces with some new and easy to use SwiftUI features for developing and releasing your first visionOS App. - Published: 2024-02-08 - Modified: 2024-02-08 - URL: https://mic.st/blog/develop-and-release-a-visionos-app-without-vision-pro/ - Categories: visionOS - Tags: SwiftUI, Vision Pro, visionOS On February, 2nd there was the US release of Apple's Vision Pro which started (according to Apple) the era of "spatial computing". In case you are not a US citizen or flew to the US just for getting your hands on a device, you might ask yourself: Can I even develop or release an app for platform like visionOS without testing on a real device? Let me tell you: Yes you can! And in fact that is what I did. Some weeks after Xcode's first beta release with their Vision Pro simulator came out I started building some stuff. Initially, I thought now I have to learn using 3D objects somehow together with Xcode, learn shaders or even Unity. Luckily that is not the case. You can start really simple. I always wanted to create a "music app" and BeatFabrik is what I came up with, here is the link to the AppStore: https://apps. apple. com/us/app/make-music-with-beatfabrik/id6475737516? mt=8 It's basically a really simple digital audio workstation (DAW). Everything is based on AudioKit which is one of my most favorite 3rd party SDKs. It is in a 2D environment but with some touches it feels more native to visionOS (as far as I can tell from the simulator of course) SwiftUI for visionOS To quickly start developing for visionOS you do not really have learn a whole new language or way of developing. You can start really simple by using SwiftUI and adding some "spatial touches" to it. This was also the... --- ### Afternoon project with Raspberry Pi Pico Inky > It is really easy to get a Raspberry Pi Pico and Pimoroni's Pico Inky pack up and running. With the Pico W, even calling APIs is easy! - Published: 2023-12-10 - Modified: 2023-12-10 - URL: https://mic.st/blog/afternoon-project-with-rasperry-pi-pico-inky/ - Categories: Raspberry Pi, Electronics - Tags: Displays, Pico, python, Raspberry In the past, I already did electronics projects with a lot of different platforms, e. g different versions of Raspberry Pi, Atmel microcontrollers, some Arduinos and of course Lego Mindstorms . Today, I want to share with you how you can quickly get something running with a Raspberry Pi Pico and the Pico Inky add-on specifically made for it. If you did not hear about Pimoroni before, checkout their website. What they are doing or offering is just awesome: https://shop. pimoroni. com/. It is basically a shop with anything you need to get your weekend (or more) electronic projects up and running :) Handling microcontrollers is easier than ever As cheap as everything regarding electronics got, I defaulted to pre-soldered micro-controllers with a USB interface at some point. You can get these for under 5€ and do not need to hassle around with drivers/programming interfaces etc. Just plug them in and fire up your IDE. Gone are the times of broken micro-controllers because you did set the wrong “fuse bits” or did disconnect something at the wrong time Soldering your own circuits or laying them out from nothing on a breadboard with some Atmega / Attiny or whatever you prefer can still be fun. But for a quick project in between I really do prefer keeping the soldering iron where it is As it's way quicker to get everything up and running using pre-soldered boards with USB programmers and power supply already there. There are plenty of available options nowadays,... --- ### SwiftUI and "The compiler is unable to type-check this expression in reasonable time ... " > Collection of tips and tricks to mitigate the dreaded "The compiler is unable to type-check this expression in reasonable time" SwiftUI error. - Published: 2023-11-04 - Modified: 2023-11-12 - URL: https://mic.st/blog/swiftui-and-the-compiler-is-unable-to-type-check-this-expression-in-reasonable-time/ - Categories: iOS Development - Tags: good-practice, iOS, Swift, SwiftUI Although SwiftUI did become more and more mature over the years: When it comes to error handling, SwiftUI still sometimes feels like a pain. You probably have seen the following error more than once: It reads "The compiler is unable to type-check this expression in reasonable time; try breaking up the expression into distinct sub-expressions" and looks like this: For me personally one of the most dreaded errors in SwiftUI. It can be really time consuming to fix these with non-optimal set up your Views. I decided to write about this, as I get this error from time to time and it might make sense to collect anything that might have lead to this error here. See section "How can we fix it? " for any things you can try to fix it. Why is it that painful? Basically, this error just does not tell you anything. This sounds pretty dumb and it is. You can often just dig around what might have gone wrong. It just means what it says: The compiler gave up, try to fix it for yourself. I have no idea why this error still does appear for a couple of rather simple typo-like errors. When it appears, it often does feel like it came out of nothing. Of course it always caused by something you did wrong. But the point of this live compiler in my opinion should be to mitigate these simple but difficult to spot issues. For some reason it does not work... --- ### Accessibility improvements for UISearchController > Article about improving accessibility for UISearchController. In general, think twice before conditionally hiding interactive elements. - Published: 2023-10-10 - Modified: 2023-10-10 - URL: https://mic.st/blog/accessibility-improvements-for-uisearchcontroller/ - Categories: iOS Development, Accessibility By implementing UISearchController you can easily add search functionality to any UITableView. However, having such a search bar might have accessibility drawbacks. It might even be completely unusable users relying on Voice Over. This article is part of my more technical accessibility related content. You can see all of my accessibility articles by using the following link: https://mic. st/blog/tag/accessibility/ Quick Summary Make sure you are not relying on scrolling gestures for showing / hiding UI elements in general. When doing so, Voice Over user might never be able to focus these elemnts. Set hidesSearchBarWhenScrolling accordingly on the navigationItem associated with your search bar, e. g. check for UIAccessibility. isVoiceOverRunning, add a button for showing hiding or always show it to everybody. Hiding showing UI elements on demand It might seem reasonable to hide or show UI elements on demand, e. g. to save space on your screen or make it look less cluttered. However, this often can have usability or accessibility drawbacks, in fact the default UISearchController is a good (or bad) example for that as we see in the following section. Another example is when having a button, it's most of the times clearer to the user on how to proceed by just disabling it, instead of hiding it completely. So, let's say for interactive elements it's often a bad idea to conditionally hide or show them. At least double check if it really makes sense Hiding or showing the search bar There is a built-in feature for the... --- ### SwiftUI .ornaments modifier for visionOS App on Vision Pro > Short article for quickly getting ornaments up and running inside any visionOS app. Most important: Set up a .plain window style. - Published: 2023-09-27 - Modified: 2024-02-08 - URL: https://mic.st/blog/swiftui-ornaments-modifier-for-visionos-app-on-vision-pro/ - Categories: iOS Development Currently, I am experimenting on a Vision Pro app as a side project. One thing I was not aware of for quite some time was this new paradigm with the fancy name Ornaments only used on visionOS. I just happily added buttons near the bottom edge of my view. However, using an ornament is the way to go. It is basically a kind of elevated group of controls at the bottom of the view. You can read more on it in Apple's Human Interface Guidelines (HIG): https://developer. apple. com/design/human-interface-guidelines/ornaments/ Using new SwiftUI features If you want to learn about other new SwiftUI features you can use for making your visionOS app feeling "more home", please checkout my other article: https://mic. st/blog/develop-and-release-a-visionos-app-without-vision-pro/ How to implement ornaments When I first tried implementing my ornament, it just did not work. And I could not really find any useful information on why it did not work. What I found out about after sleeping over it: Your scene must not be of window style must not be . volumetric it has to be . automatic (or plain). If it's your initial screen also make sure to set UIWindowSceneSessionRoleApplication for the key UIApplicationPreferredDefaultSceneSessionRole inside of your info. plist. This means your info. plist should have this content: UIApplicationSceneManifest UISceneConfigurations UIApplicationPreferredDefaultSceneSessionRole UIWindowSceneSessionRoleApplication And your initial WindowGroup should look similar to this (so you can still set the view's bounds if you want): WindowGroup(id: someIDIfNeeded) { MyFunkyView } . windowStyle(. automatic) // or . plain . defaultSize(Size3D(width: 1.... --- ### Connect Mac formatted (HFS+) USB drive to Raspberry Pi > Short post describing all steps needed to connect an HFS+ formatted USB stick or drive to your Raspberry PI for accessing its contents. - Published: 2023-09-15 - Modified: 2023-09-20 - URL: https://mic.st/blog/connect-hfs-mac-formatted-usb-drive-to-raspberry-pi-and-access-its-data/ - Categories: iOS Development Today, I wanted to connect an USB drive to my Raspberry Pi and it did not work as easy as expected to access it's data. As a side note, it is a Raspberry Pi completely set up via terminal so there is no nice GUI where you can have a look what happens. I am by far a terminal expert so I googled around a lot during the process. This is what I found and worked for finally accessing the data on my Mac formatted USB stick. For setting up the Raspberry Pi itself, I wrote another post for that, see: https://mic. st/blog/minimal-setup-of-raspberry-pi-zero-w-with-ssh-over-wifi-connection/ Connect it First just connect it and see if your Raspberry can see it at all. E. g. type lsub which will give you something like this depending on your setup. pi@raspberrypi:/ $ lsusb Bus 002 Device 002: ID 0781:5591 SanDisk Corp. Ultra Flair Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3. 0 root hub Bus 001 Device 002: ID 2109:3431 VIA Labs, Inc. Hub Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2. 0 root hub The first one here looks pretty promising. Nice! So it's there. However, you still cannot just access it like you would do on your Mac or Windows machine. On Linux you have to "mount" it. Depending on your setup this might have happened automagically then you are basically done already. Check by typing to your terminal and see if there is any folder that looks like your usb stick.... --- ### Quickly unxip files, e.g. Xcode > Short tip on how to quickly unpack or unxip any xip file, e.g. for a new Xcode beta release you want to quickly unpack. - Published: 2023-08-12 - Modified: 2025-05-21 - URL: https://mic.st/blog/quickly-unpack-xip-files/ - Categories: iOS Development Ever wondered why unpacking a new Xcode release takes soooo long? I don't know either. Probably a lot of time is spent on validating signatures or other things. Anyway, sometimes you just want to quickly unpack it or unxip Xcode. Because Xcode is packed as a . xip file when manually downloading it. Here comes unxip it's an open sourced and easy to use command-line tool for unpacking . xip archives. In case you never manually downloaded Xcode before and only used the AppStore versions until now: Please have a look at the section "Manually downloading Xcode" and consider using manual downloaded versions from now on. How to install unxip The easiest way is to install it via brew using: brew install unxip Alternatively, you can get the release (or source code) at its Github page: https://github. com/saagarjha/unxip E. g. when you downloaded Xcode 15 beta 6 you just type: unxip Xcode_15_beta_6. xip Manually downloading Xcode You can download Xcode via the App Store. But: You should not. Basically, you do lose any control over it, i. e. when it does update itself. Just imagine: It can be a huge pain when you want to "quickly make a bugfix" and realize that Xcode just updated itself and nothing works anymore. You can get any version via Apple's developer website. But it is always a little inconvenient to dig through the website. Luckily, there is this handy website: https://xcodereleases. com/. It is not an official Apple website, however it links to... --- ### Barrierefreiheitsstärkungsgesetz (BFSG) for Apps, Websites or Digital Services > Overview of how the German accessibility law Barrierefreiheitsstärkungsgesetz (BFSG) might affect apps, websites or services. - Published: 2023-05-26 - Modified: 2023-05-26 - URL: https://mic.st/blog/barrierefreiheitsstarkungsgesetz-bfsg-in-apps-or-digital-services-and-products/ - Categories: Accessibility - Tags: Accessibility Image by Sang Hyun Cho on Pixabay You might have heard of the European Accessibility Act (EAA) as someone interested in accessibility in any kind of digital products. For me as a German iOS developer the Barrierefreiheitsstärkungsgesetz (or BFSG in short) is the specific national law to businesses offering websites, apps or any digital services need to conform (Spoiler: Not all have to). Most probably I do not have to directly deal with any legal texts (as long as I do not found any affected business myself). However, I think it's still interesting to get an idea of what is most important for conforming to BFSG as soon as there are discussions within your app's or digital service product team. If you never heard of EAA before, here is another post by me about it https://mic. st/blog/european-accessibility-act-in-short/ Disclaimer: I am not a lawyer by any means. With this article I just sum up some sources I found valuable for researching the question of how one might conform to BFSG in digital services, e. g. mobile apps. None of the following is any law advise. Ask your lawyer for that not me :-) One side note: BFSG is not only about websites, apps or digital services but that is the scope of this post. Law texts Since the EAA was enacted in 2019 some years went by. As mentioned before the German transposition into BFSG is already there now (since July 2021). BFSG mentions an executive order that was created roughtly... --- ### Draw line graphs and charts in SwiftUI > This article describes how you can use SwiftUI for drawing a simple line graph or chart with axis, ticks and labels. No 3rd SDK party needed! - Published: 2023-05-02 - Modified: 2024-02-10 - URL: https://mic.st/blog/draw-line-graphs-in-swiftui/ - Categories: iOS Development - Tags: graphs, iOS, SwiftUI Graphs and charts are an essential tool for visualizing data, and with SwiftUI, it's easy to create custom and interactive graphs (Spoiler: we won't add any interactivity during this arcticle). You can use them in iOS, iPadOS, and macOS apps. In this article, we'll explore how to draw a line graph in SwiftUI. In a follow up article I will show you how to draw bar graphs in SwiftUI. See my earlier article if you want to draw graphs in Swift: https://mic. st/blog/draw-graphs-easily-with-carekits-ockcartesianchartview/ Let's start with a really quick recap as you might still be pretty new to SwiftUI. Update: Native API for iOS 16. 0+ The following article is about building a view for showing graphs on your own. There is also Apple's own native framework for drawing graphs in SwiftUI that you can use starting iOS 16. 0+. If possible, you should use this native API, see: https://developer. apple. com/documentation/charts Thanks @Jem for leaving a comment about that! SwiftUI project Setup Let's take a quick moment to recap on SwiftUI. As you may know, SwiftUI is a modern UI framework that uses a declarative syntax to create user interfaces. For starters, it has way less boilerplate compared to defining UIs or views in general using Swift alone. However, the syntax can look a little strange if you are coming from Swift. To create a new SwiftUI project, launch Xcode and select "File" > "New" > "Project. " In the "Create a new Xcode project" window, select "App" and... --- ### Using ChatGPT for Swift iOS development > My experiences so far of using ChatGPT in the context of Swift iOS development. Examples for one problem statement in an app (with prompts). - Published: 2023-04-29 - Modified: 2023-04-29 - URL: https://mic.st/blog/how-to-use-chatgpt-for-swift-ios-development/ - Categories: iOS Development, ChatGPT - Tags: ChatGPT, iOS, Swift Lately, I also jumped onto the ChatGPT train and wanted to give it a try for the use in Swift development for the iOS platform. Here are my experiences so far using it for around 1 or two months now. How to get access without sharing your (real) phone number It's still free and pretty much unlimited as far as I know. I never ran into any server overload issues etc. You can just go to chat. openai. com register and start using it. The interface is pretty self-explanatory and straightforward. What kept me back the most all this time was not my disinterest but that you are forced to give them a real phone number. Which is still the case and it really sucks. Nobody knows what it's used for or who has access. It's a little shady. Don't spend any time on searching and trying these free online SMS receiver services. Non of them is working for registering for ChatGPT. I tried a lot of these for some hours. Just don't do it. A better time investment when you do not want to share your real number is to just get a prepaid SIM (here in Germany you can get them for around 5€) and put them in any cellphone. My use case in short I finally decided to order that burner SIM card and try it out, because I had a pretty clear use case in my mind. What I wanted to do was generating default plant... --- ### Fix LLDB issues in Xcode > Thoughts about broken LLDB support of Xcode and how to deal with it. TLDR:Just use print() when LLDB seems broken. - Published: 2023-04-28 - Modified: 2023-05-15 - URL: https://mic.st/blog/fix-broken-lldb-in-xcode/ - Categories: iOS Development - Tags: LLDB, tooling, XCode Did you ever encounter some strange issues when dealing with broken LLDB in Xcode leaving printas your final idea? Welcome to broken Xcode tooling. TLDR; or answer the title's question: Actually, I have no idea how to really fix it. For keeping your sanity, just use printwhenever LLDB seems broken. But let me explain or let's look at the symptoms first: Especially in async contexts LLDB seems really broken. You often get stuff like this: error: expression failed to parse: error: :8:1: error: cannot find 'destinationURL' in scope destinationURL ^~~~~~~~~~~~~~ If you are think using fr v or v might work here: Haha, no. (lldb) v destinationURL (Foundation. URL) destinationURL = In some cases the part using v or fr v might work but that is not the point here. Nobody can work with debugging tools that give ambiguous results or often don't work. forum. swift. org indicating brokenness It seems to be an ongoing problem for Xcode or the tools it contains. I stumble across it now and then, regardless of whether it's some strange Swift package manager of LLDB behavior. Often I ended up in some forum. swift. org thread. Actually, I learned whenever landing in some forum. swift. org thread while googling for anything Xcode / Swift related it seems to be a bigger issue. E. g. when googling for broken LLDB stuff I ended up here: https://forums. swift. org/t/yo-apple-xcode-debugging-swift-is-still-horribly-broken/62702/62). The essential learning in this case: There are plenty of people reporting bugs already, Apple doesn't seem... --- ### Preparing for CPACC exam by IAAP > Post about how to prepare for CPACC exam by IAAP and which are probably the most difficult parts of the exam you should not underestimate. - Published: 2023-01-05 - Modified: 2023-04-29 - URL: https://mic.st/blog/how-to-prepare-for-cpacc-exam-by-iaap/ - Categories: iOS Development, Accessibility - Tags: A11y, Accessibility, CPACC, IAAP, Learning In fall 2022 I finally felt comfortable to take the examination for becoming a "Certified Professional in Accessibility Core Competencies" (CPACC) by the "International Association of Accessibility Professionals" (IAAP). And in November I got an email that I passed it! Hooray! If you are thinking about taking the exam yourself or need some material for learning, here is a short write-up about how to prepare for CPACC :) Deque University Deque University is a well known provider of learning material and courses regarding accessibility. Luckily, they have an up to date course that was made specifically for the CPACC and also one for WAS (Web Accessibility Specialist). For me this was probably the most valuable resource for reading about everything. They have really nice learning material in a chapter or book-like style including great summaries, videos and quizzes. Actually, I only looked shortly in the official body of knowledge that is provided by IAAP (see in Resources section) Flash Cards Quizlet is a platform where you can save flash cards and learn them. I found two sets of cards that cover parts of the topics you should be familiar with. You are definitely required to know some definitions or terminology. So maybe register to that platform and create your own ones! Personally, I can learn definitions and terminology best with flashcards. However, it is definitely not recommended to start learning with those. You should really read a lot of material, watch videos etc (e. g. see Deque University above). Most... --- ### Micro-commits and how to continue where you left > Short post about how to quickly get into the right spot of your codebase after stopping coding the day before and the power of micro-commits. - Published: 2023-01-05 - Modified: 2023-05-15 - URL: https://mic.st/blog/how-to-remind-myself-of-where-i-stopped-coding-yesterday-micro-commits/ - Categories: iOS Development, Git - Tags: git, good-practice, micro-commits You should finalize your day with a building project. At least I like to do that. Often you need more than a day to finish some larger task. Also, if you are getting headaches, it's totally fine to stop coding for the day (and you probably really should). Still, it would be nice to know the next day where you left. Quick Tip Here is the quick tip: If you want to continue working on some problem you were not able to solve the day before, just add something that won't compile near that place. Next day trying to build the project will just fail at this point! This saves you from having post-its, notes etc. You see right in the code where you left. I'm doing that all the time when I get headaches in the evening and I feel it's better to do something else and come back the next day. Also: Micro commits Besides that, (it's a slightly different topic but still really important) always consider doing micro commits instead of having a dangling-in-the-air working copy for a long time. What are micro commits? You can read about it here in more detail: https://world. hey. com/niko. heikkila/a-practical-guide-to-micro-commits-a37151eb or https://www. industriallogic. com/blog/whats-this-about-micro-commits/. Basically, you should just commit any small step on your branch that builds. Some advantages of it: You can easily roll back stuff and see when stuff started to break. Your coworkers can help you out / take over if you are not able to work... --- ### European Accessibility Act in short > Short article about the European Accessibility Act, its consequences and possible first steps for conformance. - Published: 2021-12-31 - Modified: 2023-05-26 - URL: https://mic.st/blog/european-accessibility-act-in-short/ - Categories: Accessibility - Tags: Accessibility This article is not complete in any way. I am also not a lawyer. I try to add updates whenever something happens though :) In the US, creators of inaccessible digital products can already be sued because of the Americans with Disabilites Act (ADA). For example a visually impaired user sued the company running the website of singer Beyoncé. Also the pizza chain Dominos was sued for its inaccessible website and mobile app (see 1. in References). In the EU there was no similar act yet. However, this will come soon with the European Accessibility Act. Here is a very short list about the European Accessibility Act. If you want to go into more detail, I recommend to start from https://ec. europa. eu/social/main. jsp? catId=1202&langId=en 2018 the EU agreed upon the European Accessibility Act. Countries must translate this act into national law by June, 28th 2022 and apply this by June 28th, 2025. EN 301 549 is the European norm for digital accessibility and it mentions Web Content Accessibility Guidelines (WCAG) for how to apply this norm. WCAG 2. 1 (the most recent version) unfortunately focuses on web, version 2. 2 is currently in the making. This act targets more or less every app or website (see 2. in References) Does my app conform to the EU Accessibility Act, EN 301 549 or any national A11y law? I am not a lawyer in any way. But as far as I can tell it is currently a little bit unclear how... --- ### (Mobile) Accessibility Links > List of links regarding mobile accessibility topics which will be frequently updated whenever I find something interesting. - Published: 2021-12-21 - Modified: 2023-07-05 - URL: https://mic.st/blog/mobile-accessibility-links/ - Categories: Accessibility, iOS Development - Tags: Accessibility, iOS This is a frequently updated list of links regarding accessibility I found worth saving. It’s currently focused on mobile (especially iOS development) as this is my main area right now. Last update: 5th July 2023 Guidelines & Standards This section is focused on the European area because I am a citizen of the EU. Please be aware that standards and laws might be very different in your area. Regarding EU, also see my short blog post about the European Accessibility Act: https://mic. st/blog/european-accessibility-act-in-short/ or even more specific for Germany see my short intro on BFSG https://mic. st/blog/barrierefreiheitsstarkungsgesetz-bfsg-in-apps-or-digital-services-and-products/ LinkDescriptionhttps://www. w3. org/WAI/WCAG21/quickref/The WCAG is the guideline when it comes to digital accessibility. The most recent version is 2. 1. However, the guidelines are focused on web. Therefore, some rules are not directly applicable to mobile or need interpretation. The version 2. 2 of the guidelines is currently in the making and should include more mobile related topics. https://ec. europa. eu/social/main. jsp? catId=1202&langId=enQuick overview regarding the European accessibility act. In the US there is already the Americans with Disabilities Act (ADA) that requires companies to care for accessibility. https://www. etsi. org/deliver/etsi_en/301500_301599/301549/02. 01. 02_60/en_301549v020102p. pdfThe EN 301 549 is the European norm for digital accessibility. The standard is of importance together with the European Accessibility act (https://ec. europa. eu/social/main. jsp? catId=1485&langId=en). This norm also refers to WCAG. The official documents can be difficult to digest and to apply. Therefore, I would rather start working with simpler guidelines that refer to the official ones. https://www.... --- ### How to fix "Error establishing a database connection" > After updating some Wordpress plugins I got this error. This post has an easy solution for that. TLDR: Restart your server. - Published: 2021-12-21 - Modified: 2025-05-21 - URL: https://mic.st/blog/how-to-fix-error-establishing-a-database-connection-for-wordpress/ - Categories: Wordpress - Tags: Wordpress TLDR: Try doing a "Powercycle", i. e. shutdown and restart your server. I had a button for that in my server's control panel. Update: My blog was broken once again, with that error. This time some more was involved. See my second article: https://mic. st/blog/error-establishing-a-database-connection-and-how-to-fix-this/ Yesterday night, I updated some Wordpress plugins. Everything seemed to have went well, so I closed my laptop and went to sleep. This morning, I was welcomed with a message showing "Error establishing a database connection". On the wp-admin path there was some more explanation but all of this did not help. Obviously, I did not change any SQL login credentials so having a look at wp-config. php to check these as recommended seemed useless (and it was). I tried to login to my SQL database via command line which also did not work. I just got some socket error. Googling this, lead to more stuff that did not work. I tried to stop and restart my MySQL server which also did not work. Luckily, I did not try everything recommended there, as some would have easily destroyed everything (I guess). So, long story short: The easy solution was to login to my server's control panel and push that "Powercycle" button: Section in Netcup's "Customer Control Panel" to do a powercycle. Sometimes it's way easier than expected. Just pull the plug. --- ### How to update a website's SSL certificate running on debian using an Apache server > Renewing your SSL certificate for a website using Apache on a Debian server is easy if you know where the files are located. - Published: 2021-11-02 - Modified: 2022-01-01 - URL: https://mic.st/blog/how-to-update-a-websites-ssl-certificate-running-on-debian-using-an-apache-server/ - Categories: Wordpress - Tags: htaccess, Server, SSL, Wordpress Today, I wanted to quickly update my expired SSL certificate. This did not went as quickly as I thought and I nearly destroyed my whole server setup. However, one good thing: I also have my PHP upgraded now because it somehow stopped working during my efforts. Let's dive right into how to update an SSL certificate without destroying everything. This guide is kind of a reminder for myself on how to do the update because I will most probably forget by next year where the files are located. So keep in mind: For your setup it might look different. FYI: I have Debian running on some virtual server by Netcup. de and I use namecheap. com as my certificate provider. First, check your apache config to know where all the certificate and key files are located. The following command will show you some path below "Virtual Host Configuration". apachectl -SFor me, this shows: *:443 mic. st (/etc/apache2/sites-enabled/000-default-ssl. conf:1If you have setup an SSL certificate before and open this config file with nano using:nano /etc/apache2/sites-enabled/000-default-ssl. confthere should be some lines looking like this: # lots of comments # ... ServerName mic. st --- ### Animate UIBezierPath using CABasicAnimation > A walkthrough on how to create simple but nice looking layer animations using UIBezierPath and CABasicAnimation of Swift's Core Animation. - Published: 2021-07-14 - Modified: 2023-05-15 - URL: https://mic.st/blog/how-to-animate-uibezierpath-using-cabasicanimation/ - Categories: iOS Development - Tags: animations, iOS, Swift Currently, I am working on an app that features a table view with custom cells representing single items or grouped items. You can expand the group cells (to see their content) by selecting them. There are multiple ways to achieve this, I decided to use a custom UIViewController transition in that I animate a UIBezierPath with CABasicAnimation. During the custom transition, the layer drawn by the animated UIBezierPath is layed on top of the item. This makes it look as if the actual cell is expanding. After finally getting this animation done, I decided to write a post about it. The final view can be reused for a lot of different animations or can be at least a good starting point. So, in this post I will show you how to animate UIBezierPath using CABasicAnimation because even easy animations can be tricky. The animation we want to create. If you are not sure what a bézier curve actually is you can check out wikipedia for a more graphical reference how this works (https://en. wikipedia. org/wiki/B%C3%A9zier_curve) or have a look at Apple's documentation (https://developer. apple. com/documentation/uikit/uibezierpath). However, there might be a chance that you already have used bézier curves in some graphical tool (e. g. Photoshop, Sketch, etc). I think it's easiest to understand what happens if you already dragged around these curves in some tool. As easy as creating two paths Unfortunately, CABasicAnimation is not as easy as using UIView. animate. However, if you master this more sophisticated way of... --- ### How to use the RelativeDateTimeFormatter in Swift > In this blog post you will learn how to use the RelativeDateTimeFormatter in Swift for getting strings like "last week" from dates. - Published: 2021-04-03 - Modified: 2021-04-03 - URL: https://mic.st/blog/how-to-use-the-relativedatetimeformatter-in-swift/ - Categories: iOS Development - Tags: Formatters, iOS, Swift Working with dates in Swift is a thing I remembered to struggle for a long time as a Junior developer. However, you should get used to objects that have date properties. E. g. you can sort stuff (e. g. see https://mic. st/blog/how-to-sort-an-array-of-objects-by-date-property/) easily by date. If you ever tried to develop your own date formatter, you will quickly run into a lot of pitfalls (Even before talking about localization). Here, I will give you an overview on how to use the RelativeDateTimeFormatter in Swift. Currently, I am working on a private project that includes local notifications and a small dashboard that shows short information about these notifications. I wanted to make it friendly with something like "next notification in 18 hours", etc. So, how would you do that? My first solution was to just present the notification's trigger Date using the powerful and well known DateFormatter or DateComponentsFormatter plus some logic. This is totally fine and might work. However, there is also a nice formatter for just this single use case. Furthermore, one of the things I have learnt so far using Swift: If it's already built-in, do not reeinvent it because your solution is most probably worse (especially when localization is involved ) Formatting times in Swift can look as nice as this stock photo! (I am not sure why Apple did not mention this nice formatter in the Date and Times overview at https://developer. apple. com/documentation/foundation/dates_and_times. However, it is mentioned on the general overview with all the formatters:... --- ### How to sort an array of objects by date property > This post will teach you how to sort an array of objects by a date property including how to conform to Comparable protocol. - Published: 2020-12-20 - Modified: 2021-01-25 - URL: https://mic.st/blog/how-to-sort-an-array-of-objects-by-date-property/ - Categories: iOS Development - Tags: iOS, Swift You might know the very handy sort(by:) method in Swift that you can use to sort any kind of array. If not, see this as some kind of friendly introduction to you. Read carefully and I will teach you now how to sort an array of custom type objects by their date property The sort(by:) method is pretty well documented in Apple's official documentation: https://developer. apple. com/documentation/swift/array/2296801-sort This has actually nothing to do with sorting something by date but these teabags are nicely sorted anyway In a lot of cases you just call someArray. sort. This will sort an array of elements conforming to Comparable (e. g. Int, String and a lot of other type) in ascending order. If you want to sort it in ascending order you can just call someArray. sort(by: >). However, what if you have an array of some custom type that does not conform to Comparable and you want to sort this array by a date property this class has? A ComparisonResult can be . orderedDescending, . orderedAscending or . orderedSame. In order to sort our array of objects, we can just check these values. So how do we sort our array of objects by their date property? You can either pass in your sorting logic directly to the sort(by:) method or make your custom type conform to Comparable (which is probably the cleaner way). The documentation for sort(by:) says that you can basically do anything in the passed in closure to compare your array.... --- ### How to fix not updating wordpress posts caused by caching plugins > Wordpress caching or optimization plugins they can make your newest posts unavailable. Here I show you how to fix not updating wordpress posts. - Published: 2020-05-21 - Modified: 2020-05-21 - URL: https://mic.st/blog/how-to-fix-not-updating-wordpress-posts-caused-by-caching-plugins/ - Categories: Wordpress - Tags: Caching, Plugins, Wordpress Recently I had a problem with my wordpress blog I did not remark for some time. Whenever I updated new posts, the where only showing on the homepage when I was logged in. For the normal user who is not logged in, there was only an old version of my page appearing . Here I will give you a quick solution how to fix not updating wordpress posts. tl;dr Go to your admin panel and try to clear the cache in all your caching plugins (didn't work for me at all)Go to your server and delete or move the content of /wp-content/cache. I created another subfolder inside that folder where I moved all the stuff. Caching is the problem So when you google for the problem you will find very quickly that it is related to caching. This can be a browser issue (but it's probably not). You can check that if you open your blog in another browser you do not use normally or just clear your browser's cache. This will probably not help when your problem is the same like mine was: Server-side caching and probably misconfigured caching plugins. Basically the problem is that whenever some client asks for your blogs content, the misconfigured caching plugin delivers some old cache that does not include your most recent posts. Check your messy plugin section For me: A quick check on my admin page revealed that I installed three different "cache optimization plugins". The usual suspects are "W3 Total Cache",... --- ### How to get your first ever app approved in Apple's App Store > A short summary about the very long and intransparent App Store review for my first app. I give some tips about how to handle this difficult first review. - Published: 2020-05-06 - Modified: 2021-07-15 - URL: https://mic.st/blog/my-first-intransparent-app-store-review-adventure/ - Categories: iOS Development - Tags: iOS While publishing FlippyApp (https://mic. st/blog/portfolio/) to the App Store (https://apps. apple. com/us/app/flippylearn/id1479486387) I learnt a lot about how to deal with the intransparent review process of the Apple App Store. The two most important: The review process is very intransparent. Quick Help: If you get any incomprehensible rejection messages, google them. Probably a lot of people got the same message. Although it feels like talking to a wall sometimes when answering rejection messages, be honest and give as much information as possible. Quick Help: If they accuse you of anything, take that accusation, think about it and answer it with honesty. The first version of my app was rejected with a default text message. A quick google search showed me that a lot of people got (maybe still get) this exact message when submitting apps for the first time. Apple accused me of violating the App Store Review Guidelines. They also attached a bullet point list of possible violations. Actually, I did not violate any of the given points and I answered that. This did not help anything it resulted in just another default answer which now said my whole account was under investigation ? ! They also added I should not write any further mails and wait for there review or any instructions. So I did. Half year later: Still no answer. So I decided to write them another mail, although they explicitly asked me to wait. I took every bullet point and gave a detailled answer why I... --- ### How to easily animate updates of a tableview in Swift > In this post you will learn how to easily animate updates of your tableview with different animations in just a few lines of code. - Published: 2020-05-02 - Modified: 2020-05-02 - URL: https://mic.st/blog/how-to-easily-animate-updates-of-a-tableview-in-swift/ - Categories: iOS Development - Tags: animations, Swift, TableView Currently I work on a side project that uses a lot of UITableViews for all the different settings within the app. Whenever you change the the datasource of your tableview you need to update it. Here I want to show you a simple way (probably the easiest) how to easily animate updates of your tableview in Swift. Updating UITableView without animations If you do not want to have any animations when updating your UITableView you can just call reloadData as you probably know. You can read more about it here: https://developer. apple. com/documentation/uikit/uitableview/1614862-reloaddata. This approach does the job but it does not look very nice: Updating UITableView without animations using reloadData. Updating your tableview without any animations does not look very nice. You should avoid that. Luckily, there is a very simple way to trigger animated updates in a UITableView. Here come's reloadSections(_:with:) (see: https://developer. apple. com/documentation/uikit/uitableview/1614954-reloadsections). As the first parameter you pass in an IndexSet which basically is an array of integers for the sections you want to update. With the second parameter (UITableView. RowAnimation) you define the animation of the updates. Here you can see the documentation for all the available animations: https://developer. apple. com/documentation/uikit/uitableview/rowanimation. If you want to update the whole UITableView simply pass in an array of all the sections. For this purpose I just created an instance of IndexSet like that: IndexSet(integersIn: 0... tableView. numberOfSections - 1) In the next two chapters I give you a litte preview how some of the animations can look... --- ### Connect AM2320 temperature and humidity sensor to Raspberry Pi > Learn how to setup your Raspberry Pi to measure temperature and humidity with a sensor and how to read out measurements with Python. - Published: 2020-04-21 - Modified: 2020-04-22 - URL: https://mic.st/blog/connect-temperature-and-humidity-sensor-am2320-dht11-or-dht22-to-raspberry-pi/ - Categories: Raspberry Pi, Electronics - Tags: AM2320, DHT11, DHT22, humidity sensor, python, Raspberry, Temperature sensor This year I wanted to grow a lot of vegetables in the garden behind our apartment. The last few years I already grewed tomatoes and cucumber on my balcony. Of course a garden is so much better to grow stuff because there is just a lot more soil and room. However, it is safer to help the germination by using an indoor greenhouse. Luckily I got a pretty nice one as a birthday present . I installed some LED lights inside that should help the seeds to grow once they have germinated. As a side effect, the warm up the greenhouse. To have better insights about temperatures on the different levels of the greenhouse I wanted to use a Raspberry Pi and connect some temperature sensor to it. Consequently, I would install some simple air conditioning if it appears to be too hot inside. Temperature and Humidity sensor for the Raspberry Pi Luckily there is the AM2320 (and its variants) that can be easily connected to a Raspberry Pi. It is not only a temperature sensor, it can measure humidity as well. There are presoldered boards with three pin outbreaks that do not even require to solder any resistors to it. I just bought three of them on ebay because they have almost the same price as the sensor itself. There is an easy to use library by the great people from Adafruit that you can use for reading the sensors. It includes code for all the supported variants. See... --- ### Draw graphs and charts in Swift easily with CareKit > Learn to draw graphs and charts in Swift easily with CareKit, an open-source SDK by Apple. You just need an arrays of CGPoints to draw a nice looking graph. - Published: 2020-04-13 - Modified: 2023-05-15 - URL: https://mic.st/blog/draw-graphs-easily-with-carekits-ockcartesianchartview/ - Categories: iOS Development - Tags: CareKit, ChartView, Graphics, GraphView, Swift Did you ever want to use Swift to draw simple graphs and charts in your iOS app without using some 3rd party library? Also you did not want to reinvent the wheel with CoreGraphics? I thought that was not possible until I found out about a really nice open source SDK owned by Apple that you can use for that. Here comes CareKit! https://developer. apple. com/documentation/carekit Are you looking for how to draw graphs in SwiftUI? Check my other blog post: https://mic. st/blog/draw-line-graphs-in-swiftui/ A (very) short introduction to CareKit CareKit is an open source SDK by Apple that was intended for the use in health management apps. Of course, you do not have to develop a health management app to use it. You can use it for just anything ! One cool thing about the SDK: The owners of the repository splitted it up into several packages so you if you just want to draw nice looking user interfaces with the SDK you do not need to import the whole thing . I played around with the graph drawing functionality recently which I want to present to you in this quick overview. I really like it because firstly it is looking nice and secondly it is really easy to use. The following image shows a line graph you can draw pretty quickly with some self explanatory methods. Fancy stuff like this You basically just throw in an array of points and the OCKGraphView does all the heavy lifting for you.... --- ### Minimal setup of Raspberry Pi Zero W with ssh over wifi connection. > You want a minimal Raspberry Pi setup without connecting a keyboard/mouse or screen? Here is a simple guide for setup over wifi using ssh. - Published: 2020-04-04 - Modified: 2023-07-07 - URL: https://mic.st/blog/minimal-setup-of-raspberry-pi-zero-w-with-ssh-over-wifi-connection/ - Categories: Raspberry Pi - Tags: Raspberry, Raspbian Lite, ssh Update July, 2023: Nowadays, I would recommend using the "Raspberry Pi Imager". You can download it here: https://www. raspberrypi. com/software/. It's much faster than doing all the manual work. Just make sure that you select as OS the minimal version without any desktop. The tool can download the image itself, format your SD-card and install it correctly on it. Also it has options for presetting the wifi connection and other stuff. What is special about this minimal setup? Basically, you could just install any of the preconfigured Linux distribution available. However, these often include features you do not necessarily need and also setup is often dependent on input devices. When following this instruction, you do not need to connect any input devices for setting up your Raspberry Pi. You just need a wifi connection as you will set up everything over ssh. All kinds of projects can be done with this setup as most of them do not require any external input devices or HDMI monitors. Let's get started! Download Raspbian Lite Image:https://www. raspberrypi. org/downloads/raspbian/ Find your SD-card with:diskutil list Unmount SD-card with:diskutil unmountDisk /dev/diskX (X is the number of your SD-card you found out in the step before) Copy the image to your SD-card with:sudo dd bs=1m if=theImagePath. img of=/dev/rdiskX conv=sync Please make absolutely sure, that the number ("X") belongs to your SD-card! To connect to your wifi network, add file called wpa_supplicant. conf to partition "boot" (e. g. via finder), with the following content: ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev update_config=1 country=DE... --- ### Fix crashing when opening projects in XCode 11.3 - Published: 2020-03-19 - Modified: 2020-04-13 - URL: https://mic.st/blog/fix-crashing-when-opening-projects-in-xcode-11-3/ - Categories: iOS Development - Tags: iOS, XCode Today I had some problems with a project that I wanted to continue working on today. Yesterday everything went fine but today XCode crashed everytime I tried to open it Luckily there is a fix, that I found in a blog from 2014 (see link below). I had to do one additional step to make it work again. So here are all the steps I needed: Go to your project folder, right click on your project file (*. xcodeproj), click "Show package contents"Delete the folder xcuserdataRight click open project. xcworkspace inside that project file, delete xcuserdata there as well. Delete everything in your beloved Derived Data. Its default location is ~/Library/Developer/Xcode/DerivedData. You can also navigate there from within a working project via XCode's menu: Xcode/Preferences/ Locations/Your broken project should open now. If it does not build, e. g. with some ". plist error", you should clean your build folder by pressing + + K Now everything should work again Sources: https://pinkstone. co. uk/xcode-crashes-every-time-you-open-it-and-how-to-fix-it/ --- ### How to play sounds when Unit Tests in XCode finish with success or failure - Published: 2020-03-06 - Modified: 2020-03-06 - URL: https://mic.st/blog/how-to-play-sounds-when-unit-tests-in-xcode-succeed-or-fail/ - Categories: iOS Development Currently I work on a project that has a lot of tests that take some time to finish. Usually I switch to working on something else while the tests are running in the background. Sometimes I deep dive into the other stuff so that I nearly forget about the tests I started before I thought it would be nice to get some acoustic notification when all tests are finished. Luckily this is already implemented in XCode! Go to XCode's PreferencesSwitch to BehaviorsGo to Section TestingPick whatever you want for succeeding or failing tests. You can even use speak announcements (which I think is kind of annoying). I like the sound Glass for succeeding tests and Blow for failing tests. --- ### Customizing your app's navigation bar titles buttons and background - Published: 2020-03-01 - Modified: 2020-03-01 - URL: https://mic.st/blog/customizing-your-apps-navigation-bar-titles-buttons-and-background/ - Categories: iOS Development - Tags: AppDelegate, customizing, Navigation bar, UINavigationBar, UINavigationController The default navigation bar you get when implementing a UINavigationController does it's job but often you want to customize it because it just does not look so fancy. To customize the background of your UINavigationBar you set its backgroundImage property which means you have to provide a UIImage even if you want to give it a single color. I created an extension for UIImage that makes it easy to create instances of UIImage on the fly. extension UIImage { /// This function creates a 1x1 pt colored image static func withColor(color: UIColor) -> UIImage { let rect = CGRect(x: 0, y: 0, width: 1, height: 1) UIGraphicsBeginImageContextWithOptions(rect. size, false, 0) color. setFill UIRectFill(rect) let image: UIImage = UIGraphicsGetImageFromCurrentImageContext ? ? UIImage UIGraphicsEndImageContext return image } } Now we can use this extension to create a background and use it as a background image for our navigation bar: /// Declare a white with 0. 8 alpha let background = UIImage. withColor(color: UIColor. white. withAlphaComponent(0. 8)) /// Set the color as background navigationController? . navigationBar. setBackgroundImage(background, for: . default) navigationController? . navigationBar. setBackgroundImage(background, for: . compact) If you want to make your navigation bar's background invisible you can just set it to an empty UIImage: navigationController? . navigationBar. setBackgroundImage(UIImage, for: . default) navigationController? . navigationBar. setBackgroundImage(UIImage, for: . compact) The shadow of the navigation bar is an image as well. Often you want to make it invisible. You achieve this by setting the shadowImage property: navigationController? . navigationBar. shadowImage = UIImage If... --- ### How to use new iOS 13 system fonts like New York - Published: 2020-03-01 - Modified: 2020-03-01 - URL: https://mic.st/blog/how-to-use-new-ios-13-system-fonts-like-new-york/ - Categories: iOS Development - Tags: iOS, New York, systemFont, UIFont At the WWDC19 there was introduced a lot of font related cool stuff for iOS13. One great thing is the new serif system font NewYork which can be used in your apps. To initialize a UIFont with this or any other of the new font styles, we have to use UIFontDescriptors. I did not know about these before but they basically allow you to initialise a font by describing its characteristics, e. g. the style of the font or its family name. So here we go: /// We use a computed property so that we can use this font easily wherever we want to. var newYorkFont: UIFont { /// 1. Initialize a system font with the preferred size and weight and access its `fontDescriptor` property. let descriptor = UIFont. systemFont(ofSize: 24, weight: . semibold). fontDescriptor /// 2. Use the new iOS13 `withDesign` to get the `UIFontDescriptor` for a serif version of your system font. The size is derived from your initial `UIFont` so set it to `0. 0` if let serif = descriptor. withDesign(. serif) { return UIFont(descriptor: serif, size: 0. 0) } /// 3. Initialize a font with the serif descriptor of your system font. Again: use `0. 0` as `size` parameter to prevent overriding the initial size we did set above. return UIFont(descriptor: descriptor, size: 0. 0) } It's always nice to use system fonts because they are already installed on your iOS device which means you do not have to load them manually into your bundle. With... --- ### How to solve failing installation of wordpress plugins - Published: 2020-03-01 - Modified: 2020-03-01 - URL: https://mic.st/blog/how-to-solve-failing-installation-of-wordpress-plugins/ - Categories: Wordpress I wanted to install a wordpress plugin via the wordpress panel and I failed due to missing FTP rights. An alert window appeared asking me for FTP or SFTP credentials. I pasted them in there but, this did not work. What worked for me is setting an additional snippet to my wp-config. php. Just add: define('FS_METHOD','direct'); at the end of your wp-config. php. This enables some direct mode where wordpress does not need an FTP connection to install plugins. If you still get a message saying something like "directory could not be created" you need to set the owner of the plugin folder to www-data (on Apache) and the access rights to 775. Sources: https://www. hongkiat. com/blog/update-wordpress-without-ftp/https://wordpress. org/support/topic/installation-failed-could-not-create-directory/ --- ### Hello, this is Michael! 😃 - Published: 2020-03-01 - Modified: 2020-03-01 - URL: https://mic.st/blog/started-my-first-blog-%f0%9f%98%83/ - Categories: Uncategorized, Wordpress Today I started my first blog. In this blog, I will collect stuff that I found interesting to share while becoming a better iOS developer. FYI: If you want to install a wordpress blog on your webserver as well, checkout the quick tutorial below. I think installing everything via ssh access from the terminal is probably the easiest and fastest method. It will take you about 10 - 15 minutes to get it up and running including the database configuration. Checkout this website for a quick tutorial: https://code. tutsplus. com/articles/download-and-install-wordpress-via-the-shell-over-ssh--wp-24403 --- ---