hyperoslo/Sugar — 1.1k★ trên GitHub (Swift). :coffee: Something sweet that goes great with your Cocoa
Tóm tắt dựng từ metadata GitHub của chính dự án — chưa có bài review TopGit. Trang sẽ tự động cập nhật khi bài review đầy đủ được xuất bản.
VÌ SAO CHƯA CÓ REVIEW
TopGit viết bài đầy đủ cho repo có nhiều sao nhất và được yêu cầu nhiều nhất. Trang này là snapshot trong thời gian chờ — xem README gốc ở tab READ ME.
Get the actual pixel information of the device screen.
Simulator
if !Simulator.isRunning {
// add device specific operations here
}
To easily exclude operations from when you as a developer runs the application in the simulator,
not subscribing to push notification or running analytics operations etc.
Keyboard Observer
Observe keyboard showing and hiding events, and handle it
let handler = BasicKeyboardHandler()
handler.show = { [weak self] height in
// move text fields up
}
handler.hide = { [weak self] in
// move text fields back to original position
}
keyboardObserver = KeyboardObserver(handler: handler)
if date1 < date2 {
// do something
} else if date1 >= date2 {
// do something else
}
Construct
let _ = 5.day
let _ = 3.week
Frame
let view = UIView()
view.width = 200
view.height = 200
view.x = 25
view.y = 25
print(view.width) // prints 200
print(view.height) // prints 200
print(view.x) // prints 25
print(view.y) // prints 25
Grand Central Dispatch
dispatch {
// dispatch in main queue
}
dispatch(queue: .Background) {
// dispatch in background queue
}
lazy var serialQueue = dispatch_queue_create("serialQueue", DISPATCH_QUEUE_SERIAL)
dispatch(queue: .Custom(serialQueue)) {
// dispatch in a serial queue
}
Easy dispatching with grand central dispatch.
Support all the regular global queues: Main, Interactive, Initiated, Utility, Background.
And .Custom() for your own dispatch queues.
Localization
let string = localizedString("My Profile")
let formattedString = localizedString(key: "%d numbers", arguments: 10)
Swift access (pun intended) to NSLocalizedString, you will get more valid auto completion
with this one, we promise.
Once
let once = Once()
once.run {
// do something
}
once.run {
// no effect
}
Operators
var url = NSURL(string: "hyper.no")!
url ?= NSURL(string: "\\/http")
// url is equal to hyper.no
The ?= only assigns values if the right is not nil.
Range
let acceptable = 200..<300
if acceptable.contains(response.statusCode) {
// Status code is between 200 and 299.
}
Regex
if "[email protected]".isEmail() {
// Is email
}
let stringNumber = "1984"
if stringNumber.isNumber() {
// Is a number
}
if stringNumber.matches("^[0-9]+$") {
// Is a number
}
hyperoslo/Sugar thuộc nhóm Mobile trên TopGit, cùng 4 topic GitHub. Trang Trending và Topics liệt kê các repo cùng số sao và cùng ngôn ngữ để so sánh.
Đọc thêm về hyperoslo/Sugar ở đâu?
Trang TopGit này là một snapshot — tab "Readme" hiển thị nguyên văn README của repo (đã bỏ link, giữ ảnh). Repo GitHub ở github.com/hyperoslo/Sugar là nguồn chính thức.
hyperoslo/Sugar có phải mã nguồn mở không?
TopGit chưa ghi nhận license cho hyperoslo/Sugar. Phần lớn repo public trên GitHub là mã nguồn mở, nhưng điều khoản khác nhau từng repo — mở file LICENSE để xác nhận.
hyperoslo/Sugar có trang demo không?
Dự án có trang chủ ở https://github.com/hyperoslo. Tab "Readme" ở trang này thường có ảnh chụp và hướng dẫn bắt đầu nhanh.
hyperoslo/Sugar là gì?
hyperoslo/Sugar (hyperoslo/Sugar) là dự án Swift trên GitHub. Theo mô tả gốc: :coffee: Something sweet that goes great with your Cocoa
Vì sao hyperoslo/Sugar được xếp vào nhóm Mobile?
TopGit xếp hyperoslo/Sugar vào nhóm Mobile dựa trên GitHub topics và mô tả của repo (gắn thẻ: "ios", "sugar", "sweet"). Việc phân loại dựa trên metadata thật của repo, không phải đoán theo cảm tính biên tập.
Đọc đầy đủ README ở tab phía trên.
Sugar có đáng để bạn bỏ thời gian?
ChatGPT, Claude và Perplexity đều đọc được trang này. Hỏi thử xem họ nghĩ gì về Sugar.