swift
Cocoanerd
Pick a schedule you can live with, and stick to it. I don’t care if you suck at writing, if nobody reads, if you have nothing interesting to say. If you can demonstrate a willingness to write, and a desire to keep continually improving your writing, you will eventually be successful.
展开
-
swfit 过滤手机号、座机号
今天要实现物流信息里面电话可以点击拨打。然而服务端用的快递100三方返回的内容,只有物流信息和时间,作为前端,我们改怎么知道一条物流信息里面有几个手机号,几个座机号。我是没辙了。用富文本实现可以点击拨打电话很简单,但是怎么样鞥呢过滤出来手机号和座机号呢,当然用正则过滤喽奉上代码//手机号fileprivate let regexMobilePhoneStr = "\\d{11}"//固话...原创 2020-01-19 14:39:58 · 389 阅读 · 0 评论 -
swift设置label文字左右两端对齐
效果:就是身份证号:邮 箱:这样对齐明白吗import UIKitimport CoreTextimport Foundationpublic extension UILabel { /** 使文字左右两端对齐 font:字体为了计算字体宽度 labelWidth:控件宽度 */ func textAlignmentL...原创 2020-01-17 11:28:09 · 1733 阅读 · 0 评论 -
swift中.type .self、any、anyObject
这篇文章介绍的还行.type代表一个X元类型 Int.Type 就是Int的元类型class SearchViewController: UIViewController { }class MessageViewController: UIViewController { } let vcTypes: [AnyClass] = [SearchViewControl...原创 2019-12-16 20:48:36 · 515 阅读 · 0 评论 -
typealias总结
用来为已经存在的类型重新定义名字阅读方便typealias Location = CGPointtypealias Distance = Double自定义类型:OC和swift混编情况下,OC进行swift化。规避地项对搜索-查找-替换// OC中项目里有个类#import "OCClass.h"// swift重构之后impot SwfitClasstypealias OC...原创 2019-12-16 20:02:33 · 359 阅读 · 0 评论 -
swift常用第三方库
网络Alamofire:http网络请求事件处理的框架。Moya:这是一个基于Alamofire的更高层网络请求封装抽象层。Reachability.swift:用来检查应用当前的网络连接状况。综合Perfect:swift的服务器端开发框架(针对于移动后端开发、网站和web应用程序开发)。RxSwift:函数响应式编程框架,是ReactiveX的swift版本,可以简化异步操作和事...转载 2019-05-27 15:54:30 · 468 阅读 · 0 评论