Home » How to create a simple iOS app — with cards

How to create a simple iOS app — with cards

Working with views and arrays and dictionaries

Introduction

This is all a hobby for me. I’m not a professional developer. I know that it is hard to follow some tutorials, especially those that go deep into theory or are heavy in terminology. Here you’ll just get some info on how to get stuff done. Not always very useful stuff. Just stuff.

In today’s example, you’ll learn how to create a simple iOS app using Xcode with design elements that are loaded programmatically onto the canvas. It won’t be pretty, but if you’re only interested in something a bit more complicated than “hello world,” here you go.

The goal

This tutorial covers how to get some “views” onto the “canvas.” Specifically, we’ll be placing cards onto the canvas. Like this (minus the background):

Cards dealt left-to-right
Expected “dealing” order… left-to-right

Instructions

I’ll assume my audience consists of novices like me. Here are some barebones instructions:

  1. Copy this code into your clipboard. I won’t go over it here, or comment too much on it, but you can at least see how quick and easy it is with just a little bit of code to get stuff to appear on your canvas:
  2. Create a new project:
    Create a new project
    Create a New Project
  3. Select “Single View Application”
    Single View Application
    Single View Application
  4. Name the Project (and save it)
    Name the application
    Name the application
  5. Select the ViewController.swift File
    The View Controller
    The View Controller

  6. And Paste the script:
    Paste the Script
    Paste the Script (see code above)
  7. Create “card” images and paste them into the Assets.xcassets folder. Note: a full list of the card images (and their names) you’ll need are in the dictionary array. For instructions on how to do this, see this post (coming soon).
    Assets
    Assets
  8. Ctrl-R
  9. In the simulator, go to rotate the view Left or Right to see everything.

Leave a Reply

Your email address will not be published. Required fields are marked *


*