Skip to content

Instantly share code, notes, and snippets.

🌴
On vacation

Star liuzhida33

🌴
On vacation
Block or report user

Report or block liuzhida33

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@liuzhida33
liuzhida33 / Badge.swift
Created Jul 2, 2019 — forked from yonat/Badge.swift
Rounded UILabel and UIButton, Badged UIBarButtonItem
View Badge.swift
//
// Badge.swift
// Extensions for Rounded UILabel and UIButton, Badged UIBarButtonItem.
//
// Usage:
// let label = UILabel(badgeText: "Rounded Label");
// let button = UIButton(type: .System); button.rounded = true
// let barButton = UIBarButtonItem(badge: "42", title: "How Many Roads", target: self, action: "answer")
//
// Created by Yonat Sharon on 06.04.2015.
View WatchConnectivitySingletonDemo.swift
//
// WatchSessionManager.swift
// WatchConnectivityDemo
//
// Created by Natasha Murashev on 9/3/15.
// Copyright © 2015 NatashaTheRobot. All rights reserved.
//
import WatchConnectivity
@liuzhida33
liuzhida33 / ViewController.swift
Created Dec 20, 2018 — forked from huguesbr/ViewController.swift
Sample RxBluetoothKit implementation
View ViewController.swift
import UIKit
import CoreBluetooth
import RxSwift
import RxBluetoothKit
extension CBUUID {
var type: UUID {
return UUID(rawValue: uuidString)!
}
@liuzhida33
liuzhida33 / 20181202.md
Last active Dec 3, 2018
iOS 制作基于pod开发第三方framework的二次封装
View 20181202.md

iOS 制作基于pod开发第三方framework的二次封装

主要记录如何将第三方SDK的.a或framwwork集成到自己的framework中,并构建自己的pod发布到私有库所遇到的问题。

集成

  1. 打开第三方SDK找到二进制文件(以iflyMSC.framework为例)
  2. 将iflyMSC的二进制文件改成.a的后缀名,重命名为libiflyMSC.a。 如果不加lib前缀,那么在后面进行pod lib lint命令时有可能会遇到这样的错误提示:
@liuzhida33
liuzhida33 / WKWebview+RxSwift.swift
Created Nov 12, 2018
WKWebview 添加loading和estimatedProgress rx属性
View WKWebview+RxSwift.swift
extension Reactive where Base: WKWebView {
var loading: Observable<Bool> {
return observeWeakly(Bool.self, "loading", options: [.initial, .new]).map { $0 ?? false }
}
var estimatedProgress: Observable<Double> {
return observeWeakly(Double.self, "estimatedProgress").map { $0 ?? 0 }
}
@liuzhida33
liuzhida33 / UIImageExtension.swift
Last active Oct 23, 2018
swift UIImageExtension
View UIImageExtension.swift
// MARK: 颜色转UIImage
extension UIImage {
public convenience init?(color: UIColor, size: CGSize = CGSize(width: 1.0, height: 1.0)) {
UIGraphicsBeginImageContextWithOptions(size, true, UIScreen.main.scale)
defer {
UIGraphicsEndImageContext()
}
let context = UIGraphicsGetCurrentContext()
context?.setFillColor(color.cgColor)
@liuzhida33
liuzhida33 / UIScrollView+MJ_Header_Swizzed.md
Created Jul 31, 2018
hook mj_header 添加下拉刷新震动
View UIScrollView+MJ_Header_Swizzed.md
@implementation UIScrollView (Swizz)

+ (void)load {
    
    SEL originalSelector = @selector(setMj_header:);
    SEL swizzledSelector = @selector(nr_setMj_header:);
    Method originalMethod = class_getInstanceMethod(self.class, originalSelector);
    Method swizzledMethod = class_getInstanceMethod(self.class, swizzledSelector);
    
@liuzhida33
liuzhida33 / ChangePicColor.md
Last active Jul 12, 2018
iOS修改图片颜色
View ChangePicColor.md
- (UIImage *)imageWithColor:(UIColor *)color{
    UIGraphicsBeginImageContextWithOptions(self.size, NO, self.scale);
    CGContextRef context = UIGraphicsGetCurrentContext();
    CGContextTranslateCTM(context, 0, self.size.height);
    CGContextScaleCTM(context, 1.0, -1.0);
    CGContextSetBlendMode(context, kCGBlendModeNormal);
    CGRect rect = CGRectMake(0, 0, self.size.width, self.size.height);
    CGContextClipToMask(context, rect, self.CGImage);
    [color setFill];
You can’t perform that action at this time.