Skip to content

Instantly share code, notes, and snippets.

View albertoramonj's full-sized avatar

Alberto R. albertoramonj

View GitHub Profile
@kenthumphries
kenthumphries / embed-debug-only-framework.sh
Last active October 20, 2023 14:10
Script to be called as part of an Xcode Run Script build phase. This will ensure that script Input File is copied (and code signed) to script Output File.
#!/bin/sh
# This script embeds (and codesigns) a framework within an iOS app binary, but only when the configuration is Debug.
# It must be called from, or copied into an Xcode Run Script build phase with following setup:
# Input Files:
# - Path to framework within project folder (source path)
# - For example: $(SRCROOT)/ThirdPartyFrameworks/SimulatorStatusMagiciOS.framework
# Output Files:
# - Desired path to framework within ${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH} (destination path)
# - For example: ${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}/SimulatorStatusMagiciOS.framework
@rafaelbartolome
rafaelbartolome / SafariKeychain.swift
Last active September 5, 2019 06:44
Use iCloud SafariKeychain from Swift5
//
// SafariKeychain.swift
// Positipp
//
// Created by Rafael Bartolome on 15/06/2019.
// Copyright © 2019 Moonshot People Tech SL. All rights reserved.
//
import Foundation
// Authoer: The SwiftUI Lab
// Full article: https://swiftui-lab.com/scrollview-pull-to-refresh/
import SwiftUI
struct RefreshableScrollView<Content: View>: View {
@State private var previousScrollOffset: CGFloat = 0
@State private var scrollOffset: CGFloat = 0
@State private var frozen: Bool = false
@State private var rotation: Angle = .degrees(0)
final class CurrencySymbol {
static let shared = CurrencySymbol()
/// Finds the shortest currency symbol possible and formats the amount with it
/// Note: this works around using `currencyCode` and how it displays `CA$1234.56` instead of `$1234.56`
func currencyString(for amount: Decimal, isoCurrencyCode: String?) -> String {
guard let isoCurrencyCode = isoCurrencyCode,
let currencySymbol = findSymbol(for: isoCurrencyCode)
else { return String(describing: amount) }
return formatter(for: currencySymbol).string(for: amount) ?? String(describing: amount)
@devnano
devnano / TestAddTodayWidget.swift
Last active February 22, 2023 08:01
iOS Today Widget – Smoke Test: verify that it is added and loaded properly from Today View.
//
// WeeklyCalendarUITests.swift
// WorkRosterAppUITests
//
// Created by Mariano Heredia on 06/05/2020.
import XCTest
class TestAddTodayWidget: XCTestCase {
@2no
2no / AlertManager.swift
Created May 31, 2020 13:18
SwiftUI+Alert Queue
import Combine
import SwiftUI
class AlertManager: ObservableObject {
@Published var isPresented = false
private var queues: [Alert] = []
private var cancellable: AnyCancellable?
init() {
@GetVladimir
GetVladimir / Force-RGB-Color-on-M1-Mac.md
Last active October 23, 2025 06:02
Force RGB Color on M1 Mac

Force RGB Color on M1 Mac

How to Force RGB Color Output instead of YPbPr on your M1 Apple Silicon Mac for an External Monitor.

This step-by-step video tutorial will guide you through the procedure of forcing RGB color output on your M1 Mac.

Force RGB Color on M1 Mac

Here is the direct link to the video tutorial: https://www.youtube.com/watch?v=Z1EqH3fd0V4

The video also has Closed Captions (Subtitles) that you can enable, to make it easier to follow if needed.

@fxm90
fxm90 / SwiftUI+HTML.swift
Created June 28, 2021 14:43
Extension that converts Strings with basic HTML tags to SwiftUI's Text (Supports SwiftUI 3.0 / iOS 15.0).
//
// SwiftUI+HTML.swift
//
// Created by Felix Mau on 28.05.21.
// Copyright © 2021 Felix Mau. All rights reserved.
//
import SwiftUI
@available(iOS 15.0, *)