This is now available in a dedicated package: ActivityView
Alternatively my SwiftUI Backports now includes a more complete implementation of ShareLink
that's also more performant.
private func flipped(size: CGSize) -> CGAffineTransform { | |
let mirror = CGAffineTransform(scaleX: 1, y: -1) | |
let translate = CGAffineTransform(translationX: 0, y: size.height) | |
return mirror.concatenating(translate) | |
} |
extension Encodable { | |
var debugJson: String { | |
(try? JSONEncoder().encode(self).debugJson) ?? "" | |
} | |
} | |
extension Data { | |
var debugJson: String { | |
String(decoding: self, as: UTF8.self) | |
} |
#!/bin/sh | |
# strip-intel.sh | |
# Usage example: ./strip-intel.sh | |
# This script is design to remove Intel architecture's from Xcode frameworks | |
# to enable development and installation of 3rd party pre-compiled frameworks | |
# that are not currently distributed as either XCFramework or SPM packages. | |
# The most common use-case would be carthage dependencies that are distributed |
extension View { | |
/// Conditionally apply modifiers to a view. | |
func `if`<Content: View>(_ condition: () -> Bool, content: (Self) -> Content) -> some View { | |
condition() ? | |
ViewBuilder.buildEither(first: content(self)) : | |
ViewBuilder.buildEither(second: self) | |
} | |
func `if`<Content: View>(_ condition: @autoclosure () -> Bool, content: (Self) -> Content) -> some View { | |
condition() ? |
import UIKit | |
extension UIDevice { | |
/* | |
List can be updated here: | |
https://gist.github.com/adamawolf/3048717 | |
*/ | |
internal static var models: String = """ |
This is now available in a dedicated package: ActivityView
Alternatively my SwiftUI Backports now includes a more complete implementation of ShareLink
that's also more performant.
This library is now deprecated in favour of a more complete and SwiftUI friendly TextEditor
backport:
https://github.com/shaps80/SwiftUIBackports
See it in action here: https://twitter.com/shaps/status/1654972428286668800?s=20
import SwiftUI | |
#if os(macOS) | |
public typealias Font = NSFont | |
public typealias FontDescriptor = NSFontDescriptor | |
#else | |
public typealias Font = UIFont | |
public typealias FontDescriptor = UIFontDescriptor | |
#endif |
import UIKit | |
/// Defines a token for determining the validity of a session | |
public protocol AuthenticationToken: Codable { | |
/// The token is currently valid | |
var isValid: Bool { get } | |
/// An encoded representation for storage | |
var encoded: Data? { get } | |
} |