Post not yet marked as solved
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?
Post not yet marked as solved
I wanted to separate a few file from the framework. Let's say I have Class A,B,C,D,E,F,G. I wanted to move Class D and E out of the framework and keep it separate. Creating a new static/dynamic framework/SPM/Target is giving compilation error as Class D and E dependent on other classes. Is there a way to separate Class D and E by putting them in a separate container and import them in the framework?
Post not yet marked as solved
Xcode is not responding when opening a workspace. I deleted the cache, derived data, saved application state and xcuserdata. I tried with different Xcode version too.
Any help is much appreciated.
Post not yet marked as solved
My client is using Xcode 11 but the iOS framework imported in the project is available only in Xcode 13. Client is getting "framework not found" in Xcode 11 . Is there a way to make my project compatible with older Xcode Version?
Post not yet marked as solved
I linked a framework as optional/weak and it's working fine in the latest Xcode but in the older Xcode version compilation is failing due to "framework not found". Is there a way to fix the compilation error in the older Xcode version?
Post not yet marked as solved
What is the best way to print in the order for the given implementation
(void) print:(NSString*) str
while(true)
{
NSLog(@“%@”, str);
}
}
[self print:@“123”];
[self print:@“ABC”];
[self print:@“456”];
[self print:@“DEF”];
output should be printing in the order continuously
123
ABC
456
DEF
123
ABC
456
DEF
…
…
…
Post not yet marked as solved
How to make one task(insert) wait for another to task(remove) in Objective C?
Post not yet marked as solved
I have declared an NSMutableArray and the count should not exceed 100. If some one calls addObject method to add an item to that array when the count is 100 then that method call should not be executed until someone removes an item so that count will go down below 100. Can we use semaphore or group dispatch for signaling or mutex/NSLock is recommended.
Post not yet marked as solved
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?
Post not yet marked as solved
Is there a way to mock the CBPeripheral? I need to stub the CBPeripheral(name & identifier) data in Xcode.
Post not yet marked as solved
I wrote a few unit test cases using XCTest by mocking the data? Is there any best practice to have multiple test profiles with different data sets? Sometime mock should return nil, sometimes an array with 2 elements and sometimes an array with 10 elements. How to have multiple test profiles?
Post not yet marked as solved
func displayUI () {
let hostingController = UIHostingController(rootView: ContentView(ViewModel: contentViewModal).environmentObject(self))
}
Above code works fine.
I attempted to make the hostingController as instance variable instead of local variable and declared the hostingController outside of display function like this
lazy var hostingController: UIHostingController = UIHostingController(rootView: ContentView())
and so I removed let keyword
func displayUI () {
hostingController = UIHostingController(rootView: ContentView(ViewModel: contentViewModal).environmentObject(self))
}
Once I remove the let keyword I started getting this error.
Cannot convert value of type 'some View' to specified type ‘ContentView'
Any idea why I am getting this error after removing let keyword declared before hostingController variable?
Post not yet marked as solved
class A {
func processData {
let viewModel: ViewModal = ViewModal()
let viewController = ViewController()
viewController.displayUI(viewModel)
....
....
....
....
viewModel.imageName = "abcd"
....
....
....
....
viewModel.imageName = "efg"
....
....
....
....
viewModel.imageName = "hij"
}
}
class ViewController {
func displayUI (viewModal: ViewModal){
let contentView = ContentView(viewModal: viewModal).environmentObject(self)
// present contentView
}
}
class ViewModal {
@Published var imageName: String = ""
@Published var label: String = ""
// string formatting
}
struct ContentView: View {
@State var viewModel: ViewModal
@EnvironmentObject var viewController: ViewController
var body: some View {
}
}
Can class A directly access ViewModal or it should pass the data to ViewController and ViewController set the data in ViewModal
Post not yet marked as solved
I am using "Excluded Source File Names" in Xcode build settings to remove a folder from IPA. The given relative path is correct but for some reason, the folder that needs to be excluded is still exists in the .app file. Any idea why Excluded Source File Names is not working. The folder that I am trying to remove is listed under "Copy Bundle Resources"
Here is the path "$(SRCROOT)/../foldera/folderb/foldertoberemoved"
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