KataClub - An extracurricular coding challenge area

Overview

KataClub

Welcome to the Kata Club!

This is an extracurricular coding challenge area. Our goal here is to provide some coding challenges to help you practice implementing the concepts we've covered. Several of these challenges are examples of what you might find in some coding interviews.

To do some of the challenges you'll need to

  1. clone this repo
  2. make a new branch
  3. complete the function / follow the instructions
  4. run the unit tests (if applicable)

Unit Tests

A unit test is a method to test a specific piece of code. The tests help us make sure our code is behaving as expected. Several of these challenges have solutions that can be validated with unit tests which we will provide when possible. Below is a rough outline of the general strategy.

  1. give a test case
  2. run your function
  3. compare your results from step 2 to the hardcoded version of what you expect to happen
  4. if they match then the test is a success

Example

this is a demo for a function and some tests that would go with it. The function should take in a string and return a greeting with the entered name in all caps.

func greetingAllCapsName(name: String) -> String {
     let allCapsName: String = name.uppercased()
     return "hello, \(allCapsName)!"
}

Below are some examples of unit tests that might be written for the function greetingAllCapsName.

The first test takes in "tyler" (all lowercase) as the given test case. We then run the function with the test case. Then we compare the test case to the hardcoded value ("hello, TYLER").

func testAllLowercaseName() throws {
     // Given
     let inputName = "tyler"
     
     // When
     actualResult = greeting(name: inputName)
     
     // Then
     XCTAssert(actualResult == "hello, TYLER", "entering all lowercase name returns an all uppercase name")
}

The second test takes in "TYLER" (already all caps). We want to confirm that when we give someting in all caps it doesn't behave strangely.

func testAllUppercaseName() throws {
     // Given
     let inputName = "TYLER"
     
     // When
     actualResult = greeting(name: inputName)
     
     // Then
     XCTAssert(actualResult == "hello, TYLER", "entering all uppercase name returns an all uppercase name")
}

In XCode

To run all tests

in Xcode use cmd + u to run the existing tests.

The image below shows us what it looks like after tests have been run. In this example, 3 tests failed. Our code may still run without errors, but the results of the code don't match the expected results.

image

If you run your code and get all green check marks then your function passed our unit tests and qualifies as a valid solution.

To run an individual test

Navigate to the file with tests for the specific challenge. In the image below the file circled in orange (DynamicTriangleTests) has the unit tests for the Dynamic Triangle challenge. Press the play button (circled in red) next to the test function you want to run. If the test passes the play button will change to a green check; if it fails it will turn into a red x.

image

Solutions

Dynamic Triangle
LOL nice try
You might also like...
The Feed API challenge with swift
The Feed API challenge with swift

The Feed API challenge - iOSLeadEssentials.com It's time to put your skills to the test! You are called to implement the RemoteFeedLoader to load a co

Code Challenge - Using Alamofire is a Swift-based, HTTP networking library, also Codable for Data Model and Combine Framework .

Code Challenge ##Using Alamofire is a Swift-based, HTTP networking library, also Codable for Data Model and Combine Framework . Alamofire is one of th

Flipgrid Challenge
Flipgrid Challenge

FlipgridChallenge Overview The project follows MVVM-FlowViewController architecture that scales nicely as more screens/flows are added. I have added c

Birthdays App Challenge set by Chalkboard

Chalkboard Birthdays App Challange This is an app that utilises a web api to provide the user an ordered list of birthdays youngest to oldest How to i

iOS NBA Challenge Based on Xcode 12.4, PR2S Project By: Oscar Pastás

iOS NBA Challenge Based on Xcode 12.4, PR2S Project By: Oscar Pastás iOS This test app consists of a list of users Considerations This test should be

My winning contribution to Apple's Swift Student Challenge 2021

SynthApp My winning contribution to Apple's Swift Student Challenge 2021 This repository contains an Xcode project and the final Swift Playgrounds fil

Starter project for the iOS code challenge

iOS Base Project for Podium Take-Home Challenge Introduction We have provided two version of this base project: one using UIKit, one using SwiftUI. Th

Code challenge iOS - Movies app

Code challenge iOS - Movies app Project structure The Common folder contains sha

Challenge-vip-delivery - Project for VIP (Clean Swift) Architecture Dev Sprints on Devpass
Challenge-vip-delivery - Project for VIP (Clean Swift) Architecture Dev Sprints on Devpass

VIP (Clean Swift) - Delivery App 🍕 Neste desafio, aplicaremos conceitos da arquitetura VIP para finalizar a implementação de um aplicativo. Desenvolv

Comments
  • bug with running tests

    bug with running tests

    This is the error that people are getting

    Screen Shot 2022-02-03 at 1 46 45 AM

    This is a fix that I found

    This fix will try to push my settings though Pasted Image- Feb 3, 2022 - 8-38-05am

    I think we probably need to do something with git ignore?

    bug 
    opened by tyler-lawrence 0
Owner
Tom
Software Developer in Detroit, MI
Tom
Coding challenge for hiring process of Sicredi company

Coding Challenge of Sicredi Screen Shots

Josias Fabrício 1 Dec 17, 2021
Gapo challenge happy coding ^^

Gapo Challenge Implement Notification List screen Demo on simulator Development Language: IDE: Xcode (version 13.2.1) iOS Deployment target: from vers

null 1 May 27, 2022
iOS Tech Challenge - Take Home Challenge

iOS Tech Challenge - Take Home Challenge Thank you for your interest in taking the iOS Tech Challenge. Preparation Please, compile the project in Xcod

null 0 Oct 18, 2021
Challenge-M2Y-TM4 - A challenge provided by Mobile2You, with the purpose of analyzing knowledge about UI, API consumption

Challenge-M2Y-TM4 Um desafio proporcionado pela Mobile2You, com proposito de ana

Felipe Brigagão de Almeida 0 Jan 31, 2022
TakeHomeChallenge - iOS Tech Challenge - Take Home Challenge

iOS Tech Challenge - Take Home Challenge Thank you for your interest in taking t

Michael 0 Feb 1, 2022
[Accepted] My WWDC21 Swift Student Challenge submission

My WWDC21 Swift Student Challenge submission I made a playground book that teaches you the basics of ARKit through interactive lessons. It covers posi

Zheng 25 Nov 12, 2022
WWDC2020 Swift Student Challenge - TheHackOfRayTracing playground book

wwdc2021 My wwdc2021 submission The HackOf RayTracing How to run Install swift playground from App Store on your Mac or iPad Double clik TheHackOfRayT

haoboxuxu 20 May 20, 2022
[Accepted] My WWDC2021 Swift Student Challenge submission chosen as one of the 350 winners!

Genetic Algorithms | WWDC21 This project was entirely built with SwiftUI. To direct download this Playground and run it on your Mac or IPad, click he

Fred Lacis 2 Dec 22, 2021
My Winning Submission for Apple's WWDC 2021 Swift Student Challenge

Symmetries This playground book gives a quick insight into the symmetry groups of 3-dimensional objects like the platonic solids. The user can play ar

David 4 Apr 23, 2022
🎉 WWDC 2021 Swift Student Challenge Winner 🎉 Dance Party allows users to record choreography and play against other users to try and match the key poses!

?? Dance Party ?? ?? WWDC 2021 Swift Student Challenge Winner ?? Installation Steps (Works on iPad Only) Clone or Download Unzip the .playgroundbook.z

Alan Yan 7 Oct 17, 2022