摘要: 保证能判断,呕心沥血,不行切JIJI 方法一 Objective-C // iPhoneX、iPhoneXR、iPhoneXs、iPhoneXs Max等 // 判断刘海屏,返回YES表示是刘海屏 - (BOOL)isNotchScreen { if ([UIDevice currentDevice 阅读全文
posted @ 2018-11-07 17:17 HarveyCC 阅读(1368) 评论(0) 推荐(0) 编辑
摘要: Objective-c 版本 UIKIT_EXTERN UIImage * __nullable UIColorAsImage(UIColor * __nonnull color, CGSize size) { CGRect rect = CGRectMake(0, 0, size.width, s 阅读全文
posted @ 2018-10-22 22:19 HarveyCC 阅读(516) 评论(0) 推荐(0) 编辑
摘要: Objective-C UIColor * __nullable UIColorFromHexValue(NSUInteger hexValue) { CGFloat red = (hexValue & 0xFF0000) >> 16; CGFloat green = (hexValue & 0x0 阅读全文
posted @ 2018-10-22 21:54 HarveyCC 阅读(138) 评论(0) 推荐(0) 编辑
摘要: 所有工具已升级,请使用CC系列工具,旧版已不现维护,目前已无法使用 进入 [CC官网] 扣扣交流群:811715780 前往 [ 官网下载] CodeMixer介绍 ChaosTool升级版,完全重构,更多新功能,再也不是乱码,有以下特点 功能ChaosToolCodeMixer 自动定义变量/函数 阅读全文
posted @ 2018-09-13 23:57 HarveyCC 阅读(234) 评论(0) 推荐(0) 编辑
摘要: 关于compactMap函数 苹果在Swift 4.1中新增compactMap函数,用来代替flatMap函数。 在Swift标准库中compactMap定义如下 public func compactMap<ElementOfResult>(_ transform: (Element) thro 阅读全文
posted @ 2018-05-22 16:17 HarveyCC 阅读(351) 评论(0) 推荐(0) 编辑
摘要: 在Swift语言中,常见的操作符有+、-、*、/、>、<、==、&&、||等等,如果不喜欢,你也可以定义自己喜欢的操作符。 操作符类型 中置运算符(infix operator) e.g. +、-、/、* 前置运算符(prefix operator) e.g. --、++ 后置运算符(postfix 阅读全文
posted @ 2018-04-19 13:32 HarveyCC 阅读(251) 评论(0) 推荐(0) 编辑
摘要: Create QRScanner.swift file // // QRScanner.swift // NativeQR // // Created by Harvey on 2017/10/24. // Copyright © 2017年 Harvey. All rights reserved. 阅读全文
posted @ 2018-04-18 11:49 HarveyCC 阅读(245) 评论(0) 推荐(0) 编辑
摘要: import Foundation import CoreImage import UIKit extension UIColor { var coreImageColor: CIColor { return CIColor(color: self) } var components: (red: 阅读全文
posted @ 2018-04-17 12:19 HarveyCC 阅读(205) 评论(0) 推荐(0) 编辑
摘要: 在Swift的标准库,很多方法名后都带有’throws’这个关键词, ‘throws’表示该方法在执行过程中遇到错误则抛出,但不会crash。 下面是Swift标准库中的一个构造方法,String、Data都有该构造方法 public init(contentsOf url: URL) throws 阅读全文
posted @ 2017-10-31 18:27 HarveyCC 阅读(197) 评论(0) 推荐(0) 编辑
摘要: 我们先来定义一个常量整型数组 let array = [5, 4, 3, 1, 2] 过滤器(filter)使用之筛选出大于3的值 let resultArray = array.filter { (item) -> Bool in return item > 3 } print(resultArr 阅读全文
posted @ 2017-10-30 12:27 HarveyCC 阅读(2030) 评论(0) 推荐(0) 编辑