Swift常用Snippets

private lazy var phoneTextField: UITextField = {
        let textField: UITextField = UITextField()
        textField.backgroundColor = .clear
        textField.font = FVFontM(22)
        textField.textColor = .white
        textField.returnKeyType = .done
        textField.keyboardType = .phonePad
    textField.placeholder = <#string#>
        textField.rightViewMode = .whileEditing
        return textField
    }()
guard let self = self else { return }
// MARK: - <#string#>
/// 微信登录按钮
private lazy var wechatLoginBtn: UIButton = {
        
        let btn = UIButton()
        btn.setTitle(<#string#>, for: .normal)
        btn.setTitleColor(FVColor(0x121212), for: .normal)
        btn.setImage(FVImage(<#string#>), for: .normal)
        btn.backgroundColor = .white
        btn.layer.masksToBounds = true
        btn.layer.cornerRadius = 25
        btn.addTarget(self, action: #selector(onWechtLoginBtnClicked(btn:)), for: .touchUpInside)
        return btn
        
    }()
private lazy var appIcon: UIImageView = {
        let view = UIImageView()
        view.image = FVImage("fv_login_appIcon")
        return view
    }()
private lazy var <#name#>: UITableView = {
        
        let view = UITableView(frame: .zero, style: .plain)
        view.backgroundColor = UIColor.clear
        view.separatorStyle = .none
        view.register(<#class#>.self, forCellReuseIdentifier: FVDescribe(<#class#>.self))
        view.dataSource = self
        view.delegate = self
        view.automaticallyAdjustsScrollIndicatorInsets = false
        view.contentInsetAdjustmentBehavior = .never

        if #available(iOS 15.0, *) {
            view.sectionHeaderTopPadding = 0
        }
        return view
    }()
// MARK: - 方法...
    private func showItems() {
        
        view.addSubview(navBar)
        navBar.titLab.text = <#string#>
    }
    
view.addSubview(phoneLoginBtn)
        phoneLoginBtn.snp.makeConstraints { make in
            make.bottom.equalTo(wechatLoginBtn.snp.top).offset(FVScale(20))
            make.width.equalTo(FVScale(300))
            make.height.equalTo(FVScale(50))
            make.centerX.equalTo(view)
        }

extension <#Class#>: UITableViewDataSource, UITableViewDelegate {
    
    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return listModel.list.count
    }
    
    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        
        let cell = tableView.dequeueReusableCell(withIdentifier: FVDescribe(<#Class#>.self), for: indexPath) as! <#class#>
        
        return cell
    }
    
    func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
        return FVScreenHeight - FVNavBarHeight - FVTabBarHeight
    }
    
    func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
        
    }
    
}
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容