Tag: Code

  • (Swift) Adding Audio

    (Swift) Adding Audio

    Utilize AudioToolbox and make a class, Sound, to pass in the filename of you audio file and it’s type. Tools: Then, call it like so:

  • (Swift) Stop Using the Storyboard

    (Swift) Stop Using the Storyboard

    I started learning Swift about three months ago and when I started I used the storyboard. This post will be a snippet of how you can stop using the storyboard! The major benefit of not using the storyboard is not having messy merge conflicts. Long story short, the storyboard file is a fairly large xml file and every time you open it something changes. Every…

  • (Swift) Layout Constraints

    (Swift) Layout Constraints

    A whiles back ago I was trying to learn how constraints work. Today, I still have no idea what the heck is going on. While learning, I can across a bunch of tutorials that helped. However, I don’t remember what blog I particularly liked. This post contains a couple of classes that I made to help me…

  • (Swift) Detect Typing

    (Swift) Detect Typing

    Here’s a snippet on how to detect typing on your Swift app. It’s pretty simple because we’re utilizing the UITextViewDelegate delegate. Aka, built in success – thank you Swift! Tools: This snippet is pretty short. See below for some code that will print out text when you type.

  • (Swift) Creating a UITableView

    (Swift) Creating a UITableView

    Here’s a snippet on how to make a UITableView. Check out the code below! Tools:

  • (Swift) Keyboard Visibility

    (Swift) Keyboard Visibility

    This post is about doing things when your keyboard is visible or not. You might want to have some animation when your keyboard comes into view, or you might want an alert to pop up. Whatever it may be, here’s a snippet for that. In the example below, I just have a UITextView and a UIButton set up so…

  • (Swift) Troubleshooting Lost Simulators

    (Swift) Troubleshooting Lost Simulators

    Have you ever ran into the issue of all of your simulators disappearing? I have. My buddy created a new project and when I cloned her repo, all of my simulators cleared out! Turned out that I needed to change my iOS Deployment Target. My buddy was running her project on iOS10.1 and I had not updated and…

  • (Swift) Make UILabel Conform to Length of Text

    (Swift) Make UILabel Conform to Length of Text

    Here’s a snippet of how you can make your UILabel conform to the width of your text. You want to use .sizeToFit() on your UILabel, otherwise you’d have to hardcode your label’s width in the CGRect. So, no more of this:

  • (Swift) zIndex zPosition

    (Swift) zIndex zPosition

    I’m a web person, and I almost always think web first. With CSS there’s a property called z-index and it’s responsible for positioning elements on the z plane. In iOS, there’s an analogous property on the layer of elements that you can augment called, zPostion.