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)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
myProtocol.h | |
*/ | |
@protocol MyProtocol <NSObject> | |
@property (nonatomic) BOOL myVariable; | |
@end | |
/** | |
MyClass.h | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
image.imageModificationBlock = { image in | |
// try to set rounded corner only to top left and bottom left | |
var modifiedImage: UIImage? | |
var rect = CGRect(origin: CGPoint.zero, size: image.size) | |
UIGraphicsBeginImageContextWithOptions(image.size, false, UIScreen.main.scale) | |
let maskPath = UIBezierPath(roundedRect: rect, byRoundingCorners: [UIRectCorner.topLeft, UIRectCorner.bottomLeft], cornerRadii: CGSize(width: 10, height: 10)) | |
maskPath.addClip() | |
image.draw(in: rect) | |
modifiedImage = UIGraphicsGetImageFromCurrentImageContext() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@propertyWrapper | |
struct NonEmptyString { | |
var wrappedValue: String? | |
init(wrappedValue: String?) { | |
if wrappedValue?.isEmpty == true { | |
self.wrappedValue = nil | |
} else { | |
self.wrappedValue = wrappedValue | |
} |
OlderNewer