#100DaysOfCode - Antique

Listed below are my entries to #100DaysOfCode

Day 1: Distance between two CLLocation objects.

The code below is written in Swift and as of Xcode 11.5 and iOS 13.5.x is still correct.

func distance(me: CLLocation, other: CLLocation) -> Double {
    return me.distance(from: other) / 1000 // km
}

func distance(from location: CLLocation) -> CLLocationDistance returns the value in metres and can be divided by 1000 to return kilometres or 1609.34 to return miles.

Day 2: Generating a random password

The code below is written in Python and as of Python 3.8.x is still correct.

def generatePassword():
    lowercase = "abcdefghijklmnopqrstuvwxyz"
    uppercase = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
    numbers = "1234567890"
    special = "!@#$%^&*()[]{}-_=+|;:'""',.<>/?"


    password_length = input("Enter desired password length:\n")
    length = int(password_length)

    allow_special = input("Allow special characters? (Y/N)\n")
    allow_special_chars = str(allow_special)


    password = ""
    for char in range(length):
        if allow_special_chars.upper() == "N":
            password += random.choice(lowercase + uppercase + numbers)
        else:
            password += random.choice(lowercase + uppercase + numbers + special)

    print(password)


# usage: generatePassword()

Day 3: Tweet a Reddit post with a specific flair

The code below is written in Python and as of Python 3.8.x is still correct.

Day 4: Corners as round as Kim's...

The code below is written in Swift and as of Xcode 11.5 and iOS 13.5.x is still correct.

This produces a clean corner compared to the normal cornerRadius which does not perform so well. Example from @nathangitter on Twitter. Taken from my writeup here.

Day 5: Cutting a transparent hole in a UIVisualEffectView

The code below is written in Objective-C and as of Xcode 11.5 and iOS 13.5.x is still correct.

The idea for this came when looking at Apple's Control Centre toggles, most have a transparent toggle with a slight blur, writing this in Carbonite (a project of mine) lead to this code snippet.

Day 6: Logging NSString objects to a file

The code below is written in Objective-C and as of Xcode 11.5 and iOS 13.5.x is still correct.

Day 7: Using MPMusicPlayerController methods

The code below is written in Objective-C and as of Xcode 11.5 and iOS 13.5.x is still correct.

Day 8: Writing an API wrapper for weatherstack.com

The code below is written in Objective-C and as of Xcode 11.5 and iOS 13.5.x is still correct.

The code above is the first available wrapper for https://weatherstack.com written in Objective-C. Developed by me, @antique_dev.

Day 9: Convert NSTimeInterval to NSString

The code below is written in Objective-C and as of Xcode 11.5 and iOS 13.5.x is still correct.

Day 10: Convert NSDate to NSString and vice versa

The code below is written in Objective-C and as of Xcode 11.5 and iOS 13.5.x is still correct.

Day 11: Achieving different blurs in Logos

The code below is written in Objective-C (Logos) and as of iOS 13.5.x is still correct.

Additional styles and further documentation can be found here.

Additional styles and further documentation can be found here.

Day 12: NSFileManager and its many uses

The code below is written in Swift and as of Xcode 11.5 and iOS 13.5.x is still correct.

Further documentation can be found here.

Day 13: Displaying a window above SpringBoard (iOS 13 and below).

The code below is written in Objective-C and as of iOS 13.5.x is still correct.

Remember to set the windowLevel, a good level is 1089 which shows the window above everything while not being too high.

Day 14: Compressing and decompressing data

The code below is written in Swift and as of iOS 13.5.x is still correct.

Day 15: Getting an iOS device's UDID (Jailbroken)

The code below is written in Objective-C and as of iOS 12.x is still correct.

Last updated

Was this helpful?