Hi,I have an Xcode project with multiple targets. I added a few custom frameworks to all the targets which increase the IPA file size. Actually, a few targets don't need to have these custom framework.I know we can exclude these frameworks by removing them from "Build Phases->Link Binaries With Libraries" for the particular target, but I am exploring to see whether these can be achieved by having a script so that we don't have to remove/add them manually whenever required.I have a custom plist file for each target which tells whether these frameworks are needed. Is there any command available to remove/strip the framework from the target while building the app so that I can write a script by referring the plist value.
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
I developed a framework in Swift and designed a screen/view via SwiftUI.
SwiftUI view will be presented on top of the Window by the class written in Swift.
Now I need to pass the data from the Swift class to SwiftUI.
Could one any help to know the best practice to pass the data to show the progress from Swift class to Swift UI.
func A () {}
func B () {
// score will get updated frequently
score = ....
ScorePresenter().presentScoreUI()
}
}
import SwiftUI
struct ScorePresenter: {
func presentScoreUI() {
let hostController = UIHostingController(rootView: ScoreUI())
hostController = .overCurrentContext
topViewController()!.present(hostController, animated: true, completion: nil)
}
}
struct ScoreUI: View {
var score = 1
Text(score).foregroundColor(.green)
}
When ever score changes in Score class ScoreUI must be updated accordingly.
I have a class written in Swift that will present the view developed using SwiftUI.
SwiftUI is dependent on the enum used in Swift class to render the UI.
Is there a way to bind that enum in Swift UI so that SwiftUI will update automatically when ever there is a change to the enum in Swift class
Is there a way to mock the CBPeripheral? I need to stub the CBPeripheral(name & identifier) data in Xcode.
I have a framework written in Objective-C. My framework is in Swift and imported the 3rd party Objective-C framework in my project.
@interface AAAA: NSObject(void)setHandler:(idHandler)handler
@end
I wanted to implement the Handler protocol in my Swift project.
I did like this
Class ZXY: NSObject, Handler{
init(){
super.init
AAAA.setHandler(self)
}
// Implemented Handler Protocol optional methods
func aaaa(){
}
}
Handler protocol optional method aaaa never called. Am I missing anything
I need to get content-length from response header but it seems that content-length header is missing due to chunked Transfer Encoding. Is there anyway to get the content-length for Transfer-Encoding type
class a {
b().download ({ data in
})
}
class b{
func download (downloadedData: @escaping (_ data: Data? ) -> Void ) {
c().download()
}
}
class c {
func download () -> Data {
let semaphore = DispatchSemaphore(value: 0)
NetworkManager().downloadRequest: { (result: Result<Data, Error>) in
switch result {
case .success(let success)
......
case .failure(let error):
.....
}
semaphore.signal()
}
)
semaphore.wait()
return data
}
}
Class a initiates the download and class c interacts with network manager to download the data. Class c issues semaphore wait as soon as it sends request to download the data and issues signal when download completes. Is there a way to issue signal from class a when download is in progress. Basically class a should be able to skip wait by issuing signal command
I am trying to localize Swift framework and added a file Localizable.Strings and that file is included in the target but the app that consumes this framework is showing the key not the actual string.
NSLocalizedString("string_key", comment: "Actual String")
I think issue is related to bundle.
Do I need to add bundle parameter to NSLocalizedString? If so what is the bundle parameter value? If bundle is not required then what must be the issue
I believe weak references are not required when using self inside the dispatch queues. Is there any other occasions where weak self is not required related to closure?
I wanted to move a few .swift files from the framework to different container. I tried creating framework/static-library/SPM to move a few files from the framework but getting compilation errors for the new framework and old framework due to dependancy. I don't want ondemand resource and wanted to keep it local. So I looking for some container to move a few files from framework and load/import them back. I tried moving those files to Settings.bundle but unable to load/import them in the framework? Is there any other way to achieve this?
Is there a way to identify whether UIView hides/overlaps another UIView by checking points/pixels?
Is there any tutorial to learn Swift by comparing Objective-C. Tutorial should contain both Objective-C and Swift code.
I have an Xcode project that generates xyz.framework and that framework is used by other teams for their app. Updating the framework is a manual process. So I am planning to covert my xyz.framwork source to swift package manager. I couldn't find any such articles. Please let me know if there is any resource around this topic.
I am getting an error message (mixed language) while adding the Swift package dependency. Source code mostly contains Swift language and a little bit of Objective-C. Can't we mix Swift and Objective-C language? If so, what is the workaround
I know that using using JSONDecoder we can convert the downloaded JSON data into class/struct object.
Is there a way to do the same for raw data(NSData)/octect.
Since downloaded is not a json, I am getting error.
I have class like this
public struct FileData: Codable{
public var data: Data?
public init (data: Data? = nil){
self.data = data
}
}
Is there a way to assign the downloaded data to FileData().data via decoding