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
struct SomeComponent { | |
private var _doSomething: () -> Void | |
init(_doSomething: @escaping () -> Void) { | |
self._doSomething = _doSomething | |
} | |
func doSomething() { | |
_doSomething() | |
} | |
} |
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
final class MyUsecase {} //← Injected KMP type | |
@dynamicMemberLookup // The magic of everything! | |
final class DIContainer { // ← Koin DIContainer Wrapper | |
// let container = // ← Koin DIContainer | |
subscript<T>(dynamicMember dynamicMember: String) -> T { | |
// ↓ Replace `fatalError() with injected object using `container` and `T` generics | |
fatalError() | |
} | |
} |
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
precedencegroup AssociativeComparisonPrecedence { | |
associativity: left | |
higherThan: ComparisonPrecedence | |
lowerThan: NilCoalescingPrecedence | |
} | |
infix operator <: AssociativeComparisonPrecedence | |
infix operator <=: AssociativeComparisonPrecedence | |
public func < <V: Comparable>(lhs: V, rhs: V) -> (Bool, V) { |
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 Collection { | |
func interpolated(by interpolation: (_ previous: Element, _ current: Element) throws -> Element) rethrows -> [Element] { | |
var iterator = makeIterator() | |
var result = [Element]() | |
guard var previous = iterator.next() else { | |
return [] | |
} |
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 pandas as pd | |
import argparse | |
def process_file(input_file_path, output_file_path): | |
# Read the file line by line until we find the header row starting with 'timestamp' | |
with open(input_file_path, 'r') as file: | |
lines = file.readlines() | |
# Get the line number where 'timestamp' is found |
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 | |
struct Badge<V: View>: ViewModifier { | |
let badge: V | |
func body(content: Content) -> some View { | |
ZStack { | |
content | |
GeometryReader { [self] geometry in |
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
#!/bin/bash | |
set -e | |
echo " => Creating a temporary directory for codesigndoc ..." | |
temp_dir="$(mktemp -d -t codesigndocXXXXXX)" | |
codesigndoc_bin_path="${temp_dir}/codesigndoc" | |
version_to_use="2.3.1" | |
if [ "$1" != "" ] ; then | |
version_to_use="$1" |
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
let a: Int = 1 | |
let b: Double = 1 | |
let aa: AnyHashable = a | |
let ab: AnyHashable = b | |
aa == ab // true |
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
// Xcode 11.0 beta 2 まで | |
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { | |
// Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`. | |
// If using a storyboard, the `window` property will automatically be initialized and attached to the scene. | |
// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead). | |
// Use a UIHostingController as window root view controller | |
let window = UIWindow(frame: UIScreen.main.bounds) | |
window.rootViewController = UIHostingController(rootView: ContentView(model: model)) | |
self.window = window |
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 UIKit | |
import SwiftUI | |
import Combine | |
protocol UsecaseProtocol: AnyObject { | |
var intPublisher: AnyPublisher<Int, Never> { get } | |
func reset() | |
} | |
struct ContentView : View { |
NewerOlder