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 hidden or 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
""" | |
title: GitHub Models Manifold V2 | |
author: wendyliga | |
author_url: https://github.com/wendyliga | |
project_url: https://gist.github.com/wendyliga/a1247718c105a45d86e84a1cae60c20e | |
version: 1.0 | |
license: Apache License 2.0 | |
description: A manifold pipeline for interacting with github models. modified from https://openwebui.com/f/jscheah/github_models_manifold to adapt with new endpoint. | |
""" |
This file contains hidden or 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 | |
} |
This file contains hidden or 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 hidden or 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 hidden or 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
import AsyncDisplayKit | |
class ViewController: ASViewController<ASDisplayNode> { | |
private let storyNode: StoryNode | |
private let postNode: PostNode | |
init() { | |
self.storyNode = StoryNode(stories: Story.generateDummyStory()) | |
self.postNode = PostNode(posts: Post.generateDummyPosts()) |
This file contains hidden or 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
import AsyncDisplayKit | |
class StoryNode: ASCollectionNode{ | |
let stories: [Story] | |
init(stories: [Story]) { | |
self.stories = stories | |
let layout = UICollectionViewFlowLayout() | |
layout.scrollDirection = .horizontal |
This file contains hidden or 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
import AsyncDisplayKit | |
class StoryCell: ASCellNode { | |
private let story: Story | |
// MARK: - Nodes | |
private let userPicture: ASImageNode | |
private let userName: ASTextNode | |
init(story: Story) { |
This file contains hidden or 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
import AsyncDisplayKit | |
class PostNode: ASTableNode { | |
private let posts: [Post] | |
init(posts: [Post]) { | |
self.posts = posts | |
super.init(style: .plain) | |
This file contains hidden or 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
import AsyncDisplayKit | |
class PostCell: ASCellNode { | |
let post: Post | |
// MARK: - Nodes | |
let headerNode: HeaderNode | |
let postImage: ASImageNode | |
let actionNode: ActionNode |
NewerOlder