Skip to content

Instantly share code, notes, and snippets.

View s4cha's full-sized avatar
🎯
Focusing

Sacha DSO s4cha

🎯
Focusing
View GitHub Profile
@bradley
bradley / RefreshableScrollView.swift
Last active November 28, 2021 00:46
Pull-to-Refresh: SwiftUI, UIKit-Backed, Actually-Usable
//
// RefreshableScrollView.swift
// --
//
// Created by Bradley on 3/24/21.
//
import Combine
import SwiftUI
import UIKit
@tedgonzalez
tedgonzalez / AppStoreConnectRoles.md
Last active November 11, 2024 10:05
Ever since the Apple developer portal and App Store Connect merged, I got confused with the summary. I like knowing the diff between App Store Connect roles. Here's a detailed list of what each role can do:

App Store Connect Roles

Developer Developer with certificates AppManager AppManager with certificates Admin Account Holder
App Features
Upload Builds
Edit App Store Details (Read)
Create Apps and Submit Versions
//
// Deduplicated.swift
// CountriesSwiftUI
//
// Created by Alexey Naumov on 17.12.2019.
// Copyright © 2019 Alexey Naumov. All rights reserved.
//
import Foundation
import Combine
@lattner
lattner / TaskConcurrencyManifesto.md
Last active November 15, 2024 05:45
Swift Concurrency Manifesto
@lattner
lattner / async_swift_proposal.md
Last active October 29, 2024 18:53 — forked from oleganza/async_swift_proposal.md
Concrete proposal for async semantics in Swift

Async/Await for Swift

Introduction

Modern Cocoa development involves a lot of asynchronous programming using closures and completion handlers, but these APIs are hard to use. This gets particularly problematic when many asynchronous operations are used, error handling is required, or control flow between asynchronous calls gets complicated. This proposal describes a language extension to make this a lot more natural and less error prone.

This paper introduces a first class Coroutine model to Swift. Functions can opt into to being async, allowing the programmer to compose complex logic involving asynchronous operations, leaving the compiler in charge of producing the necessary closures and state machines to implement that logic.

@DejanEnspyra
DejanEnspyra / Obfuscator.swift
Created May 31, 2017 17:51
Obfuscation of hard-coded security-sensitive strings.
//
// Obfuscator.swift
//
// Created by Dejan Atanasov on 2017-05-31.
//
import Foundation
class Obfuscator: AnyObject {
@hooman
hooman / HTMLBuilder.swift
Created April 10, 2017 03:20
This is a prototype code of a DSL to make it easier to generate HTML within Swift source code.
//
// HTMLBuilder.swift
//
// This is a prototype code of a DSL to make it easier to generate HTML within Swift source code.
//
// This version of the prototype usues global constants for html elements because of a compiler limitation / bug.
// The intended behavior was having these globals static properties of `Html` type.
//
// Created by Hooman Mehr on 04/07/17.
// Copyright © 2017 Hooman Mehr. See the MIT license at the bottom.
@Lutzifer
Lutzifer / replaceNSlocalized.sh
Last active September 18, 2018 15:13
Automatically replace NSLocalizedString(...) in Swift with corresponding tr(...) calls for https://github.com/AliSoftware/SwiftGen. Copy both into the project and call 'sh replaceNSlocalized.sh'
#/bin/sh
# Run this inside the project to replace NSLocalizedString calls with swiftgen calls in all .swift files.
# Do not forget to make a backup before.
find . -type f | grep ".swift" > swiftindex.temp
while IFS= read -r filename
do
grep -o "NSLocalizedString(\"[^\")]*\", comment:\s*\"\")" "$filename" > strings.temp
@oleganza
oleganza / async_swift_proposal.md
Last active May 12, 2023 10:06
Concrete proposal for async semantics in Swift

Async semantics proposal for Swift

Modern Cocoa development involves a lot of asynchronous programming using blocks and NSOperations. A lot of APIs are exposing blocks and they are more natural to write a lot of logic, so we'll only focus on block-based APIs.

Block-based APIs are hard to use when number of operations grows and dependencies between them become more complicated. In this paper I introduce asynchronous semantics and Promise type to Swift language (borrowing ideas from design of throw-try-catch and optionals). Functions can opt-in to become async, programmer can compose complex logic involving asynchronous operations while compiler produces necessary closures to implement that logic. This proposal does not propose new runtime model, nor "actors" or "coroutines".

Table of contents

@Xenofex
Xenofex / genstrings.sh
Created November 3, 2014 06:55
genstrings for Swift
#!/bin/bash
#
# genstrings which searchs both Objective-C .m files and Swift files
#
# Set the 'PROJECT' variable
# I'm using a short function 'LS' to replace NSLocalizedString. This script searches them both.
#
if ! type -P ggrep >/dev/null; then
>&2 echo "Error: GNU grep 'ggrep' not found. Install by 'brew install homebrew/dupes/grep'"