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
// | |
// ExifData.swift | |
// Qeepsake | |
// | |
// Created by Luke Farrell on 26/05/2022. | |
// | |
import Foundation | |
import ImageIO |
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
#!/bin/bash | |
set -o pipefail | |
set -e | |
find . -name "*.swiftinterface" -exec sed -i -e 's/Realm\.//g' {} \; | |
find . -name "*.swiftinterface" -exec sed -i -e 's/import Private/import Realm.Private/g' {} \; | |
find . -name "*.swiftinterface" -exec sed -i -e 's/RealmSwift.Configuration/RealmSwift.Realm.Configuration/g' {} \; | |
find . -name "*.swiftinterface" -exec sed -i -e 's/extension Configuration/extension Realm.Configuration/g' {} \; | |
find . -name "*.swiftinterface" -exec sed -i -e 's/RealmSwift.Error/RealmSwift.Realm.Error/g' {} \; | |
find . -name "*.swiftinterface" -exec sed -i -e 's/extension Error/extension Realm.Error/g' {} \; |
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 UIKit | |
protocol DefaultValue { | |
associatedtype Value: Decodable | |
static var defaultValue: Value { get } | |
} | |
@propertyWrapper | |
struct Default<T: DefaultValue> { | |
var wrappedValue: T.Value |
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
// If you run this in a playground in Xcode 12, you can see the difference in behavior in the live view. | |
import SwiftUI | |
import PlaygroundSupport | |
class Counter: ObservableObject { | |
@Published var count: Int | |
init(_ initialCount: Int) { | |
self.count = initialCount |
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 | |
protocol Resumable { | |
func resume() | |
} | |
extension Subscribers { | |
class ResumableSink<Input, Failure: Error>: Subscriber, Cancellable, Resumable { | |
let receiveCompletion: (Subscribers.Completion<Failure>) -> Void |
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 | |
extension Character { | |
var isEmoji: Bool { | |
return unicodeScalars.allSatisfy { $0.properties.isEmoji } | |
} | |
} | |
func recentlyUsedEmoji() -> [Character]? { | |
#if os(iOS) |
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
@DynamicColor(lightVariant: .black, darkVariant: .white) | |
static var dynamicLabelColor: UIColor | |
@propertyWrapper | |
struct DynamicColor { | |
let lightVariant: UIColor | |
let darkVariant: UIColor | |
var wrappedValue: UIColor { | |
get { |
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
// orogin swift protocol and calling | |
protocol aProtocol { | |
func testFunc() | |
} | |
class aStruct: aProtocol { | |
func testFunc() {} // override defualt implementation | |
} | |
class bStruct: aProtocol { | |
func testFunc() {} // override defualt implementation | |
} |
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
{ | |
"emojis": [ | |
{"emoji": "👩👩👧👧", "name": "family: woman, woman, girl, girl", "shortname": ":woman_woman_girl_girl:", "unicode": "1F469 200D 1F469 200D 1F467 200D 1F467", "html": "👩‍👩‍👧‍👧", "category": "People & Body (family)", "order": ""}, | |
{"emoji": "👩👩👧👦", "name": "family: woman, woman, girl, boy", "shortname": ":woman_woman_girl_boy:", "unicode": "1F469 200D 1F469 200D 1F467 200D 1F466", "html": "👩‍👩‍👧‍👦", "category": "People & Body (family)", "order": ""}, | |
{"emoji": "👩👩👦👦", "name": "family: woman, woman, boy, boy", "shortname": ":woman_woman_boy_boy:", "unicode": "1F469 200D 1F469 200D 1F466 200D 1F466", "html": "👩‍👩‍👦‍👦", "category": "People & Body (family)", "order": ""}, | |
{"emoji": "👨👩👧👧", "name": "family: man, woman, girl, girl", "shortname": ":man_woman_girl_girl:", "unicode": "1F468 200D 1F469 200D 1F467 200D 1F467", "html": "👨‍👩&z |
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 | |
protocol StateType: Hashable {} | |
protocol EventType: Hashable {} | |
struct Transition<S: StateType, E: EventType> { | |
let event: E | |
let fromState: S | |
let toState: S |
NewerOlder