iOS 组件 由 Trendyol 的应用程序开发团队为 iOS 制作。
iOS 组件包含各种用纯 Swift 编写的 ios 自定义视图和辅助框架。由 Trendyol 的 iOS 应用程序开发团队开发。
为什么?
开发出来是为了帮助社区中的 iOS 开发者更轻松地构建美观且功能强大的 iOS 应用程序。
组件测试应用
您可以通过克隆仓库来查看命名 ComponentsTestApp 的测试应用。这里共享的所有组件同时在测试应用中实现。
组件
以下列出所有组件的简要概述。有关详细信息,请点击在每个组件部分的链接提供的组件链接。
ImageSlider
基于自定义集合视图的滑动组件,具有无限循环滚动
PinchableImageView
为UIImageView提供类似instagram的全屏缩放功能。
AutoCompleteTextField
PropertyWrapper
当你需要在DTO中使用枚举类型时,你需要确保所有类型均可确认。为此,你需要创建自定义初始化。通过此实现,你不再需要编写自定义初始化。此外,我们认为在DTO中不需要使用可选的布尔值。因为在我们使用可选布尔值编写代码时,我们已经为它们提供了默认值。你可以在你的DTO中使用DefaultTrue或DefaultFalse包装器,如果该字段为nil,则将设置默认值。
// With this implemantation you can be sure your code can't crash when new UserType added.
enum UserType: String, Codable {
case admin, user, none
public init(from decoder: Decoder) throws {
self = try UserType(rawValue: decoder.singleValueContainer().decode(RawValue.self)) ?? .none
}
}
// With This Property Wrapper you can set Default value for UserType. You can set default value with LastCase or FirstCase.
// Also With DefaultFalse or DefaultTrue you can save your code from `UserResponse.isAdmin ?? false`
enum UserType: String, EnumDefaultValueSelectable {
case admin, user, none
}
struct UserResponse: Codable {
@DefaultCodable<LastCase> var user: UserType
@DefaultCodable<DefaultFalse> var isAdmin: Bool
}
许可证
Copyright 2019 Trendyol.com
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://apache.ac.cn/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.