Project 5 – Word Anagrams

by | March 2, 2019

Project 5 – Word Anagrams

Jeff Summers

March 2, 2019

Today is the beginning of Project 5 in the 100 Days of Swift challenge. After the struggles I had with the Challenge tasks of Project 4 I will admit I am just slightly cautious about thinking I had this. Thinking back at the Learning Curve I described yesterday, I’m probably at the first trough which I defined as, “What was I thinking? This is Hard!”

At first I thought I was at the “Yeah, I got this!” phase but then first thing out of the gate with today’s tasks was an article on Capture lists in Swift: What’s the difference between weak, strong, and unowned references?. I’ll be honest, I have now read that article four times, I have entered the code from the article into a Swift playground and tried to dissect what it was doing and I am still completely lost.

I get that I should try to use [weak] for the capturing method because it has less of a chance of causing a memory leak (in the device running the code, not in my brain. I’m afraid I have a perpetual memory loss and no amount of capture lists or any other construct is going to fix that; or so my wife tells me). I think I understand that if I use “unowned” (not “unknown” which I typed in the playground first and I swear Xcode actually laughed at me). But I’m still not exactly clear where this fits within a real-world application. I’m hoping that during the Project 5 lectures and assignments I will finally get a grasp on this.

The project itself sounds fun, creating anagrams from words. Paul Hudson has a great way of teaching that brings things to life, so I am hoping to start digging myself out of the learning curve trough. One thing of note, this project starts with a Table View Controller but when you create a new project it creates it with a View Controller instead.

In the Setting Up phase of the project we’re asked to modify lines at the top of the View Controller file to change the class from UIViewController to UITableViewController. You then need to go into the main.Storyboard and change the view controller class and then embed a Navigation Controller. To me a shortcut is to delete the View Controller Swift file from the file manager and add a new file that uses the UITableViewController class. Then go into the main.Storyboard and delete the Root View Controller so you have a blank storyboard. Then add a Navigation Controller which will automatically add a Table View Controller and connect them for you. Then select the Table View Controller and using the Identity Inspector point it to the Table View Controller file you just created. It does the same thing, but it does make sure things are corrected and the file name for the Table View Controller matches what it is.

The other reason I like doing it this way is that the default file created with a UITableViewController already has the code for numberOfRowsInSection and cellForRowAt functions that we always need for a table view. It just saves a little bit of typing.

Tomorrow I’ll follow this up with the completion of Project 5 including the three challenges.

Share this Article

Posted by Jeff Summers

Author, technologist, and baseball aficionado specializing in information technology and developing new and creative ways to interact with the world around us. My goal is to extend the boundaries of what is possible and find ways to make the world a better place while having fun.

0 Comments

Trackbacks/Pingbacks

  1. Project 5 – Completion and Challenges – Jeff Blogs - […] is a continuation of yesterday’s post where I talked about Project 5 in the 100 Days of Swift challenge.…

Submit a Comment

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

Stay Connected

Search

More Articles

Pace Layered Architecture Categorization

Change is inevitable. Today’s computing environments are constantly in flux from internal and external forces that put demands on the systems and necessitate changes to maintain its value stream. Technology currency is a constant struggle that organizations must...

TBM, Another Holy Grail?

Technology Business Management or TBM as a term was coined around 2012 although many of the concepts making up this framework have been around for almost as long as there has been IT. In its simplest form, TBM represents the integration of business, technology, and...

Visionary or Dreamer?

Thinking back over your life you’ve met and worked with countless personality types. You have been a part of teams that struggled to complete simple tasks and the work felt meaningless. Perhaps your goal in these times was to just trudge through the mud hoping the...

Archives