Skip to content

Instantly share code, notes, and snippets.

import PackageDescription
import Foundation
import Swift
extension PackageDescription.Product {
public static func iOSApplication(
name: Swift.String,
targets: [Swift.String],
bundleIdentifier: Swift.String? = nil,
teamIdentifier: Swift.String? = nil,
@JoeMatt
JoeMatt / Pics.md
Last active February 21, 2023 16:57
ChatGPT conversion of ObjC to Swift

Screenshot 2023-02-21 at 11 19 24 AM

Screenshot 2023-02-21 at 11 19 29 AM

Screenshot 2023-02-21 at 11 19 37 AM

Screenshot 2023-02-21 at 11 19 41 AM

Screenshot 2023-02-21 at 11 19 59 AM

Screenshot 2023-02-21 at 11 20 03 AM

/*
Strings.strings
Provenance
Created by Joseph Mattiello on 8/16/21.
Copyright © 2021 Provenance Emu. All rights reserved.
*/
/* Loading and item */
"Loading" = "Loading";

Keybase proof

I hereby claim:

  • I am joematt on github.
  • I am jmattiello (https://keybase.io/jmattiello) on keybase.
  • I have a public key ASD8C10kbjg_zc7WK27yd2I-CqHQsq61gs0Wom9er8INGgo

To claim this, I am signing this object:

@JoeMatt
JoeMatt / nestedcodable.swift
Created December 5, 2018 02:16
Example of codeable with nested values without using nested structs
protocol SOAPElement : Codable {
static var namespace : String { get }
static var uri : String { get }
}
protocol WSSEElement : SOAPElement {}
/*
<wsse:Security>
<wsse:UsernameToken>
@JoeMatt
JoeMatt / async_groups.m
Last active December 12, 2019 17:54
Example of guarantee of parallel execution and single firing of completion block
- (void)enableFirebaseSyncCompletion:(void(^)(void))completion {
// ------- This is the setup of the groups, factories etc -----------
// Create a new top level group, __block so we can pass it into child groups
__block dispatch_group_t topGroup = dispatch_group_create();
// Type-defs make things easier to read
typedef void (^ReturnedBlock)(void);
typedef void (^ParamBlock)(ReturnedBlock);
@JoeMatt
JoeMatt / Set Plist Bundle to Git Count.md
Last active November 25, 2023 10:18
Xcode 10 set Info.plist build version

Create Info.plist

About

This script will update Info.plist of a target in XCode with the following

  1. CFBundleVersion to the git commit count
  2. GitDate to the date of the last commit
  3. GitBranch to the current branch name
  4. GitTag to the latest tag on current branch

Creates a .version file to track last update and appease XCode needing a non-mutable output path.

@JoeMatt
JoeMatt / UIViewAutoLayoutAnchors.swift
Last active September 26, 2018 22:58 — forked from bizz84/UIViewAutoLayoutAnchors.swift
UIView extension for programmatic Auto Layout
import UIKit
extension UIView {
enum SALViewError : Error {
case noSuperview
}
func anchorAllEdgesToSuperview() throws {
guard let superview = superview else { throw SALViewError.noSuperview }
@JoeMatt
JoeMatt / Carthage.sh
Last active November 14, 2019 21:19
Improve Carthage performance with Per-target manifest caching and optional Fastlane usage
set -e
# carthage.sh : smarter carthage updating and caching by Joe Mattiello
#
# Inspired from http://shashikantjagtap.net/cache-carthage-speed-ios-continuous-integration/
#
# The purpose of this script is to reduce the amount of checkouts Carthage runs.
# I use this script in an XCode 'run script' build phase as the first phase before compiling
# If you have mutliple targets, projects, frameworks etc, you can include this script in each and it will selec
# the correct Carthage folder for each target.
@JoeMatt
JoeMatt / MappableCore.swift
Created March 1, 2018 02:14
Example for using swift protocol defaults and generics with keyPaths to reduce code
// Can maybe use this generic keypath and then narrow it downn later
// You can't use KeyPath<T, GCControllerElement> and then pass a
// keyPath to a GCControllerButtonInput property even though in inherits.
// No idea why or what the work around is but I'm sure there is a proper way
// to make this generic
protocol BoolRepresentableInput {
var isPressed: Bool { get }
}
protocol FloatRepresentableInput {