Skip to content

Instantly share code, notes, and snippets.

View lutluthfi's full-sized avatar

Arif Luthfiansyah lutluthfi

  • 00:25 (UTC -12:00)
View GitHub Profile
@wendyliga
wendyliga / TCA_README_ID.MD
Last active September 25, 2023 04:09
swift-composable-architecture readme indonesia translation

The Composable Architecture

Composable Architecture (pendeknya TCA) adalah library untuk membangun aplikasi dengan cara yang konsisten dan mudah dimengerti, dengan komposisi, testing, dan design ergonomis. TCA dapat digunakan di SwiftUI, UIKit, dan lainnya, dan di platform Apple apa pun (iOS, macOS, tvOS, dan watchOS)

@mecid
mecid / Calendar.swift
Last active June 24, 2024 13:17
SwiftUI Calendar view using LazyVGrid
import SwiftUI
extension Calendar {
func generateDates(
inside interval: DateInterval,
matching components: DateComponents
) -> [Date] {
var dates: [Date] = []
dates.append(interval.start)
@nrivard
nrivard / combine+result.swift
Created August 2, 2019 22:07
Using Result<Success, Failure> with Combine
import Combine
extension Publisher {
/// A single value sink function that coalesces either one `Output` or one `Failure` as a `Result`-type.
public func sink(result: @escaping ((Result<Self.Output, Self.Failure>) -> Void)) -> AnyCancellable {
return sink(receiveCompletion: { completion in
switch completion {
case .failure(let error):
result(.failure(error))
@lattner
lattner / TaskConcurrencyManifesto.md
Last active June 29, 2024 14:26
Swift Concurrency Manifesto
@nolanw
nolanw / URLRequest+MultipartFormData.swift
Last active October 5, 2023 14:31
Swift multipart/form-data
// Public domain - https://gist.github.com/nolanw/dff7cc5d5570b030d6ba385698348b7c
import Foundation
extension URLRequest {
/**
Configures the URL request for `multipart/form-data`. The request's `httpBody` is set, and a value is set for the HTTP header field `Content-Type`.
- Parameter parameters: The form data to set.
@marciogranzotto
marciogranzotto / VIPER Android Example.kt
Last active April 16, 2021 08:41
This is an example of Android development with VIPER in Kotlin
interface LoginContracts {
interface View {
fun showError(message: String)
}
interface Presenter {
fun onDestroy()
fun onLoginButtonPressed(username: String, password: String)
}
@wojteklu
wojteklu / clean_code.md
Last active June 30, 2024 09:07
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@gonzalezreal
gonzalezreal / ios-cell-registration-swift.md
Last active March 13, 2024 15:18
iOS Cell Registration & Reusing with Swift Protocol Extensions and Generics

iOS Cell Registration & Reusing with Swift Protocol Extensions and Generics

A common task when developing iOS apps is to register custom cell subclasses for both UITableView and UICollectionView. Well, that is if you don’t use Storyboards, of course.

Both UITableView and UICollectionView offer a similar API to register custom cell classes:

public func registerClass(cellClass: AnyClass?, forCellWithReuseIdentifier identifier: String)
public func registerNib(nib: UINib?, forCellWithReuseIdentifier identifier: String)
@simonexmachina
simonexmachina / .gitignore
Last active October 24, 2019 05:44
Example .gitignore file for iOS projects
## Build generated
build/
DerivedData
build.xcarchive
## Various settings
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
@Zenexer
Zenexer / Mac Keyboard Symbols.md
Last active May 4, 2024 02:14
List of Mac/Apple keyboard symbols