Skip to content

Instantly share code, notes, and snippets.

View suhitp's full-sized avatar
📱
iOS Developer

Suhit Patil suhitp

📱
iOS Developer
View GitHub Profile
Certainly! Here’s a detailed explanation of each folder and its subfolders in the recommended iOS project structure. This will help clarify the purpose and contents of each component within your app.
### **Project Structure with Detailed Explanation**
```
|-- ProjectName
|-- Sources // Main source code folder
|-- Core // Core services and foundational components
|-- AppSetup // App setup, configuration, and main entry point
import UIKit
import PlaygroundSupport
/// Simple sample diffable table view to demonstrate using diffable data sources. Approximately 33% of the time, it should show "bad weather" UI instead of apples and oranges
final class DiffableCollectionViewController : UIViewController {
var collectionView: UICollectionView!
enum Section: String, CaseIterable, Hashable {
case apples = "Apples"
@suhitp
suhitp / CFNetworkErrors.h
Created September 28, 2023 10:26 — forked from krin-san/CFNetworkErrors.h
Apple NSURLError and CFNetworkError codes
typedef CF_ENUM(int, CFNetworkErrors) {
kCFHostErrorHostNotFound = 1,
kCFHostErrorUnknown = 2, // Query the kCFGetAddrInfoFailureKey to get the value returned from getaddrinfo; lookup in netdb.h
// SOCKS errors; in all cases you may query kCFSOCKSStatusCodeKey to recover the status code returned by the server
kCFSOCKSErrorUnknownClientVersion = 100,
kCFSOCKSErrorUnsupportedServerVersion = 101, // Query the kCFSOCKSVersionKey to find the version requested by the server
// SOCKS4-specific errors
kCFSOCKS4ErrorRequestFailed = 110, // request rejected or failed by the server
kCFSOCKS4ErrorIdentdFailed = 111, // request rejected because SOCKS server cannot connect to identd on the client
@suhitp
suhitp / easyiossymbolication
Created September 15, 2023 11:01 — forked from fbeeper/easyiossymbolication
Looking for an easy way to symbolicate crashes?
#!/bin/bash
#
# Fool'n'Lazy-Proof iOS .crash Symbolication
#
# Just run this script on a folder with your `.ipa`, the corresponding `.dSYM`,
# and (1+) `.crash` files. Will output symbolicated `sym-*.crash`es for you.
#
# Copyright (c) 2016 Ferran Poveda (@fbeeper)
# Provided under MIT License (MIT): http://choosealicense.com/licenses/mit/
@suhitp
suhitp / AppCoreDataManager.swift
Created September 7, 2023 12:45 — forked from levibostian/AppCoreDataManager.swift
iOS CoreData ultimate document. Stack, tutorial, errors could encounter. All my CoreData experience for what works in 1 document.
import CoreData
import Foundation
protocol CoreDataManager {
var uiContext: NSManagedObjectContext { get }
func newBackgroundContext() -> NSManagedObjectContext
func performBackgroundTaskOnUI(_ block: @escaping (NSManagedObjectContext) -> Void)
func performBackgroundTask(_ block: @escaping (NSManagedObjectContext) -> Void)
func loadStore(completionHandler: ((Error?) -> Void)?)
}
CoreData Debugging in Xcode
https://useyourloaf.com/blog/debugging-core-data/
// Add two launch arguments:
-com.apple.CoreData.SQLDebug 1
-com.apple.CoreData.ConcurrencyDebug 1
// Leave the SQLDebug argument disabled until needed
// Add three environment variables:
SQLITE_ENABLE_THREAD_ASSERTIONS 1
@suhitp
suhitp / Makefile
Created November 24, 2022 11:01 — forked from uhooi/Makefile
Makefile for iOS App development
PRODUCT_NAME := Foo
SCHEME_NAME := ${PRODUCT_NAME}
WORKSPACE_NAME := ${PRODUCT_NAME}.xcworkspace
UI_TESTS_TARGET_NAME := ${PRODUCT_NAME}UITests
TEST_SDK := iphonesimulator
TEST_CONFIGURATION := Debug
TEST_PLATFORM := iOS Simulator
TEST_DEVICE ?= iPhone 11 Pro Max
TEST_OS ?= 13.3
@suhitp
suhitp / Git Subtree basics.md
Created September 29, 2022 08:12 — forked from SKempin/Git Subtree basics.md
Git Subtree basics

Git Subtree Basics

If you hate git submodule, then you may want to give git subtree a try.

Background

When you want to use a subtree, you add the subtree to an existing repository where the subtree is a reference to another repository url and branch/tag. This add command adds all the code and files into the main repository locally; it's not just a reference to a remote repo.

When you stage and commit files for the main repo, it will add all of the remote files in the same operation. The subtree checkout will pull all the files in one pass, so there is no need to try and connect to another repo to get the portion of subtree files, because they were already included in the main repo.

Adding a subtree

Let's say you already have a git repository with at least one commit. You can add another repository into this respository like this:

@suhitp
suhitp / self-signed-certificate-with-custom-ca.md
Created September 21, 2022 14:57 — forked from fntlnz/self-signed-certificate-with-custom-ca.md
Self Signed Certificate with Custom Root CA

Create Root CA (Done once)

Create Root Key

Attention: this is the key used to sign the certificate requests, anyone holding this can sign certificates on your behalf. So keep it in a safe place!

openssl genrsa -des3 -out rootCA.key 4096