Windows端口占用
- netstat -aon|findstr "8085"
- tasklist|findstr "14572"
- task >taskkill /T /F /PID
the port pid number
端口占用
- sudo lsof -i:(port)
- sudo kill (PID)
Swift tool-chain下载
Xcode 版本下载
https://download.developer.apple.com/Developer_Tools/Xcode_12.5.1/Xcode_12.5.1.xip
xcodebuild 使用系统git终端代理解决github慢问题
xcodebuild -resolvePackageDependencies -scmProvider system
PublicAIPs
https://github.com/public-apis/public-apis
iOS15导航栏适配
if (@available(iOS 15.0, *)) {
UINavigationBarAppearance *appearance = [UINavigationBarAppearance new];
appearance.titleTextAttributes = @{NSForegroundColorAttributeName :UIColor.greenColor};
appearance.backgroundColor = UIColor.redColor;
appearance.buttonAppearance.normal.titleTextAttributes = @{NSForegroundColorAttributeName: UIColor.greenColor};
appearance.doneButtonAppearance.normal.titleTextAttributes = @{NSForegroundColorAttributeName: UIColor.greenColor};
appearance.backButtonAppearance.normal.titleTextAttributes = @{NSForegroundColorAttributeName: UIColor.yellowColor};
self.navigationBar.scrollEdgeAppearance = appearance;
self.navigationBar.standardAppearance = appearance;
}
Xcode低版本调试真机高版本
- 复制
高版本Xcode对应的iPhoneOS15.0.sdk
到低版本Xcode的目录/Applications/Xcode12.5.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs
下 - 复制
15.0
对应的文件到低版本Xcode目录/Applications/Xcode12.5.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport
下
Docker
免费icons
Font Bold Text
UIFontWeightUltraLight > UIFontWeightThin
UIFontWeightThin > UIFontWeightLight
UIFontWeightLight > UIFontWeightRegular
UIFontWeightRegular > UIFontWeightSemibold
UIFontWeightMedium > UIFontWeightBold
UIFontWeightSemibold > UIFontWeightHeavy
UIFontWeightBold > UIFontWeightBlack
UIFontWeightHeavy > UIFontWeightBlack
UIFontWeightBlack > UIFontWeightBlack
免费工具网站
网易云音乐API
PicGo + Gitee 配置图床
PlanUML
免费图片api
Swift 规范
国内网速测试
UserDefaults 下标
// UserDefaults.standard[key] = value
extension UserDefaults {
subscript(key: String) -> Any? {
set{
setValue(newValue, forKey: key)
synchronize()
}
get{
return value(forKey: key)
}
}
}
汉字笔画库
HanZiWriter
https://hanziwriter.org/docs.html
Jasper 入门
https://blog.csdn.net/dullchap/article/details/51799070
深入iOS系统底层之crash解决方法
https://juejin.cn/post/6844903670404874254
iOS设备升/降级
https://www.163.com/dy/article/GDVG8MBH05373GLF.html
大陆身份证号计算规则
计算方法
1、将前面的身份证号码17位数分别乘以不同的系数。从第一位到第十七位的系数分别为:7-9-10-5-8-4-2-1-6-3-7-9-10-5-8-4-2。
2、将这17位数字和系数相乘的结果相加。
3、用加出来和除以11,看余数是多少?
4、余数只可能有0-1-2-3-4-5-6-7-8-9-10这11个数字。其分别对应的最后一位身份证的号码为1-0-X -9-8-7-6-5-4-3-2。(即余数0对应1,余数1对应0,余数2对应X...)
5、通过上面得知如果余数是3,就会在身份证的第18位数字上出现的是9。如果对应的数字是2,身份证的最后一位号码就是罗马数字X。
例如:某男性的身份证号码为【53010219200508011X】, 我们看看这个身份证是不是符合计算规则的身份证。
首先我们得出前17位的乘积和【(5*7)+(3*9)+(0*10)+(1*5)+(0*8)+(2*4)+(1*2)+(9*1)+(2*6)+(0*3)+(0*7)+(5*9)+(0*10)+(8*5)+(0*8)+(1*4)+(1*2)】是189,然后用189除以11得出的结果是189÷11=17余下2,187÷11=17,还剩下2不能被除尽,也就是说其余数是2。最后通过对应规则就可以知道余数2对应的检验码是X。所以,可以判定这是一个正确的身份证号码。
Xcode已损坏,无法打开,您应该将其移至废纸篓
xattr -rc /Applications/Xcode.app
递归获取满足条件subview
extension UIView {
func subviews(where condition: (UIView) throws -> Bool) rethrows -> [UIView] {
var subs = try subviews.filter(condition)
for sub in subviews {
let matches = try sub.subviews(where: condition)
subs.append(contentsOf: matches)
}
return subs
}
}
16进制颜色转换
static func _hexColor(_ hexString: String) -> UIColor? {
var string = ""
if hexString.lowercased().hasPrefix("0x") {
string = hexString.replacingOccurrences(of: "0x", with: "")
} else if hexString.hasPrefix("#") {
string = hexString.replacingOccurrences(of: "#", with: "")
} else {
string = hexString
}
if string.count == 3 { // convert hex to 6 digit format if in short format
var str = ""
string.forEach { str.append(String(repeating: String($0), count: 2)) }
string = str
}
guard let hexValue = Int(string, radix: 16) else { return nil }
let red = (hexValue >> 16) & 0xff
let green = (hexValue >> 8) & 0xff
let blue = hexValue & 0xff
return .init(red: CGFloat(red)/255, green: CGFloat(green)/255, blue: CGFloat(blue)/255, alpha: 1)
}
百度地图SDK
高德地图SDK
https://lbs.amap.com/api/ios-sdk/guide/
唤起:https://lbs.amap.com/api/amap-mobile/guide/ios/route
Moya URL编码问题
https://github.com/Moya/Moya/issues/1049
UIViewController的touchesBegan
事件处理问题
处理弹出对话框时,蒙层点击消失,内容区域点击不处理
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
super.touchesBegan(touches, with: event)
if !canMaskViewDismissable {
return
}
var isTouchInner = false
let list = event?.allTouches?.filter{ $0.view != nil } ?? []
for t in list
{
let loc = t.preciseLocation(in: contentView)
print(loc)
if contentView.bounds.contains(loc) {
isTouchInner = true
break
}
}
if canMaskViewDismissable, !isTouchInner {
close()
}
}
Fastlane打包上传蒲公英
安装:sudo install fastlane -NV
工程目录下:fastlane init
编辑:Fastfile
default_platform(:ios)
platform :ios do
puts "============ 打包开始 ==========="
lane :pkg do |options|
version = get_info_plist_value(path: "./YourApp/Supports/Info.plist", key: "CFBundleVersion")
config = options[:to]
channel = "development"
env = "Debug"
if config == "appstore"
channel = "app-store"
env = "Release"
end
gym(
configuration: "#{env}",
export_method: "#{channel}",
silent: true,
clean: true,
scheme: "RaveLand",
output_name: "YourApp_#{channel}_#{version}.ipa",
output_directory: "./build",
)
if config == "pgy"
puts "============ 开始上传蒲公英 ============ "
pgyer(api_key: "", user_key: "")
puts "============ 上传蒲公英成功 ============ "
end
puts "============ 打包完成 ============ "
system "open ./build"
end
end
蒲公英插件:fastlane add_plugin pgyer
打包:fastlane pkg
Github更新开源库
git add .
git commit -m 'MESSAGE'
git push
git tag x.x.x
git push --tags
pod trunk register EMAIL "USERNAME"
pod trunk push .podspec --allow-warnings --verbose
网友评论