import UIKit
class NSLocalImageURLProtocol: URLProtocol {
static let schemaName = "myapp"
override class func canInit(with request: URLRequest) -> Bool {
if let schema = request.url?.scheme?.lowercased(),
sch[......]
import UIKit
class NSLocalImageURLProtocol: URLProtocol {
static let schemaName = "myapp"
override class func canInit(with request: URLRequest) -> Bool {
if let schema = request.url?.scheme?.lowercased(),
sch[......]
As of Swift 2.0, you don't need to write your own extension to filter nil values from an Array, you can use flatMap, which flattens the Array and filters nils:
let optionals : [String?] = ["a", "b", nil, "d"]
let nonOptionals = optionals.flatMap{$0[......]
代码如下:
注意priority high是关键
class YYCell: UITableViewCell {
fileprivate var tvHeightConstraint: Constraint? = nil
....
fileprivate func setupUI() {
textView.snp.makeConstraints { (make) in
make.top.equalToSupervi[......]
1、新建Target
2、实现UNNotificationServiceExtension
我这里用的是swift
//
// NotificationService.swift
// NotificationServiceExtension
//
// Created by Heyuan Li on 17/2/26.
// Copyright © 2017年 fenbi. All rights reserved.
//
import Us[......]
Swift 3现在提供了内置方法,可以做个简单的封装:
extension String {
/// 假设string是url,抽取key&value对
func tt_urlQueryDict() -> [String: String] {
var dict = [String:String]()
guard let queryItems = URLComponents(string: self)?.queryItems[......]