This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
// 给 int 类型起个别名为 INT | |
typedef int INT; | |
// 方式 2 | |
// 定义 Student 结构体类型 | |
struct Student { | |
char name; | |
int age; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "Mediator.h" | |
NSString * const kMediatorParamsKeySwiftTargetModuleName = @"kMediatorParamsKeySwiftTargetModuleName"; | |
@interface Mediator () | |
@property (nonatomic, copy) NSMutableDictionary *cachedTarget; | |
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// 金额分 数字格式化 如 4132 --> 4,132.00 | |
func decimalFormatterValue(value: Int) -> String? { | |
let decimal = value % 100 | |
let nonDecimal = value / 100 | |
let formatter = NumberFormatter.init() | |
formatter.numberStyle = .decimal | |
if let title = formatter.string(from: NSNumber.init(value: nonDecimal)) { | |
return title + String.init(format: ".%02d", decimal) | |
} | |
return nil |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// 带弧度的 View | |
public static func createCurveView(frame: CGRect, curveScale: CGFloat, fillColor: UIColor = UIColor.white) -> UIView { | |
let view = UIView(frame: frame) | |
view.backgroundColor = UIColor.clear | |
let finalSize = CGSize(width: UIScreen.main.bounds.size.width, height: frame.size.height) | |
let layer = CAShapeLayer() | |
let bezier = UIBezierPath() | |
bezier.move(to: CGPoint(x:0, y:0)) | |
bezier.addLine(to: CGPoint(x:0, y:finalSize.height)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let contentView = UIView(frame: CGRect(x: 0, y: 0, width: UIScreen.main.bounds.size.width, height: 200)) | |
let gradientLayer = CAGradientLayer() | |
gradientLayer.frame = self.bounds | |
gradientLayer.colors = [UIColor.white.withAlphaComponent(0).cgColor, UIColor.white.cgColor] | |
gradientLayer.startPoint = CGPoint(x: 0, y: 0) | |
gradientLayer.endPoint = CGPoint(x: 0, y: 0.5) | |
contentView.layer.addSublayer(gradientLayer) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import LocalAuthentication | |
@objc func onClickPayBtn(_ sender: UIButton) { | |
let context = LAContext() | |
var error: NSError? | |
let isEnable = context.canEvaluatePolicy(LAPolicy.deviceOwnerAuthenticationWithBiometrics, error: &error) | |
if isEnable == false { | |
if let err = error { | |
var message = "" | |
switch err.code { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// FontViewController.swift | |
// SF | |
// | |
// Created by muhlenXi on 2018/12/2. | |
// Copyright © 2018 muhlenXi. All rights reserved. | |
// | |
import UIKit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// AreaSelectPicker.swift | |
// SF | |
// | |
// Created by muhlenXi on 2018/11/28. | |
// Copyright © 2018 muhlenXi. All rights reserved. | |
// | |
import UIKit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
fileprivate let CellIdentifier = "CellIdentifier" | |
// MARK: InterCell | |
class InterCell: UICollectionViewCell { | |
lazy var thumbnail: UIImageView = { | |
let imageView = UIImageView() | |
imageView.backgroundColor = UIColor.white |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
public extension URL { | |
/// 获取 URL 参数和值 | |
public var queryParameters: [String: String]? { | |
guard let components = URLComponents(url: self, resolvingAgainstBaseURL: true), let queryItems = components.queryItems else { | |
return nil | |
} | |
var parameters = [String: String]() |
NewerOlder