Category: Swift

I’ve seen something happen many times during my longish tenure as a software developer being amidst to some others who are new to it. They seem to have a complete lack of wanting to understand something before tearing into it. …

Learn slowly to develop quickly. Read More »

Your mileage may vary with this post, but in my case, I was chasing my tail for some time while finally coming to a solution. At work, I generally author all kinds of prototypes. Sometimes I use Xcode and author …

Verifying assets with the iTunes Store… solved Read More »

iOS allows each application to monitor up to 20 regions. That seems like a lot, especially when you figure that the regions are registered and can be triggered (entry and exit) even while your app is backgrounded or your phone …

Monitoring the closest 20 regions – how? Read More »

It’s almost time for WWDC17, this year in San Jose, CA instead of San Francisco. I haven’t been in several years because my lottery skills are obviously lacking. I managed to score one this year and I’m pretty excited. What …

WWDC 17 Packing List Read More »

Tagged with: , , ,

I am currently working on something that will display time in different time zones. However, you need to compare the user’s current time versus those at the target time zones to be accurate. This is what I figured out. It’s …

Getting hour offsets for local time versus a target time zone in Swift Read More »

Tagged with: ,

A post about tvOS UIFocus enlightenment and a helper Class that I use to help debug my user interface work. Above you’ll notice four buttons (a screenshot from my actual Apple TV). You’ll also notice a total of eight purple …

tvOS UIFocusGuide demystified Read More »

Tagged with: , ,

If you’ve been involved in tvOS application development, or you’re new to the whole process, you might find this post interesting in regards to user interface. I have recently been involved in tvOS dabbling. I’ve been creating a custom application …

Creating a tvOS parallax UIButton Read More »

This post is silly simple, but in the past, I remember doing things like this using Ranges.  You have a 2-line UILabel and you want a bold font for the first line, and then regular for the second. In Swift, …

Richer text for UILabels Read More »

If you’re ever using asynchronous network operations (say GET or POST) and want to return data when calling a method, you’ll quickly understand that it’s not so easy. But you’ll see below how you can do this fairly easily. Let’s …

Returning data from an async network operation in Swift Read More »

Tagged with: , , , , ,

I recently had a section of user interface where I had a UILabel that took up an iPhone’s full width. It contained text which would be dynamic over time, meaning that the text would update at times. I wanted to …

UILabel centered text – getting the text’s rect Read More »

I had a view that I rotate a lot, often more than 360 degrees (spins around a few times). Each time it stops, I wanted to determine the resulting “visual” angle. How does one go about doing that? rotateView is …

Getting the rotation angle after CABasicAnimation? Read More »

Tagged with: ,

Recently I had a project in a workspace to produce a framework of Objective-C and Swift code – supplied by someone else. I had a devil of a time getting it to build for me. And when I did, I tried …

keep it simple. Frameworks? Read More »

I recently played around recording audio on my Apple Watch. Doing that was easy enough, and I wanted to send the recorded file from the watch extension to the iOS application – and play it. I started messing around and …

Sending and playing an audio file from Apple Watch Extension to iOS Read More »

Tagged with:

Recently I was working with watchOS 3 and iOS – transferring data back and forth (not using reply callbacks). I was using .sendMessage, and messages from the iPhone to the watch were very quick. However, messages from the watch to …

watchOS3 communication to iOS (speed) Read More »

Tagged with:

I have a UIImageView that holds album artwork in a project. When I get a new now playing notification, instead of simply setting the image to the image view, I perform a crossfade. It’s a lot prettier that way. No …

iOS Bug: Occluded UIView with CABasicAnimation not redrawn Read More »

I recently had a strange request in regards to a UITableView. You see, the table in a UI could only display 3 rows before scrolling was enabled. Given the minute stature of this table, showing a user that there were …

Swift 3: Always display the UITableView scrollbar Read More »

If you have your UITableViews snap to their cells, you’ll end up with a more refined user experience. This solution I have works with cells that are consistent in their height (static). You could always work with dynamic heights if …

Swift 3: UITableView snap to cells Read More »

Tagged with:

Here it is in Swift 3, it’s a little different. I tried to use hypotf but it didn’t like CGFloat subtraction. override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) { if touches.first != nil { let pointCenter = CGPoint(x: self.view.frame.width …

Swift 3: Distance between two CGPoints Read More »

Coming from iOS to macOS, I wanted to read keyboard input in my macOS application. Not from a textfield but rather from the window itself. I thought this would be an easy task. After some trial and error, Googling, and …

iOS to macOS: Reading keyboard input Read More »

I declare this day a fine day having discovered non-Objective-C protocols! No more @objc protocol usage. Now it’s as simple as something like this: protocol myDelegate { func report(info:String) } class MyClass: NSObject { var delegate:myDelegate? var serviceType = “hephaestus” …

Protocol/delegates in Swift 3.0 Read More »

Tagged with: