Giter Site home page Giter Site logo

lyconveniencekit's Introduction

LYConvenienceKit -- Swift5.0

Platform Language

支持pod导入:

pod 'LYConvenienceKit'

使用说明:

LYConvenienceKit依赖了SnapKitAlamofire两个框架,pod时会导入这两个框架

简单使用:(注:可下载demo具体查看)

//这样导入一次后整个项目可用
@_exported import LYConvenienceKit

UILable

let lable = UILabel()
            .text("test")
            .textColor(.red)
            .font(15)
            .numberOfLines(0)
            .textAlignment(.center)
            .layout(view) { (make) in
                make.top.equalTo(100)
                make.left.equalTo(100)
        }                   

UITableView

        UITableView()
            .estimatedRowHeight(40)
            .separatorStyle(.singleLine)
            .delegate(self)
            .dataSource(self)
            .registerCellClass(UITableViewCell.self)
            .registerHeaderFooterClass(TabHeaderView.self)
            .layout(view) { (make) in
                make.edges.equalToSuperview()
        }

UIColor

//颜色样式 
public enum LYColorStyle: Int {
        ///默认文字颜色#000000
        case defaulted = 0x000000
        ///用于标题文字 #1F1F1F
        case title = 0x1F1F1F
        ///用于普通级文字信息 #333333
        case content = 0x333333
        ///用于次级文字信息 #666666
        case secondary = 0x666666
        ///用于提示性文字,未编辑状态时的文字颜色 #999999
        case placeholder = 0x999999
        ///用于文字选中、可点击状态 #157EFB
        case click = 0x157EFB
        ///用于特别强调和突出文字 #FF2600
        case emphasize = 0xFF2600
        ///用于导航栏底部的分割线颜色,部分按钮描边色 #DADADA
        case navigationLine = 0xDADADA
        ///用于分割线颜色,以及框的描边,按钮点击色 #E5E5E5
        case partingLine = 0xE5E5E5
        ///用于内容区域的背景底色 #F5F5F5
        case backgroundView = 0xF5F5F5
}

//使用
UIColor(.title)
//16进制颜色
UIColor(0xFFFFFF)

NSMutableAttributedString

let astr:NSMutableAttributedString = str.ly.attributedString()//String -> NSAttributedString
            astr.mixtureAttributString(LYMixtureAttribute(string: "红色", color: .red, font: UIFont.systemFont(ofSize: 20)))//设置属性文本
                .mixtureAttributString(LYMixtureAttribute(string: "蓝色", color: .blue, font: UIFont.systemFont(ofSize: 25)))//设置属性文本
                .addUnderline(.yellow)//添加下滑线
                .addStrikethrough(.yellow)//添加删除线
                .addImage(#imageLiteral(resourceName: "YELLOW2d"), bounds: CGRect(x: 0, y: 0, width:40, height: 40))//添加图片(默认添加到最后,position添加到具体位置)
                .changeLineSpace(50)//修改行距
                .markerStringOf(LYMixtureAttribute(string: "b", color: .yellow, font: UIFont.systemFont(ofSize: 30)))//标记第一个子串
                .markerAllStringOf(LYMixtureAttribute(string: "4", color: .orange, font: UIFont.systemFont(ofSize: 30)))//标记所有子串
            
            lable1.attributedText(astr)

更具体的下载demo查看

代码块使用

你也可以结合代码块达到更高效率的编程,代码块上传到项目里了,点击下载

1.打开访达,Command + Shift + G. 前往如下路径的文件夹

2.路径 : ~/Library/Developer/Xcode/UserData/CodeSnippets

3.把下载下来的文件复制到这个文件里,没有这个文件的在UserData下创建一个CodeSnippets文件

4.重启xcode,就可以使用了

参考

SnapKit Alamofire

结尾语:

  • 使用过程中发现bug请提出
  • 有新的需求欢迎提出;
  • 由于gitup有时下载慢,我把项目也放到了gitee上。

lyconveniencekit's People

Contributors

liuyik avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.