-
使用Swift新方法解决依赖注入
借鉴了SwiftUI中@Environment属性包装器的方案;属性包装器允许注入依赖项并减少实现端的代码混乱。不需要大的初始值设定项,并且仍然有可能覆盖测试的依赖项。属性包装器还可以明确注入哪些属性,这可以提高可读性。
-
Using Swift API availability to solve App Extension Compiled Error
Starting from Xcode12.5, Apple requires that all Extension Targets must set APPLICATION_EXTENSION_API_ONLY to true, otherwise it will cause a compilation error “Application extensions and any libraries they link to must be built with the
APPLICATION_EXTENSION_API_ONLY
build setting set to YES”; but we Framework or other methods are usually used to share code between the main project and the extension. These codes use non-extension-only APIs, which leads to problems. This article will discuss how to solve this problem. -
由App Extension无法编译看Swift API可用性
从Xcode12.5开始,苹果要求所有的Extension Target必须设置APPLICATION_EXTENSION_API_ONLY为true,否则将会导致编译错误“Application extensions and any libraries they link to must be built with the
APPLICATION_EXTENSION_API_ONLY
build setting set to YES”;但是我们通常会在主工程和Extension之间使用Framework或其他方式共享代码,这些代码中使用了非extension-only API,所以导致问题出现,本篇文章将探讨如何解决这个问题。 -
如何手动导入Realm的Framework
有些特殊情况下,你可能不想使用SwiftPM, CocoaPods或者Carthage的方式安装Realm,那么这篇我将介绍如何手动导入;我以最新的5.X系列版本为例说明;
-
Be careful with Obj-C bridging in Swift
原文链接:https://swiftrocks.com/be-careful-with-objc-bridging-in-swift 版权归原作者所有,The copyright belongs to the original; 翻译仅供个人学习,Translation is for personal study only;
-
Optionals in Swift Objective-C Interoperability
原文链接:https://fabiancanas.com/blog/2020/1/9/swift-undefined-behavior.html 版权归原作者所有,The copyright belongs to the original; 翻译仅供个人学习,Translation is for personal study only;
-
SwiftUI数据流之StateObject& ObservedObject探讨
在WWDC2020,SwiftUI再一次进行了重大更新,特别针对引用类型的数据流状态管理,在原有的@ObservedObject基础上,新增了@StateObject这个新的property wrapper,那么两者之间有什么区别?为什么要新增?本篇将通过大量的代码示例,带你进行详细的测试和分析;然后进一步探索@StateObject的内部实现原理,总结各自的使用场景,最后使得读者能够在项目实践中合理使用。
-
iOS14 Widget小组件开发问题记录
本文记录一些开发Widget小组件中遇到的问题和解决方法。
subscribe via RSS