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
// | |
// Floating.swift | |
// Captionista | |
// | |
// Created by Marc Palmer on 24/02/2023. | |
// | |
import SwiftUI | |
/// Set to true for debug prints. | |
private var debug = false |
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
// | |
// FrameCapture.swift | |
// FrameCapture | |
// | |
// Created by Marc Palmer on 31/03/2020. | |
// | |
// This is free and unencumbered software released into the public domain. | |
// | |
// Anyone is free to copy, modify, publish, use, compile, sell, or | |
// distribute this software, either in source code form or as a compiled |
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
// | |
// Table.swift | |
// Captionista | |
// | |
// Created by Marc Palmer on 20/03/2022. | |
// Copyright © 2022 Montana Floss Co. Ltd. All rights reserved. | |
// | |
import SwiftUI |
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 | |
import Combine | |
extension Publishers { | |
/// A publisher that publishers any values that are immediately available on the current thread/queue, | |
/// but anything received after the subscription process completes is published on a different scheduler. | |
/// | |
/// This allows you do perform immediate state updates at the point of subscribing without having | |
/// `.receive(on:)` force every single result to require a scheduler hop. |
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
| userID | name | age | permissions | address | | |
|--------|------|-----|-------------|--------------------| | |
|1 |peter | 32 |read |[object](#address-1)| | |
|2 |admin | 100 |read,write |[object](#address-2)| | |
## Address 1 // <--- linkify this when loading e.g. address-1 | |
| street | town | | |
|--------|-------| | |
|High St.|Tetbury| |
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 | |
import Combine | |
/// Usage example: | |
/// | |
/// ``` | |
/// source | |
/// .receiveAsyncResults(on: DispatchQueue.main) | |
/// .sink { | |
/// print("Value: \($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 | |
import SwiftUI | |
/// A value that can have different values depending on compact or regular size class in a single axis. | |
/// | |
/// Usage example: | |
/// | |
/// ``` | |
/// static let textPadding = SizeClassDependentValue(compact: 20, regular: 50) | |
/// |
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
/// Get the payload of a video asset and export it to a local temp file. | |
/// The resulting publsher will emit values until completed or cancelled. The `Double` is the progress, | |
/// which is a combination of the download progress and the export progress, so it will range from 0 to 1 but the | |
/// last export part is probably a lot quicker than the download part. | |
/// | |
/// Calling cancel() on the publisher will cancel both the image request and the export as appropriate | |
func exportAVAsset(forPHAsset phAsset: PHAsset) -> (AnyPublisher<(URL?, Double), MediaError>) { | |
let avAssetOptions = PHVideoRequestOptions() | |
avAssetOptions.isNetworkAccessAllowed = true | |
avAssetOptions.deliveryMode = .highQualityFormat |
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
// | |
// FrameCaptureModifier.swift | |
// FrameCaptureModifier | |
// | |
// Created by Marc Palmer on 31/03/2020. | |
// | |
// This is free and unencumbered software released into the public domain. | |
// | |
// Anyone is free to copy, modify, publish, use, compile, sell, or | |
// distribute this software, either in source code form or as a compiled |
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
/// | |
/// Example of infinite recursion crash when asking for URL.bookmarkData in a unit test, | |
/// from a non-main queue. | |
/// | |
import XCTest | |
class BookmarkDataIssueTests: XCTestCase { | |
func testExample() throws { |
NewerOlder