Skip to content

Instantly share code, notes, and snippets.

Avatar
👨‍💻
Code in Progress

Wendy Liga wendyliga

👨‍💻
Code in Progress
View GitHub Profile
@wendyliga
wendyliga / TCA_README_ID.MD
Last active Aug 13, 2021
swift-composable-architecture readme indonesia translation
View TCA_README_ID.MD

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)

View NonEmptyString.swift
@propertyWrapper
struct NonEmptyString {
var wrappedValue: String?
init(wrappedValue: String?) {
if wrappedValue?.isEmpty == true {
self.wrappedValue = nil
} else {
self.wrappedValue = wrappedValue
}
@wendyliga
wendyliga / selected-rounded-corner-ASImageNode.swift
Created Nov 4, 2019
Implement layer masking with bazier path
View selected-rounded-corner-ASImageNode.swift
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()
View Test.h
/**
myProtocol.h
*/
@protocol MyProtocol <NSObject>
@property (nonatomic) BOOL myVariable;
@end
/**
MyClass.h
*/
@wendyliga
wendyliga / ViewController.swift
Created Sep 25, 2019
TextureGram Main View Controller
View ViewController.swift
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())
@wendyliga
wendyliga / StoryNode.swift
Created Sep 25, 2019
TextureGram StoryNode
View StoryNode.swift
import AsyncDisplayKit
class StoryNode: ASCollectionNode{
let stories: [Story]
init(stories: [Story]) {
self.stories = stories
let layout = UICollectionViewFlowLayout()
layout.scrollDirection = .horizontal
@wendyliga
wendyliga / StoryCell.swift
Created Sep 25, 2019
TextureGram StoryCell
View StoryCell.swift
import AsyncDisplayKit
class StoryCell: ASCellNode {
private let story: Story
// MARK: - Nodes
private let userPicture: ASImageNode
private let userName: ASTextNode
init(story: Story) {
@wendyliga
wendyliga / PostNode.swift
Created Sep 25, 2019
TextureGram PostNode
View PostNode.swift
import AsyncDisplayKit
class PostNode: ASTableNode {
private let posts: [Post]
init(posts: [Post]) {
self.posts = posts
super.init(style: .plain)
@wendyliga
wendyliga / PostCell.swift
Created Sep 25, 2019
TextureGram PostCell
View PostCell.swift
import AsyncDisplayKit
class PostCell: ASCellNode {
let post: Post
// MARK: - Nodes
let headerNode: HeaderNode
let postImage: ASImageNode
let actionNode: ActionNode
@wendyliga
wendyliga / ActionNode.swift
Created Sep 25, 2019
TextureGram Action Node
View ActionNode.swift
import AsyncDisplayKit
class ActionNode: ASDisplayNode {
// MARK: - Nodes
private let loveButton: ASImageNode
private let commentButton: ASImageNode
private let shareButton: ASImageNode