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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Simple Web Page</title> | |
</head> | |
<body> | |
<h1>Welcome to My Simple Page</h1> | |
<p>Click the link below to visit the website:</p> |
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
public extension EnvironmentValues { | |
var isPreview: Bool { | |
#if DEBUG | |
return ProcessInfo.processInfo.environment["XCODE_RUNNING_FOR_PREVIEWS"] == "1" | |
#else | |
return false | |
#endif | |
} | |
var isUnitTest: Bool { |
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 hashTagExpression = /(#+[a-zA-Z0-9(_)]{1,})/ | |
let note = "this is my #note with a #tag #whatup" | |
let ranges = note.ranges(of: regEx2) | |
ranges.forEach { | |
// Remove the # by skipping over the first character. | |
let newStart = note.index(after: $0.lowerBound) | |
let newRange = newStart..<$0.upperBound | |
let str = String(note[newRange]) | |
print(str) |
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
swiftformat . --indent 4 --swiftversion 5.3 --disable wrapMultilineStatementBraces |
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
// | |
// BeaverLogger.swift | |
// Klimate | |
// | |
// Created by Kraig Spear on 10/23/20. | |
// | |
import Foundation | |
import SwiftyBeaver | |
public final class BeaverLogger: Logger { |
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
// | |
// Logger.swift | |
// Klimate | |
// | |
// Created by Kraig Spear on 10/23/20. | |
// | |
import Foundation | |
public protocol Logger { |
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
// Taken from https://www.swiftbysundell.com/clips/2/ | |
extension Data { | |
func decoded<T: Decodable>( | |
as type: T.Type = T.self, | |
handledOn resultQueue: DispatchQueue = .main, | |
handler: @escaping (Result<T, Error>) -> Void | |
) { | |
let queue = DispatchQueue(label: "com.myapp.decoding") | |
let decoder = JSONDecoder() |
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
// | |
// BaseOperation.swift | |
// SpearSwiftLib | |
// | |
// Created by Kraig Spear on 11/11/15. | |
// | |
import Foundation | |
/** |
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
// | |
// QRCodeGeneration.swift | |
// TempCheck | |
// | |
// Created by Kraig Spear on 6/12/20. | |
// | |
import CoreImage.CIFilterBuiltins | |
import UIKit |
NewerOlder