Skip to content

Instantly share code, notes, and snippets.

View inekipelov's full-sized avatar
🔄
In progress

Roman Nekipelov inekipelov

🔄
In progress
View GitHub Profile
@chriseidhof
chriseidhof / .swiftlint.yml
Created February 7, 2023 09:59
SwiftLint rules for state, state object, environment and scaled metric
disabled_rules:
- trailing_comma
opt_in_rules:
- file_header
file_header:
forbidden_pattern: /./
custom_rules:
state_private:
name: "Private SwiftUI State"
regex: "\\@State\\s*var"
@sebj
sebj / Guide.md
Last active April 8, 2025 18:04
Add a scene delegate back to a SwiftUI Project

Define an application delegate

See also: UIApplicationDelegate documentation

// AppDelegate.swift
@main
final class AppDelegate: NSObject, UIApplicationDelegate {

    func application(
        _ application: UIApplication,
@ryanlintott
ryanlintott / LayoutThatFits.swift
Last active December 8, 2023 15:14
An alternative to ViewThatFits. Updated version can be found here: https://github.com/ryanlintott/LayoutThatFits
//
// LayoutThatFits.swift
// WWDC22Experiments
//
// Created by Ryan Lintott on 2022-06-08.
//
import SwiftUI
struct LayoutThatFits: Layout {
//
// Created by Volodymyr Andriienko on 18.05.2021.
// Copyright © 2021 VAndrJ. All rights reserved.
//
#if DEBUG
#if canImport(SwiftUI)
import SwiftUI
@available (iOS 13.0, *)
@Hiroki-Kawakami
Hiroki-Kawakami / AppDelegate.swift
Created February 10, 2021 19:22
SwiftUI Change Status Bar Color with Custom Hosting Controller
//
// AppDelegate.swift
// StatusBarTest
//
// Created by hiroki on 2021/02/11.
//
import UIKit
import SwiftUI
@quintonpryce
quintonpryce / IntentPersonProvider.swift
Created November 2, 2020 16:38
Retrieving a contact's phone number from a name in an INPerson object
import Contacts
import Intents
protocol ContactStoring {
func enumerateContacts(with fetchRequest: CNContactFetchRequest, usingBlock block: @escaping (CNContact, UnsafeMutablePointer<ObjCBool>) -> Void) throws
}
extension CNContactStore: ContactStoring {}
class IntentPersonProvider {
@quintonpryce
quintonpryce / IntentHandler.swift
Last active April 8, 2025 18:04
IntentHandler for INStartCallHandling
import Contacts
import Intents
class IntentHandler: INExtension, INStartCallIntentHandling {
/// CNContactsStore implementation to get a person from contacts.
///
/// See https://gist.github.com/quintonpryce/d69499bf40bdef208bd35d00aba188db
lazy var personProvider = IntentPersonProvider()
@available(iOSApplicationExtension 13.0, *)
@DreamingInBinary
DreamingInBinary / Best in Class iOS Checklist
Last active January 24, 2025 03:26
This is a public checklist updated every year after the latest version of iOS and iPadOS are shipped. It's a boiled down version of a "Best in Class" app checklist created by Jordan Morgan.
# A Best in Class Checklist
A boiled down checklist adapted from this [post](https://www.swiftjectivec.com/a-best-in-class-app/), created by @jordanmorgan10.
> To use this, create a Github Issue in your own repo, and simply copy and paste this text.
## iOS Core Technology
_Things any iOS app can benefit from_
- [ ] iCloud Sync
- [ ] Focus Filter Support
@sunshinejr
sunshinejr / AttributedString.swift
Last active November 24, 2022 16:14
Different approach to Attributed Strings in Swift.
import Foundation
import class UIKit.UIImage
struct AttributedString: ExpressibleByStringInterpolation {
enum Attribute: Hashable {
enum ImportanceLevel: String, Equatable {
case very
case enough
}
case important(ImportanceLevel = .enough)
import Foundation
// MARK: - typed predicate types
public protocol TypedPredicateProtocol: NSPredicate { associatedtype Root }
public final class CompoundPredicate<Root>: NSCompoundPredicate, TypedPredicateProtocol {}
public final class ComparisonPredicate<Root>: NSComparisonPredicate, TypedPredicateProtocol {}
// MARK: - compound operators