Category: Swift 4.0

Ducking Sound in AVAudioSession

title shot

Ducking has nothing to do with waterfowl. Sometimes you’ll want to add sound to your app, but the user will be using the music or others app along with your app.  For that, you’ll want to slightly lower the volume of the background music…

Actions in Table Views

Sometimes table views could use a few buttons. There’s two delegates which create swipe buttons on table view cells. Let’s learn how you can implement these buttons and an interesting hidden feature you can do with them.  There is two delegate methods, one for…

Ranges in Swift

You’ve probably used ranges in loops, without knowing it, but ranges are really a type in Swift. Have you ever thought about ranges and all their power? I’ll show you a few things you might want to know about Swift ranges. I’ve put a…

Sliders as Knobs

You’ve seen other apps rotate views, but you may have no idea how to do it yourself. Let me show you one way to rotate views. We’ll make a simple knob control you might be able to use in your apps. Download the example…

CALayer Masks

UI doesn’t have to look like a rectangle. You might want a different shape for your icon. You can do that with layer masks. Let’s learn how to set them up. Download the example files. You’ll find an app with two square buttons. If…

Draw Paths in UIViews

In a previous tip, I drew rectangles and circles in a UIView. This time, let’s add lines and curves using paths to draw some toast. Download the playground I set up for you.  I set up my code to do all the drawing in…

Make Round Buttons and UIViews

In the good old days, Apple used a lot of rounded corner buttons. Many developers use several images to get the effect of round buttons. The CALayer of UIButton does have a feature for you to easily get rounded corners, and even circular buttons….

Use the Speech Synthesizer

It’s sometimes nice to add a little sound to your applications, and even better to add a voice. Outside Siri, you can use a cool and simple AVFoundation API to make iOS devices talk. Let’s learn how to use the Speech synthesizer. Download the…

Customizing Tab Bar Controller Icons.

One of the more perplexing parts of using tab bar controllers is customizing tabs. If you understand some of the properties of an image, You can do some major customization. Download the example file. If you open the main storyboard you’ll see three view…

Timer Accuracy in iOS

It’s buried in the docs, so you might not know how inaccurate Timer objects can be if you are trying to show the time. Let’s look at that inaccuracy and how to work around it. You’ll find in the exercise file on GitHub a…