Tag: Swift

It’s been a while since Apple added Swift fading support to AVAudioPlayer. I can’t remember when exactly, but I think it might have been since iOS 10.0. I have not used it in quite some time and recently had the …

AVAudioPlayer setVolume with fading – properly 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’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 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: ,

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:

I recently stumbled upon a really excellent article online entitled “UIDynamics, UIKit or OpenGL? 3 Types of iOS Animations For the Star Wars.” A lot of great discussion about performance of interesting techniques in a iOS user interface. I read …

Swift: Animating a mask for a UIView Read More »

Tagged with: , , ,

If you’re ever setting content for things using loops (who isn’t, right?), you might often use the loop variable in a string to label something. Item 1, Item 2, etc. Especially when you’re simulating or prototyping something that will consume …

[Swift] Quick number to word conversion Read More »

Tagged with: ,

I was asked recently to modify the UIScrollViews that I implemented in an iOS application design. The request was to have our scroll views behave like the ones that appear in the iOS App Store. Here is a screen capture …

[Swift] UIScrollView snapping into place like in the iOS App Store Read More »

Tagged with: , , ,

I spotted this extension somewhere online a while ago (kjmcneish?) that can come in pretty handy. extension String { // Returns a range of characters (e.g. s[0…3]) subscript (r: Range<Int>) -> String { let start = advance(self.startIndex, r.startIndex) let end …

String extension for range of characters/character at nth position Read More »

Tagged with: , ,