This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
// Update these fields | |
let nextRetroDate = "01/01/2021" | |
let team = [ | |
"Name 1", | |
"Name 2", | |
"Name 3" | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
func flagEmoji(for countryCode: String) -> String? { | |
guard Locale.isoRegionCodes.contains(countryCode) else { return nil } | |
return countryCode | |
.uppercased() | |
.unicodeScalars | |
.map { 127397 + $0.value } | |
.compactMap { UnicodeScalar($0) } | |
.map { String($0) } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
struct User: Decodable { | |
var firstName: String | |
var lastName: String | |
var pets: [Pet] | |
struct Pet: Decodable { | |
var species: String | |
var breed: String |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func run() { | |
let arguments = CommandLine.arguments | |
if arguments.count > 1 { | |
let greeting = arguments[1] | |
print(greeting) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
func run() { | |
let arguments = CommandLine.arguments | |
print(arguments) | |
print("Hello, World! This is my command line tool") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
print(“Hello, World! This is my command line tool”) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let numbers = [1,2,3,4,5,6,7,8,9,10] | |
let evenNumbers = numbers.compactMap { $0 % 2 == 0 ? $0 : nil } | |
print(evenNumbers) //returns [2,4,6,8,10] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let midfielders = ["Barnes", "McManaman", nil, nil, "Gerrard"] | |
let midField = midfielders.compactMap { $0?.uppercased() } | |
print(midField) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let playersUpper = players.flatMap{ $0.map { $0.uppercased() } } | |
print(playersUpper) | |
// Returns ["OWEN", "FOWLER", "RUSH", "BARNES", "MCMANAMAN", "GERRARD", "CARRAGER", "THOMPSON", "NICOL"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let forwards = ["Owen", "Fowler", "Rush"] | |
let midfielders = ["Barnes", "McManaman", "Gerrard"] | |
let defenders = ["Carrager", "Thompson", "Nicol"] | |
let players = [forwards, midfielders, defenders] | |
let allPlayers = players.flatMap { $0 } | |
print(allPlayers) // returns ["Owen", "Fowler", "Rush", "Barnes", "McManaman", "Gerrard", "Carrager", "Thompson", "Nicol"] |
NewerOlder