This question already has answers here:
Using a dispatch_once singleton model in Swift
(30 answers)
Why does the suggested Swift singleton implementation use a struct?
(2 answers)
Closed 6 years ago.
When I update the Xcode to 7.3,something strange happens.
How can I fix it ?
It is much simpler in swift, just do this:
static let sharedMenu = KxMenu()
Related
This question already has answers here:
How do I call Objective-C code from Swift?
(17 answers)
Closed 4 years ago.
I am working on an application which is built in objective C.
I have to implement UIActivityController which is easy to implement using swift in any application but since I am not familiar with Objective- C even by a %, can I use swift code to implement the UIActivityController in a button?
If so, how?
Yes you can create Swift file, with your Swift implementation in the Objective-C project.
You just have to add
#import "YourProjectName-Swift.h"
into the objc file where you wanna call the swift code and execute it.
More info in article here for example https://medium.com/ios-os-x-development/swift-and-objective-c-interoperability-2add8e6d6887
This question already has an answer here:
What is other option available in swift instead of refactoring and renaming class or attribute name?
(1 answer)
Closed 6 years ago.
I am working on swift project.After 1 month I need to refactor the code as we have done in objective c. I need to change some class names, properties and method names. But problem is that when I go to refactor the code but It showing me an error.
Error is "Xcode can only refactor C and Objective-C code."
Is there any way to refactor the code because there are 50+files to change the code.
Thanks in advance
Unfortunately, no. We're stuck with "Find>Find & Replace in Project".
This question already has answers here:
How to automatically convert Manual Retain-Release code to ARC?
(2 answers)
Closed 9 years ago.
I started an old project in an xcode that did not support ARC, how can I change my project into using ARC and how do I know what to remove from the project?
In Xcode, Edit => Refactor => Convert to Objective-C ARC... and follow the instructions.
This question already has an answer here:
NSString cString is Deprecated. What is the alternative?
(1 answer)
Closed 9 years ago.
I don't know where to turn to figure this out so I'm turning to you guys, the BEST! I'm new to objective c.
I get the deprecated warning with the following line of code. Any ideas on how to make this compatible with iOS 6?
const char *pUrl = [tStr cString];
Thanks so much!
As per the relevant documentation, this has been deprecated since iOS 2.
(Deprecated in iOS 2.0. Use cStringUsingEncoding: or UTF8String instead.)
As such, you need to either use the cStringUsingEncoding or UTF8String approaches instead.
This question already has answers here:
How do you enable ARC project-wide in Xcode 4.2
(3 answers)
How to automatically convert Manual Retain-Release code to ARC?
(2 answers)
Closed 9 years ago.
I have an project in nonARC mode. How to change it to ARC mode without create new project?
Is there any auto convert method, library or way?
I also want auto delete release,autorelease and change some text(retain -> strong,...)
This screen shot will help you
Read this DaveOnCode and Migrating your code to Objective-C ARC.