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
function xc { | |
bold=$(tput bold) | |
normal=$(tput sgr0) | |
xcode_proj=`find . -name "*.xc*" -d 1 | sort -r | head -1` | |
if [[ `echo -n $xcode_proj | wc -m` == 0 ]] | |
then | |
echo "No xcworkspace/xcodeproj file found in the current directory." | |
else | |
echo "Opening ${bold}\033[1;32m$xcode_proj" | |
open "$xcode_proj" |
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
// | |
// OCXML.swift | |
// Created by Marco Arment on 9/23/24. | |
// | |
// Released into the public domain. Do whatever you'd like with this. | |
// No guarantees that it'll do anything, or do it correctly. Good luck! | |
// | |
import Foundation |
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
pushd ${ANDROID_HOME}/emulator | |
./emulator -list-avds | cat -n | |
printf "Select AVD: " | |
read index | |
avd=$(./emulator -list-avds | sed "${index}q;d") | |
echo "Selected $avd" | |
./emulator -netdelay none -netspeed full -avd $avd | |
popd |
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
// Author: SwiftUI-Lab (swiftui-lab.com) | |
// Description: this learning tool is designed to showcase the different | |
// Grid and GridRow view options, added in SwiftUI 2022. It is part of the | |
// blog article: https://swiftui-lab.com/eager-grids | |
// | |
import SwiftUI | |
import UniformTypeIdentifiers | |
// The root view of the application | |
struct ContentView: View { |
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
data class DownloadItem(val bytesDownloadedSoFar: Long = -1, val totalSizeBytes: Long = -1, val status: Int) | |
class DownloadProgressLiveData(private val application: Application, private val requestId: Long) : LiveData<DownloadItem>(), CoroutineScope { | |
private val downloadManager by lazy { | |
application.getSystemService(Context.DOWNLOAD_SERVICE) as DownloadManager | |
} | |
private val job = Job() |
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 XCTest | |
import StoreKitTest | |
@available(iOS 14.0, *) | |
class SubscriptionTests: XCTestCase { | |
private var session: SKTestSession! | |
private var subscriptionsController: SubscriptionsController! | |
override func setUpWithError() throws { |
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 LeakCheckTestCase: XCTestCase { | |
private var excludedProperties = [String: Any]() | |
private var weakReferences = NSMapTable<NSString, AnyObject>.weakToWeakObjects() | |
// MARK: - SetUp | |
override func setUpWithError() throws { | |
try super.setUpWithError() |
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
public abstract class BaseViewBindingFragment extends Fragment { | |
private Field bindingField; | |
private Method inflate; | |
{ | |
try { | |
for (Field declaredField : this.getClass().getDeclaredFields()) { | |
if (ViewBinding.class.isAssignableFrom(declaredField.getType())) { | |
bindingField = declaredField; |
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
// | |
// PasscodeKeychain.swift | |
// Example | |
// | |
// Created by Ricardo Pereira on 23/12/2016. | |
// Copyright © 2016 RP. All rights reserved. | |
// | |
import Foundation |
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 | |
import Combine | |
@propertyWrapper | |
@dynamicMemberLookup | |
public struct Transaction<Value>: DynamicProperty { | |
@State private var derived: Value | |
@Binding private var source: Value | |
fileprivate init(source: Binding<Value>) { |
NewerOlder