Skip to content

Instantly share code, notes, and snippets.

@aresxin
Last active December 6, 2023 06:45
Show Gist options
  • Save aresxin/0599518f4c8249817d2eabaa953984f8 to your computer and use it in GitHub Desktop.
Save aresxin/0599518f4c8249817d2eabaa953984f8 to your computer and use it in GitHub Desktop.
iOS&Swift

Foundation

Data Formatting

Sample Code

https://developer.apple.com/documentation/foundation/formatter/displaying_human-friendly_content

ListFormatter&PersonNameComponentsFormatter

https://www.swiftbysundell.com/articles/exploring-some-of-the-lesser-known-formatter-types/
https://developer.apple.com/videos/play/wwdc2020/10160/
https://developer.apple.com/documentation/foundation/data_formatting

Stringsdict File Format

https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/BPInternational/StringsdictFileFormat/StringsdictFileFormat.html
https://www.hackingwithswift.com/example-code/strings/how-to-display-different-strings-based-on-available-space-using-variantfittingpresentationwidth
https://www.jianshu.com/p/a271347324de

Formatter API

https://developer.apple.com/documentation/foundation/date/3766588-formatted
WWDC 2021新Formatter API:新老比较及如何自定义

Codable

https://www.andyibanez.com/posts/the-mysterious-codablewithconfiguration-protocol/
深入 Decodable —— 写一个超越原生的 JSON 解析器

AttributedString

AttributedString
AttributedString——不仅仅让文字更漂亮

NotificationCenter

Typed Notifications

通过block接口添加通知NotificationCenter.addObserver(forName: object: queue: using:),需要手动删除,否则内存泄漏

let token = addObserver(forName: name, object: obj, queue: queue, using: block)
NotificationCenter.default.removeObserver(token as Any)

SwiftUI

https://cs193p.sites.stanford.edu/

Core ML

Core ML
Awesome-CoreML-Models

Combine

https://developer.apple.com/documentation/combine
https://theswiftdev.com/urlsession-and-the-combine-framework/
https://onevcat.com/2020/01/customize-publisher/
https://www.jianshu.com/p/df8535b40079
https://www.jianshu.com/p/a9c04a84d911
https://github.com/cx-org/CombineX
https://github.com/yanglfree/SwiftUI-Combine-Coding
https://learnku.com/articles/36322
https://zhuanlan.zhihu.com/p/343631974
深入浅出 Apple 响应式框架 Combine
Apple 官方异步编程框架:Swift Combine 简介
Apple 官方异步编程框架:Swift Combine 应用
Combine 框架,从0到1 —— 5.Combine 提供的发布者(Publishers)
UIKit Combine
Combine 简明教程一: Publisher、Subscriber
Combine 简明教程二:自定义 Subscriber、Publisher
Combine 简明教程三:Subject
Combine 简明教程四:Operators

ARkit

Awesome-ARKit

Vision

Detecting Hand Poses with Vision
Detecting Human Body Poses in an Image

VisionKit

VisionKit
isionKit document scanner
用苹果官方 API 实现 iOS 备忘录的扫描文稿功能

UIKit

Autolayout

iOS9下代码创建约束
Align UIButton and UILabel text with different font sizes
IOS AutoLayout 详解
Adventures in iOS Programming: Self-Sizing Cells
setNeedsLayout VS layoutIfNeeded
Editing Multiple Constraints


YW浣熊的iOS— Size Class — Compact vs Regular
Auto Layout Guide
Demo



iOS safeAreaInsets相关知识
修改安全区域, 如果对系统所提供的安全区域不满意, 还可以通过additionalSafeAreaInsets属性来修改安全区域

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = UIColor.redColor;
    //修改安全区域  
    self.additionalSafeAreaInsets = UIEdgeInsetsMake(100, 30, 100, 40);
}

输出结果:
self.view.safeAreaInsets.top = 144.000000
self.view.safeAreaInsets.left = 30.000000
self.view.safeAreaInsets.bottom = 134.000000
self.view.safeAreaInsets.right = 40.000000 

从输出接口可以看出: (1)通过additionalSafeAreaInsets可以修改安全区域的大小; (2)修改的安全区域的大小时,是在原来的安全区域的基础上做出修改的;


UICollectionView

iOS 13 Compositional Layouts

iOS 13 Compositional Layouts in CollectionView
Compositional Layout 詳解 讓你簡單操作 CollectionView!


ios 13 diffable data source

Advances in UI Data Sources -Apple Session
NSDiffableDataSourceSnapshot -Apple Doc
iOS开发之DiffableDataSource


WebKit

WKWebView

干货:探秘WKWebView
webview NSURLErrorCancelled
WKWebView get Javascript Errors

GroupActivities

GroupActivities
SharePlay for Developers

Core Image

Core Image
Core Image Filter Reference
Core Image Tutorial for iOS: Custom Filters

APP Icon

Xcode 配置多套 App 图标的方法 --- AppStore 图标 A/B Test 实践

App Clip

App Clip 新特性

App Documents Share

App Documents Share

An observer that you use to monitor and react to network changes.

Native Network Monitoring In Swift
Observe Your iOS App’s Network Connection Using Combine

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment