Skip to content

Instantly share code, notes, and snippets.

@drewmccormack
drewmccormack / UpdateLocalizations.swift
Last active September 26, 2023 08:36
Using the AppStoreConnect_Swift_SDK package to update localizations on App Store Connect.
import AppStoreConnect_Swift_SDK
func updateMetadata(forBundleID bundleID: String) async throws {
let configuration = try! APIConfiguration(issuerID: "...", privateKeyID: "...", privateKey: "...")
let provider = APIProvider(configuration: configuration)
// Get app
let appRequest = APIEndpoint.v1
.apps
.get(parameters: .init(filterBundleID: [bundleID], include: [.appInfos, .appStoreVersions]))
@lukaskubanek
lukaskubanek / Bundle+TestFlight.swift
Last active July 5, 2024 10:55
A code snippet for detecting the TestFlight environment for a macOS app at runtime
/// MIT License
///
/// Copyright (c) 2021 Lukas Kubanek, Structured Path GmbH
///
/// Permission is hereby granted, free of charge, to any person obtaining a copy
/// of this software and associated documentation files (the "Software"), to deal
/// in the Software without restriction, including without limitation the rights
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
/// copies of the Software, and to permit persons to whom the Software is
/// furnished to do so, subject to the following conditions:
@Clarko
Clarko / RemovableKeyboardShortcut.swift
Last active March 28, 2023 18:43
SwiftUI suppressible keyboard shortcuts
//
// RemovableKeyboardShortcut.swift
//
// Created by Clarko on 2/2/21.
//
// Adds an argument to dynamically remove a keyboard shortcut
//
import SwiftUI
@agiletortoise
agiletortoise / PointerEnabledButton.swift
Created March 24, 2020 20:00
PointerEnabledButton class demonstrating pointer support for iPadOS 13.4
import UIKit
class PointerEnabledButton: UIButton {
override init(frame: CGRect) {
super.init(frame: frame)
if #available(iOSApplicationExtension 13.4, *) {
enablePointer()
}
}
@masamichiueta
masamichiueta / PageView.swift
Created October 12, 2019 04:19
SwiftUI PageView
import SwiftUI
import UIKit
struct PageViewController: UIViewControllerRepresentable {
var controllers: [UIViewController]
@Binding var currentPage: Int
func makeCoordinator() -> Coordinator {
Coordinator(self)
}
@steventroughtonsmith
steventroughtonsmith / UIView+Tooltips.h
Last active December 23, 2023 11:05
WIP tooltips for Mac Catalyst
//
// UIView+Tooltips.h
// Crossword
//
// Created by Steven Troughton-Smith on 13/09/2019.
// Copyright © 2019 Steven Troughton-Smith. All rights reserved.
//
#import <UIKit/UIKit.h>
@unnamedd
unnamedd / MacEditorTextView.swift
Last active May 26, 2024 17:49
[SwiftUI] MacEditorTextView - A simple and small NSTextView wrapped by SwiftUI.
/**
* MacEditorTextView
* Copyright (c) Thiago Holanda 2020-2021
* https://twitter.com/tholanda
*
* MIT license
*/
import Combine
import SwiftUI
@steipete
steipete / ios-xcode-device-support.sh
Last active July 13, 2024 21:09
Using iOS 15 devices with Xcode 12.5 (instead of Xcode 13)
# The trick is to link the DeviceSupport folder from the beta to the stable version.
# sudo needed if you run the Mac App Store version. Always download the dmg instead... you'll thank me later :)
# Support iOS 15 devices (Xcode 13.0) with Xcode 12.5:
sudo ln -s /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/15.0 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport
# Then restart Xcode and reconnect your devices. You will need to do that for every beta of future iOS versions
# (A similar approach works for older versions too, just change the version number after DeviceSupport)
@deekayen
deekayen / 1-1000.txt
Last active July 18, 2024 15:12
1,000 most common US English words
the
of
to
and
a
in
is
it
you
that