All Projects → CatchZeng → AdaptationKit

CatchZeng / AdaptationKit

Licence: MIT license
📱 screen auto adaptation solution.

Programming Languages

swift
15916 projects
ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to AdaptationKit

dclareForMPS
Adding declarative, reactive and incremental rules to MPS
Stars: ✭ 21 (-8.7%)
Mutual labels:  rules
ws-qvh
Server for streaming the screen of iOS devices over WebSocket.
Stars: ✭ 17 (-26.09%)
Mutual labels:  screen
Android-Touch-Helper
开屏跳过-安卓系统的开屏广告自动跳过助手
Stars: ✭ 488 (+2021.74%)
Mutual labels:  screen
BetterDummy
Unlock your displays on your Mac! Smooth scaling, HiDPI unlock, XDR/HDR extra brightness upscale, DDC, brightness and dimming, dummy displays, PIP and lots more!
Stars: ✭ 9,601 (+41643.48%)
Mutual labels:  screen
lantern
[Android Library] Handling device flash as torch for Android.
Stars: ✭ 81 (+252.17%)
Mutual labels:  screen
powerflows-dmn
Power Flows DMN - Powerful decisions and rules engine
Stars: ✭ 46 (+100%)
Mutual labels:  rules
Streamalert
StreamAlert is a serverless, realtime data analysis framework which empowers you to ingest, analyze, and alert on data from any environment, using datasources and alerting logic you define.
Stars: ✭ 2,634 (+11352.17%)
Mutual labels:  rules
audio-share-discord-linux
Discord screenshare, now with audio!
Stars: ✭ 44 (+91.3%)
Mutual labels:  screen
RS232-Monitor-Database
🔌📺 This is a public database for all the known RS232 commands for professionnal screens, monitors and projectors. Feel free to contribute !
Stars: ✭ 22 (-4.35%)
Mutual labels:  screen
edgeofchaos
This repository is not maintained anymore. If I have any significant contributions, I usually do a PR for the Faust libraries. This repository contains the Faust libraries for sound and information processing that I use to implement my music complex adaptive systems.
Stars: ✭ 51 (+121.74%)
Mutual labels:  adaptation
laravel-admin
LaravelAdmin是基于PHP开发的基础管理后台系统,做到开箱即用,为新项目开发省去了基础功能开发的步骤;此系统采用前后端分离模式,后端使用Laravel,前端使用vue;主要包含:登录、注销、可视化数据大屏、管理员、角色管理、菜单管理、权限管理、错误日志、登录日志、访问日志、获取服务器CPU使用率、内存使用率等功能。后端主要使用Artisan命令行、Jobs消息队列、 Rules验证规则、Restful API、Composer扩展包、Redis秒杀、Extend自定义扩展类:微信授权、钉钉告警推送、MongoDB、阿里云OSS、七牛云存储、七牛云直播、php-jwt TOKEN、Phpoffice、MySql数据库字典、Elasticsearch等技术。
Stars: ✭ 45 (+95.65%)
Mutual labels:  rules
xpub
POSIX Shell script to get user's display environment variables of any TTY from anywhere.
Stars: ✭ 36 (+56.52%)
Mutual labels:  rules
tmux-conf
📝 TMUX Configuration for nerds with tpm
Stars: ✭ 31 (+34.78%)
Mutual labels:  screen
wluma
Automatic brightness adjustment based on screen contents and ALS
Stars: ✭ 290 (+1160.87%)
Mutual labels:  screen
libgdx-screenmanager
A screen manager for libgdx supporting transitions
Stars: ✭ 69 (+200%)
Mutual labels:  screen
pub-rules
Rules - Powerful and feature-rich validation library for both Dart and Flutter.
Stars: ✭ 24 (+4.35%)
Mutual labels:  rules
Ocean-blue-GDM3
Ocean Blue GDM3 theme for ubuntu
Stars: ✭ 27 (+17.39%)
Mutual labels:  screen
ReshaperForBurp
Burp Suite Extension - Trigger actions and reshape HTTP request/response and WebSocket traffic using configurable rules
Stars: ✭ 32 (+39.13%)
Mutual labels:  rules
choco-screen-resolution
Sets the screen resolution on Windows virtual machines (VMs)
Stars: ✭ 24 (+4.35%)
Mutual labels:  screen
SwitchDecor
An app to help you to add frame to your favorite screenshots from Nintendo Switch.
Stars: ✭ 40 (+73.91%)
Mutual labels:  screen

AdaptationKit

Swift Version License Platform

📱 screen auto adaptation solution.

中文请戳

Features

  • Quickly adapt to various screens.
  • Calculate inch & font automatically.
  • Support operator.
  • Support IBInspectable.
  • Customize adaptation rules.

Usage

Import the framework firstly.

import AdaptationKit

ScreenMatchable

Quickly adapt to various screens. Support Int,Float,Double,String,CGRect,CGSize,CGFloat,CGPoint,UIEdgeInsets.

Effect

label.text = "I am " +
"unkown screen"
.i4("iPhone 4 like screen.")
.i8("iPhone 8 like screen.")
.i8P("iPhone 8Plus like screen.")
.iX("iPhone X like screen.")
.iXR("iPhone XR like screen.")
.iXMAX("iPhone XS MAX like screen.")
.p97("iPad 9.7 like screen.")
.p105("iPad 10.5 like screen.")
.p11("iPad 11 like screen.")
.p129("iPad 12.9 like screen.")

/*
* default numberOfLines = 0
* iPad numberOfLines = 1
* iPhone(In addition to iPhone XS Max) numberOfLines = 2
* iPhone XS Max numberOfLines = 3
*/
label.numberOfLines = 0.pad(1).phone(2).iXMAX(3)

/*
* default value = "0"
* iPad 9.7 & iPhone X value = "1"
*/
let value = "0".match([.p97, .iX], "1")

Extend other types you need.

extension YouType: ScreenMatchable {}

Adaptable

Calculate inch & font automatically.

/*
* default(iPhone 8) width = 12.0
* iPhone 4 width = 10.24
* iPhone X MAX  width = 13.248
* ...
*/
testView.snp.makeConstraints { (make) in
    make.width.equalTo(12.adaptInch())
}

/*
* default(iPhone 8) size = 12.0
* iPhone 4 size = 10.24
* iPhone X MAX  size = 13.248
* ...
*/
label.font = UIFont(name: label.font.fontName, size: 12.0.adaptFont())


// operator
// ~ means adaptInch()
// ≈ means adaptFont()

testView.snp.makeConstraints { (make) in
    make.width.equalTo(12~)
}

label.font = UIFont(name: label.font.fontName, size: 12.0

UI

adaptFont

Support UILabel,UITextView,UITextField.

label.adaptFont = true // equal to  label.font = UIFont(name: label.font.fontName, size: font.pointSize.adaptFont())

IBInspectable

Effect

adaptConstant

Calculate NSLayoutConstraint's constant automatically.

constraint.adaptConstant = true

IBInspectable

Effect

AdaptationRule

All of the above automatic calculations are based on the default rules(AdaptationRule.default).

If you want to customize the rules of the calculation, you can call the set method.

let inchRule = AdaptationRule(baseScreen: .i8)
inchRule.set(screen: .i4, ratio: 0.5)
inchRule.set(screen: .iXMAX, ratio: 1.3)
AdaptationKit.set(inchRule: inchRule)

let fontRule = AdaptationRule(baseScreen: .i8)
fontRule.set(screen: .i4, ratio: 0.6)
fontRule.set(screen: .iXMAX, ratio: 1.5)
AdaptationKit.set(fontRule: fontRule)

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Installation

AdaptationKit is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'AdaptationKit'

Author

catchzeng, [email protected]

License

AdaptationKit is available under the MIT license. See the LICENSE file for more info.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].