This file contains hidden or 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 SwiftUI | |
extension Calendar { | |
func generateDates( | |
inside interval: DateInterval, | |
matching components: DateComponents | |
) -> [Date] { | |
var dates: [Date] = [] | |
dates.append(interval.start) |
This file contains hidden or 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
// | |
// RoundedPolygon.swift | |
// | |
// Created by Nate on 2022-10-17. | |
// | |
import SwiftUI | |
struct RoundedPolygon: Shape { | |
This file contains hidden or 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 fetchData() async | |
throws { | |
guard let url = URL(string: urlString) else { return } | |
let (data, response) = try await URLSession.shared.data(for: URLRequest(url: url)) | |
guard (response as? HTTPURLResponse)?.statusCode == 200 else { throw FetchError.badRequest } | |
Task { @MainActor in | |
imageData = try JSONDecoder().decode(PandaCollection.self, from: data) | |
} |
This file contains hidden or 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
Image(image) | |
.resizable() | |
.aspectRatio(contentMode: .fill) | |
.frame(height: 500) | |
.frame(minWidth: 0, maxWidth: .infinity) | |
.clipped() |
This file contains hidden or 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
class ResumableTimer: NSObject { | |
private var timer: Timer? = Timer() | |
private var callback: () -> Void | |
private var startTime: TimeInterval? | |
private var elapsedTime: TimeInterval? | |
// MARK: Init |
This file contains hidden or 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
private struct ScrollOffsetPreferenceKey: PreferenceKey { | |
static var defaultValue: CGPoint = .zero | |
static func reduce(value: inout CGPoint, nextValue: () -> CGPoint) {} | |
} | |
struct TrackableScrollView<Content: View>: View { | |
let axes: Axis.Set | |
let showsIndicators: Bool | |
let offsetChanged: (CGPoint) -> Void |
This file contains hidden or 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
extension String { | |
static func loremIpsum(numberOfSentences sentenceCount: Int = 1) -> String { | |
let str: String = """ | |
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam sit amet placerat ante. Proin purus justo, dignissim a elementum eu, gravida vitae nunc. Duis eu tincidunt elit. Cras rhoncus tellus mi, et tempor erat facilisis dignissim. Duis rutrum vel leo nec dignissim. Donec sollicitudin, nisl vel accumsan tincidunt, urna ligula tristique leo, molestie aliquam orci massa at metus. Etiam facilisis leo lacinia orci tempor, ac vehicula libero pulvinar. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Morbi ligula magna, tempus ullamcorper magna in, mollis sodales elit. Nunc ornare suscipit quam, quis tempus dolor semper in. | |
Morbi dignissim mauris fringilla arcu pharetra pulvinar. Cras orci orci, convallis tincidunt fermentum vel, semper aliquet sapien. Maecenas ipsum nulla, aliquam vel nisl et, porttitor luctus felis. Aliqua |
This file contains hidden or 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
Warning: file_get_contents(http://127.0.0.1:8000//loboApiCurl.php?action=getProductList): failed to open stream: HTTP request failed! in /Users/michaelevensen/Downloads/v1/examplePhp.php on line 30 | |
Abfrage per json(_decode) | |
Warning: count(): Parameter must be an array or an object that implements Countable in /Users/michaelevensen/Downloads/v1/examplePhp.php on line 36 | |
Anzahl der verfügbaren Produkte: 0 | |
Warning: file_get_contents(http://127.0.0.1:8000//loboApiCurl.php?action=getProductList&responseFormat=base64_serialized): failed to open stream: HTTP request failed! in /Users/michaelevensen/Downloads/v1/examplePhp.php on line 51 | |
Abfrage per unserialize |
This file contains hidden or 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
// | |
// View+Geometry.swift | |
// SwiftUIKit | |
// | |
// Created by Daniel Saidi on 2020-03-26. | |
// Copyright © 2020 Daniel Saidi. All rights reserved. | |
// | |
import SwiftUI |
This file contains hidden or 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
extension Date { | |
var startOfDay: Date { | |
return Calendar.current.startOfDay(for: self) | |
} | |
var endOfDay: Date { | |
var components = DateComponents() | |
components.day = 1 | |
components.second = -1 | |
return Calendar.current.date(byAdding: components, to: startOfDay)! |