The Composable Architecture(TCA)는 일관되고 이해할 수 있는 방식으로 어플리케이션을 만들기 위해 탄생한 라이브러리입니다. 합성(Composition), 테스팅(Testing) 그리고 인체 공학(Ergonomics)을 염두에 둔 TCA는 SwiftUI, UIKit을 지원하며 모든 애플 플랫폼(iOS, macOS, tvOS, watchOS)에서 사용 가능합니다.
// MARK: - Reducable | |
protocol Reducable { | |
associatedtype State | |
associatedtype Action | |
associatedtype Environment | |
associatedtype Effect | |
func reduce( | |
state: inout State, |
/** | |
[Swift Protocols](https://docs.swift.org/swift-book/LanguageGuide/Protocols.html#ID269) | |
# Property Requirements | |
A protocol can require any conforming type to provide an instance property or | |
type property with a particular name and type. The protocol doesn’t specify | |
whether the property should be a stored property or a computed property it | |
only specifies the required property name and type. The protocol also specifies | |
whether each property must be gettable or gettable and settable. |
// | |
// ContentView.swift | |
// MetalSwiftUI | |
// | |
// Created by Zach Eriksen on 9/8/20. | |
// Copyright © 2020 oneleif. All rights reserved. | |
// | |
// Inspired [MetalUI](https://github.com/0xLeif/MetalUI) | |
import SwiftUI |
class BrandedLoadingView: UIView { | |
fileprivate var spinnerView = View() | |
fileprivate var topLeftSpinnerView = View() | |
.layer { $0.addSublayer(dotLayer()) } | |
fileprivate var bottomRightSpinnerView = View() | |
.configure { | |
$0.transform = $0.transform.rotated(by: .pi) | |
} | |
.layer { $0.addSublayer(dotLayer()) } | |
Mute these words in your settings here: https://twitter.com/settings/muted_keywords | |
ActivityTweet | |
generic_activity_highlights | |
generic_activity_momentsbreaking | |
RankedOrganicTweet | |
suggest_activity | |
suggest_activity_feed | |
suggest_activity_highlights | |
suggest_activity_tweet |
import UIKit | |
precedencegroup KeyPathPrecedence { | |
associativity: right | |
higherThan: MultiplicationPrecedence | |
} | |
infix operator ...: KeyPathPrecedence |
The libdispatch is one of the most misused API due to the way it was presented to us when it was introduced and for many years after that, and due to the confusing documentation and API. This page is a compilation of important things to know if you're going to use this library. Many references are available at the end of this document pointing to comments from Apple's very own libdispatch maintainer (Pierre Habouzit).
My take-aways are:
-
You should create very few, long-lived, well-defined queues. These queues should be seen as execution contexts in your program (gui, background work, ...) that benefit from executing in parallel. An important thing to note is that if these queues are all active at once, you will get as many threads running. In most apps, you probably do not need to create more than 3 or 4 queues.
-
Go serial first, and as you find performance bottle necks, measure why, and if concurrency helps, apply with care, always validating under system pressure. Reuse
// | |
// BlockBasedSelector.h | |
// | |
// Created by Charlton Provatas on 11/2/17. | |
// Copyright © 2017 CharltonProvatas. All rights reserved. | |
// | |
#import <Foundation/Foundation.h> | |
@interface BlockBasedSelector : NSObject |
Author: Chris Lattner