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
struct CreditCardView: View { | |
var body: some View { | |
VStack(alignment: .leading, spacing: 20) { | |
HStack { | |
Text("Royale Gold Card") | |
.font(.system(size: 20, weight: .semibold, design: .monospaced)) | |
Spacer() | |
Image("american_ex") | |
.resizable() |
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 isLeapYear(_ year: Int) -> Bool { | |
if year % 4 != 0 { | |
print("The year \(year) is not leap year because it is not evenly divisible by 4.") | |
return false | |
} else if year % 100 != 0 { | |
print("The year \(year) is a leap year because it is divisible by 4 and not by 100.") | |
return true | |
} else if year % 400 == 0 { | |
print("The year \(year) is a leap year because it is divisible by 400") | |
return true |
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 formatDuration(_ durationInSeconds: Int) -> String { | |
let (hours, secondsAfterHours) = divmod(durationInSeconds, 3600) | |
let (minutes, seconds) = divmod(secondsAfterHours, 60) | |
return String(format: "%02d:%02d:%02d", hours, minutes, seconds) | |
} | |
func divmod(_ numerator: Int, | |
_ denominator: Int) -> (quotient: Int, remainder: Int) { |
OlderNewer