#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
}
circle-info

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.

circle-info

This produces a clean corner compared to the normal cornerRadius which does not perform so well. Examplearrow-up-right from @nathangitterarrow-up-right 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.

circle-info

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.

circle-info

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

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.

circle-info

Additional styles and further documentation can be found herearrow-up-right.

circle-exclamation
circle-info

Additional styles and further documentation can be found herearrow-up-right.

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.

circle-info

Further documentation can be found herearrow-up-right.

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.

circle-info

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