Skip to content

Instantly share code, notes, and snippets.

View mukyasa's full-sized avatar
💭
I may be slow to respond.

Mukesh Mandora mukyasa

💭
I may be slow to respond.
View GitHub Profile
*** Assertion failure in -[ASImageNode setFrame:], /Users/mukesh/Desktop/Mukesh_Workspace/ParentTown/ParentTown/ASDisplayNode+UIViewBridge.mm:138
2016-05-31 20:23:30.274 ParentTown[5628:2025751] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Incorrect display node thread affinity'
*** First throw call stack:
(
0 CoreFoundation 0x000000010c187d85 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x000000010bbf9deb objc_exception_throw + 48
2 CoreFoundation 0x000000010c187bea +[NSException raise:format:arguments:] + 106
3 Foundation 0x000000010b842d5a -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 198
4 ParentTown 0x0000000107d4ed29 -[ASDisplayNode(UIViewBridge) setFrame:] + 329
5 ParentTown 0x0000000107f493ab _TFC10ParentTown27FeedAsyncCollectionViewCell18initFramesAllNodesfT_T_ + 185
//Pan Gesture
public enum PanDirection: Int {
case up, down, left, right
public var isVertical: Bool { return [.up, .down].contains(self) }
public var isHorizontal: Bool { return !isVertical }
}
public extension UIPanGestureRecognizer {
public var direction: PanDirection? {
public extension UIScrollView {
var isAtTop: Bool {
return contentOffset.y <= verticalOffsetForTop
}
var isAtBottom: Bool {
return contentOffset.y >= verticalOffsetForBottom
}
extension MMPullSwipeDismissViewController {
@objc func pan(recognizer : UIPanGestureRecognizer){
//1. Monitor the translation of view
let translation = recognizer.translation(in: nil)
let progressX = (translation.x / 2 ) / view.bounds.width
let progressY = (translation.y / 2 ) / view.bounds.height
enum EventName {
static let screenVisit = "Screen Visit"
static let clickEvent = "Click Event"
}
enum ParameterName {
static let screen = "screen_name"
static let click = "click_target"
}
protocol EventProtocol {
var name: String { get set }
var params: [String: Any] { get set }
}
@propertyWrapper
struct Event: EventProtocol {
var name: String
var params: [String: Any] = [:]
// FeatureOne
enum FeatureOneEvents {
@Event(pageValue: "featureOne")
static var screen: Event
@Event(targetValue: "tappedFeatureOneButton")
static var buttonClick: Event
}
// FeatureTwo
protocol AnalyticsEventsLoggerProtocol {
func setUserProperties(user: UserProfileModel)
func trackEvent(event: EventProtocol)
}
// Firebase
class FirebaseEventLogger: AnalyticsEventsLoggerProtocol {
func setUserProperties(user: UserProfileModel) {
// set user properties
}
@propertyWrapper
struct Theme {
let light: UIColor
let dark: UIColor
var wrappedValue: UIColor {
if #available(iOS 13, *) {
return UIColor { (traitCollection: UITraitCollection) -> UIColor in
if traitCollection.userInterfaceStyle == .dark {
return self.dark
extension UIColor {
@Theme(light: UIColor.white,
dark: UIColor.safeSystemBackground)
static var background: UIColor
@Theme(light: UIColor(hex: "333333"),
dark: UIColor.safeLabel)
static var primaryText: UIColor
@Theme(light: UIColor(hex: "EEEFF2"),