Giter Site home page Giter Site logo

jy-1024 / inspire Goto Github PK

View Code? Open in Web Editor NEW

This project forked from xaoxuu/inspire

0.0 0.0 0.0 962 KB

主题式Swift开发工具包,包含布局、颜色、字体等。

Home Page: https://xaoxuu.com/wiki/inspire

License: MIT License

Ruby 2.23% Swift 92.72% Objective-C 1.31% Shell 3.74%

inspire's Introduction

Inspire

基于主题的Swift开发工具包

包含颜色、字体、布局等,可配置可缓存

特性

可缓存的

  • App 的样式参数(颜色、字体、布局)存储于 json 文件中。

可配置的

  • 可由用户修改主题参数并保存或者分享。

提供便利

  • 便捷的方式获取屏幕布局参数、如各边安全区域尺寸,便于机型适配。

开始使用

使用 CocoaPods

pod 'Inspire'
pod install

使用 Package.swift

在 Package.swift 中声明依赖项:

.package(url: "https://github.com/xaoxuu/Inspire.git", from: "1.1.0"),

用法示例

颜色

view.backgroundColor = .background
view.tintColor = .accent

字体

let lb = UILabel()
lb.font = .regular(15)
lb.font = .bold(20, for: .title)
lb.font = .regular(14, for: .code)

边距

let topMargin = layout.topBarHeight(for: self)
let bottomMargin = layout.bottomBarHeight(for: self)
let safeArea = layout.safeAreaInsets(for: self)
let safeArea2 = Inspire.shared.screen.safeAreaInsets
let layout = Inspire.shared.layout
view.frame.size.height = layout.rowHeight
view.layer.cornerRadius = layout.cornerRadius.large

缓存

// 保存
Inspire.shared.cache()
Inspire.shared.cache(named: "myTheme")
// 读取
let ipr = Inspire.init("myTheme")

inspire's People

Contributors

xaoxuu 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.