Objective-c

This tag should be used only on questions that are about Objective-C features or depend on code in the language

Swift

Swift is a safe, fast, and expressive general-purpose programming language developed by Apple Inc



Familiar class easier

Example

"Im new to swift but i like it more than objective-c as it looks a bit like java does to me from syntax wise compared to objective-c"

from question  

AVPlayer does not play Video, play Button with Line through

"We ve seen that swift uses a more static method dispatch than objective-c which unless a class dervices from foundation nsobject prevents the style of swizzling based on remapping method implementations at runtime"

from question  

Swift isa pointer remapping or other supported method swizzling

"If you re like me and needed the searchcontroller to remain active while presenting modally another controller then do the following to get the same effect of presenting modally without doing so directly quick note not familiar enough with objective-c to give an answer in that but here s an answer in swift 4"

from question  

IOS UISearchController crash: Application tried to present modal view controller on itself

"In objective-c something similar can be done with nsarray s various predicate-based and enumeration methods but they ll be a little more long-winded than they swift counterpart"

from question  

Filter [NSWorkspace runningApplications] to contain only user applications (no daemons/UIAgents)

"As you can see defining a singleton class in swift is much easier than in objective-c"

from question  

Unable to create Singleton

"Download xcode free and learn objective-c or swift swift is easier to learn than objective-c"

from question  

How do I write an application for Mac OSX from scratch?

"On the other hand swift is easier to learn especially if you have objective-c background so it can be adopted during the time slowly and paralelly with using objective-c"

from question  

Learn Objective-C or Swift

"Early this month i started learning swift as i found it fun and easier than objective-c"

from question  

Swift 3: Populating plist data to UITableView

"Objective-c is much more free and easy with types and compilation checks where swift isn t"

from question  

Overriding UITextField delegate methods

"Note that swift s arrays are much more sensible than objective-c s"

from question  

Commonly used array option in Objective-C

"I am an ios developer and am therefore familiar with swift and objective-c so i was wondering if there was a way to do the same thing using them"

from question  

How to train an intelligent chatbot using a database to then add to an iOS app

"Since i m not very familiar with swift here s some objective-c sample code load html string get uiviewprintformatter and print"

from question  

Using custom font to generate PDF from HTML on iOS 11

"In case the method s helpful since you seem perhaps more familiar with objective-c than swift here s what your swift method would look like if we translated the method back into objective-c"

from question  

Return type of UIImage in Swift

"This article seems to suggest that this is possible by swizzling a fake location into apple s cllocationmanager class to be used by other apps but i am unfamiliar with the objective-c code more familiar with swift"

from question  

How can I set a fake location on iOS to be used by all apps?

"I m learning swift and much less familiar with objective-c but for the life of me i can t figure out how they are trying to achieve the goal stated as build list of encodings sorted and including only those with human readable names."

from question  

Logically ANDing NSUInteger and String Type?

"Unlike objective-c which is a proper superset of c swift has been built as an entirely new language;swift cannot compile c code because the syntax is not compatible"

from question  

Does swift support C natively?

"However i read that swift was the successor of objective-c and i would feel more comfortable with swift syntax"

from question  

Can swift code be used in Codename One native code instead of Objective-C

"Swift also prevents us i believe from overriding a parent class s property but also still lets us observe changes to that property--this is much better than objective-c s approach"

from question  

How can I override a setter from a SuperClass in Swift with Xcode 6.3 Beta2?

"Then the buffers won t need to be treated as arrays of pointers and passing arrays of say floats between objective-c ++ and swift is easier"

from question  

Can't pass [[Float]] array into Objective-C++

"Note that swift does have a full implementation of generics;objective-c does not have generics so nsarray and nsmutablearray are not strongly typed in the way you desire"

from question  

Mutable List of instances of one specific class

"Usually i find swift s method naming to be cleaner than objective-c s but init methods can be an exception"

from question  

TimeIntervalSinceReferenceDate vs timeIntervalSince1970 vs timeIntervalSinceNow

"You can use a similar approach as in swift blocks not working annotate the block with convention block;to use the objective-c block calling convention and explicitly cast"

from question  

How to call an objective-c function which accepts Dictionary of blocks as argument from Swift?

"See also get a user-readable version of the class name in swift in objective-c nsstringfromclass was fine;swift does not have the introspection capabilities yet as objective-c does"

from question  

EXC_BAD_INSTRUCTION runtime error

"Swift is lot smarter than objective-c about singleton class"

from question  

How to Implement Singleton class in Swift

"Rather than start from scratch with a whole new implementation it seems there s a way to extend kinwebbrowser but i m not totally familiar with swift syntax yet or objective-c and it seems that kinwebbrowser is written in objective-c"

from question  

Trying to get information back from Javascript in WKWebView (using KINWebBrowser)

"The idiom is for objective-c not swift;in swift init blocks aren t normal functions and don t return anything"

from question  

Overriding CALayer's initWithLayer in Swift

"First note when you mentioned -ofast that s for objective-c not swift;the flag for swift is just -o"

from question  

First steps in Swift, performance issue when allocating small objects in a BST

"As ekscrypto in swift 4 or later all functions need objective-c if you use less versión than swift 4 is enoguh objective-c in class"

from question  

Swift 3 method in objective-c fails with no visible @interface for 'MySwiftClass' declares the selector 'addX:andY'

Dictionary nsdictionary objective-c

Example

"Objective-c cannot see a swift enum at all;in swift an enum is an object type"

from question  

Using Swift Class and Enum from Objective-C

"In swift it will crash when you try to use an object before it is initialized;objective-c is a little more forgiving and will just do nothing if you tell it to use a nil object at least in the instances you are using"

from question  

Subviews for a UIViewController are not showing

"This is because the swift dictionary is more strongly typed than the objective-c nsdictionary"

from question  

Type Error in closure (translated code from obj c to swift)

"First of all a dictionary in swift is struct an nsdictionary is class;objective-c is not type-safe so it doesn t show an error"

from question  

How to pass a Dictionary to Objective-C method in Swift

Possible application better

Example

"In swift it gets better with nicer block syntax better type inference and auto-closures;objective-c is not known for it s pretty or terse syntax"

from question  

Objective-C equivilent lambda expressions

"2 swift size 17 6mb;there is still a big difference if you ask me so i think for small projects objective-c is more suitable"

from question  

Comparison between an empty project archive written in Swift versus Objective-C

"Swift in that case would not be safer but less safe than objective-c"

from question  

How to make a Cocoa binding to a property of optional type in Swift 3?

"Executable size of swift application is much bigger than size of objective-c application"

from question  

Xcode Swift executable size much bigger than Objective-C executable

"If it is possible swift would be better than objective-c"

from question  

Can I get the approximated travel time from directions I already have on a mapView?

"I find that objective-c is much nicer for working with core audio than swift"

from question  

How to obtain audio chunks for analysis in core audio or AVFoundation

"Specifically it makes it possible to write objective-c code that plays nicely with swift which is more strongly typed than objective-c"

from question  

Difference Between __kindof and not Using it in Objective-C

"Swift is neither easier to read nor understand than objective-c"

from question  

Swift optimization not working?

"However swift is much safer in that regard;note that in objective-c still accesses self"

from question  

Swift - self in deinit method

"Injecting code in a swift application is harder than it was for an objective-c application but it s still possible"

from question  

Is Swift vulnerable to code injection?

"So i ve started learning swift because it looks way better than objective-c"

from question  

Swift protocol method usage

"better if you have a code swift is better but is not problem objective-c"

from question  

XCode - Add SSL Certificate to iOs Profile (Programmatically)

"If you get a difference between swift and objective-c it s more because swift is probably better on optimisation"

from question  

ViewDidLoad not called when initialising obj viewcontroller from Swift

"Note that with swift this is no longer possible and will result in a compiler error instead;objective-c is not as type-safe as other languages and does not care whether the delegate explicitly declares conformance using"

from question  

TextFieldShouldReturn called without the UITextFieldDelegate

"I have a objective-c application working fine and smooth to be more comfortable with swift i decided to write the unit tests for this app in swift"

from question  

Convert NSArray of Custom objects to Swift array

Faster slower things

Example

"Still technically yes the library we re appears that an all swift solution is roughly 2x slower than a swift + cocoa solution which should be roughly the same than objective-c + cocoa when compiled with equivalent options iirc"

from question  

Same algorithm running much faster in Objective-C than Swift (with optimization)

"I m confused because many people says that swift is faster than objective-c in general"

from question  

The processing speed between swift and objective-c in Metal

"It is possible for swift to be faster than pure objective-c in things that you would traditionally use c or c++ for anyway"

from question  

Swift optimization not working?

"And also apple does might not confidently announce that swift is more faster than objective-c in all the cases"

from question  

Performance of Swift vs Objective-C

"Swift s compiler is also doing a lot more than objective-c s compiler considering swift is more strongly typed and does not required specifying imports among other things"

from question  

Xcode 6.1.1 Run on device slow "Copying Swift standard libraries"

"I don t think that as of today you can run these tests and determine with any certainty whether swift 1.0 is faster or slower than objective-c"

from question  

Performance of Swift vs Objective-C

"Wouldn t swift be slower than objective-c in this case since it is layered on top of it"

from question  

What is Swift doing behind the scenes when I add a target to a UIButton?

"My view is that if in some cases objective-c is faster than swift it doesn t mean that all over performance of swift is slower"

from question  

Performance of Swift vs Objective-C

"The perf hit will be ridiculous i know apple say swift execute faster than objective-c but this is low level so it will be harmless"

from question  

Language of choice for CoreAudio

"Most importantly for your image processing app the compiler will optimize swift code to run faster than objective-c"

from question  

Comparison between Swift and Objective C in Image Processing

"As craig revealed within the announcement of swift it is said to be faster than objective-c by far"

from question  

Whats the cause, Swift is supposed to be that much faster than Objective-C?

"Bottom line i would personally hesitate to draw any simple conclusions of swift is faster than objective-c or vice versa;i suspect that there are some algorithms applications where swift is faster and others where it is not"

from question  

Swift vs Objective-C Fibonacci Sequence Speed Comparison

"The swift one is dramatically slower then objective-c implementation"

from question  

Slow Swift Arrays and Strings performance

"The swift compiler is doing a lot more and is quite a bit newer than the objective-c compiler so it unlikely it will be as stable fast for quite some time"

from question  

What is wrong with syntax highlighter and autocompletion in Xcode with Swift

"Btw objective-c nsarray performance stinks;if you re going to use the native container objects in both languages swift is dramatically faster"

from question  

Swift Beta performance: sorting arrays

"I ve come to swift from objective-c and there s a lot of things that objective-c can do but swift is much more complicated"

from question  

Dynamic subclass instantiation in swift

"There are multiple reasons why the swift code is slower than the objective-c code"

from question  

Slow Swift Arrays and Strings performance

"I m not all that great with objective-c and worse with swift but i ve been using an updated equivalent for a while in one of my rubymotion projects"

from question  

How to wait for completion of sheet after invoking beginSheet:completionHandler:

Objects existence several

Example

"So while cf types are not classes objects they act like objects and several are actually interchangeable with objective-c and swift objects"

from question  

Does CFMutableBitVectorRef need to be explicitly released?

"No objects come magically into existence in swift any more than in objective-c"

from question  

Objective -C vs. Swift Custom Initializers

Applications professional work

Example

"As objective-c is the older programming language for ios or macos applications swift allows you to use those classes structs in your code"

from question  

Swift 3: Date vs NSDate?

"Writing swift 2.0 in my professional work my personal opinion is that beta s indeed ready for enterprise applications -- maybe even more than objective-c ever were"

from question  

IOS development with Swift for enterprise applications

Better hint tool

Example

"If you want to do your app in swift which is better to understand if you have already programmed in java in my opinion use swift;if you want to do your app in objective-c well."

from question  

IOS In App Purchases: Objective-C vs. Swift

"It seems to me that swift would be way simpler to learn then objective-c for beginners i know because i learned it in like 2 months and swift is less complicated and better laid out then objective-c"

from question  

Why does Apple use Obj-C for their internal code rather than Swift

"Swift doesn t support objective-c s dynamicism;for better or for worse this means that in order to swap out the usage of this selector with a block you d probably need to perform some black magic to make it work and you d have to use objective-c constructs to do that"

from question  

Swift programmatically create function for button with a closure

"Stick with objective-c for now;when you re comfortable with the ios sdk and swift is better documented you can consider learning swift"

from question  

Should I learn Swift or Objective C for iOS

"Or is it merely a hint to whatever tool converts between swift and objective-c to better deal with swift optionals"

from question  

Are _Nullable and _Nonnull useful for anything other than Swift interop?

Version available selection

Example

"What i found is this library have swift version however range selection version is only available with objective-c"

from question  

How to Select Range - FSCalendar in Swift?

"While direct equivalent is not available with swift this can be achieved relatively elegantly with objective-c and categories"

from question  

Swift - Objective-C load class method?

" swift 2.0 version;the objective-c version is a little more efficient as the objective-c version does mutable operations on the string"

from question  

Encode NSString for XML/HTML

Readable print

Example

"Objective-c print is more readable compared to swift"

from question  

Printing a dictionary in Swift different from Objective-C. How to fix this?

"With swift the code is much more readable than with objective-c"

from question  

Better JSON parsing implementation in Objective-c and best practices?

Type-constrained extensions objecttype

Example

"You need the latter for tasks like defining type-constrained extensions but you can t because swift doesn t know anything about the objecttype of any particular phfetchresult instance;the swift-evolution proposal that brought widespread objective-c generics import to swift 3 included a provision for letting objective-c classes provide information about their generic type parameters at runtime."

from question  

PHFetchResult extension that uses it's Generic ObjectType?

"In short objective-c generics are type-erasing swift generics are type-preserving;you need the latter for tasks like defining type-constrained extensions but you can t because swift doesn t know anything about the objecttype of any particular phfetchresult instance"

from question  

PHFetchResult extension that uses it's Generic ObjectType?

Dynamic better ways

Example

"Also i m looking forward if there any better ways to do orm in swift currently the code does working with dynamic object creation but when comes with orm relation it really drove me nuts here just looking for ways to manage it in a easier and more manageable ways where currently it looks like there are not much functionalities to do meta programming a lot of other orm libs still using objective-c which is much more easier but boilerplate on dynamic instance creation or class inspection"

from question  

Swift protocol generics error(ORM implementation)

"I feel swift is better than objective-c in many aspects but my major question is - will swift dynamic libraries support older version of swift"

from question  

Are Swift dynamic libraries backward compatible with older swift version projects

Use

Example

"I use objective-c more than swift"

from question  

Swift 2 - Check if an array contains a value from another smaller array

"Also note that i use objective-c more than swift"

from question  

How to use a variable to construct command

Reflection direction metaprogramming

Example

"Swift currently doesn t do much in the direction of reflection and metaprogramming;you ll have to resolve to using objective-c to do this"

from question  

Get NSClassFromString from Array of Strings - Swift

"But swift is less dynamically typed than objective-c and has less support for reflection"

from question  

Swift iOS take in a input and use it for function name

Versions ports considerable

Example

"Swift is clearer on versions releases and i keep asking myself if i am missing something related to objective-c since i can t find this information"

from question  

How does Objective-C get updated? Are there versioned releases? What is the current 'version'?

"There are many versions out there also swift ports but those are considerable slower than the objective-c versions"

from question  

How to blur an existing image in a UIImageView with Swift?

Stricter type compile-time

Example

"Swift is stricter about runtime type correctness than objective-c so duck typing alone is not enough"

from question  

Swift convenience initializer extension for SKPhysicsBody

"You may want to look into swift which is much stricter about compile-time type safety than objective-c and is largely compatible with existing objective-c code on apple platforms"

from question  

Objective C typed Class pointer

Class equivalent cellclass

Example

"His works great in objective-c because the catchall type id has very lax type checking;but the equivalent any class in swift is much more stringent and does not lend the equivalent any class in swift to the same technique if at all"

from question  

Invocation-based Undo Manager in Swift

"The cellclass parameter in objective-c is simply class with the swift equivalent being anyclass;unlike in swift objective-c doesn t support declaring that the value of class anyclass be any specific type"

from question  

Is there any reason Apple decided to use AnyClass rather than using UITableViewCell.Type?

Methods big casts

Example

"A big reason you need casts right now in swift is because some objective-c methods return id which was no problem in objective-c but causes trouble in swift;i expect this to diminish as swift becomes more popular and frameworks are adapted"

from question  

Swift: why do I need optionals anyways?

"However note that optional methods do not exist in pure swift they are there only because objective-c have them so there is no big reason for swift to have special grammar for optional methods;also note that even objective-c doesn t have a special grammar for checking of existence of optional methods"

from question  

Swift: Disambiguating between methods as curried functions of a type (< Swift 2.2 only)

Others

Example

As mentioned by others the whole point is that objective-c provides base class for all classes while swift does not;nsobject in objective-c provides alloc and init methods hence one can expect that a descendant from nsobject will either implement or inherit those methods hence you can have the shortcut-category you mentioned in your question

from question  

Create objects dynamically in Swift

You can use only enums witch can be represented in objective-c enums without nested enums enums without parameters enums raw types should be integer therefore you can only create another enum witch can be represented in objective-c and just add method to convert to it and create somewhere swift method to another side

from question  

How to make a Swift enum available in Objective-C?

Swift is not much friendly with macros;complex macros are used in c and objective-c but have no counterpart

from question  

Making RGB color in Xcode

Create a swift file in your objective-c based project;no need to create bridging headers since they re used to see objective-c code from swift not swift code from objective-c

from question  

I've tried it all, but I can't import my Swift file to my Objective-C file

The specific swift file showing the code required to interact with an nscollectionview is imagelistcontroller.swift;if you want to learn more about the new nscollectionview there s a whole wwdc session and the video is available from apple but the presenter uses objective-c not swift

from question  

How to create NSCollectionView using swift for os x

While i think the move to swift is prudent but i think it overstates the case to argue that swift is significantly more secure that objective-c

from question  

Are there security concerns I should keep in mind when converting my app from Obj-C to Swift?

Swift doesn t allow protocols to have optional requirements-- if the protocol declares something it s required;objective-c has long had the idea of optional requirements and swift recognizes this when you use objective-c when declaring the protocol

from question  

Optional can only be applied to members of an @objc protocol

As you can see the swift example is more complex and error prone than your objective-c code

from question  

Dynamically create objects and set attributes in swift

Personally i prefer objective-c because you can use c very easily as anything that is legal in c is also legal in objective-c added to which swift is a more procedural in style where objective-c is quite clearly object orientated

from question  

Can Swift do everything that Objective-C can do?

Swift won t allow you to do absolutely everything that objective-c does but it will allow you to do almost everything and the code will be probably more robust considering that swift is more modern language with stronger typing than objective-c

from question  

IOS 9, Swift 2.0 , Xcode and testing

I also use objective-c more than swift but here s what my guess is as to what the objective-c code would come to

from question  

Passing data between interfacecontrollers not working in apple watch

Because it requires passing of c callback function and swift does not support it currently xcode 6.1.1;then i had to fallback to objective-c and wrap it again

from question  

How to monitor a folder for new files in swift?

Swift does not make swift code accessible to objective-c by default to avoid making its code larger than swift needs to be

from question  

* (no title is found for this review)

Those attributes let you create objective-c code which is more understandable by swift and complier warn you when you break the rule for example

from question  

What do the null-related property attributes in Xcode do?

Apple seems to claim that the optional type in swift is safer than nil in objective-c but i don t understand why this is so

from question  

What makes Swift's "Optional" safer than Objective-C's "nil"?

The swift runtime is smaller than the objective-c runtime

from question  

How are method calls implemented in the runtime?

No a class must be defined in swift or in objective-c not mixed language inside single class file sorry;as you may have already noticed a class in swift is generally made by a single file with .swift extension while objective-c class is defined using two files .h and .m

from question  

Can we use swift with objective-c in same class

Swift does not use a preprocessor so pragma flags and macros are not an option;it is still possible though to provide similar functionality to the nlog and fixme macros used with objective-c by making use of the benign warning treating a forced downcast as optional will never produce nil

from question  

How can I create bookmarks for temporary logging and FIXME markers in Xcode 6 for both Objective-C and Swift?

First swift does not use the platform s calling convention;on macos c c++ and objective-c all use the x86_64 system v abi but swift doesn t

from question  

What copy-elision does swift actually do for structs?

That s because swift knows what a protocol extension is;but objective-c doesn t

from question  

Swift 2 Protocol Extensions and Conformance for Objective-C Types

I suggest you learn a little bit of the objective-c messaging syntax since a lot of ios code is still in objective-c but don t worry a huge amount about it;swift is a better language

from question  

What is the proper syntax for Google Analytics Exception tracking in Swift?

You can bridge variadic functions in c to swift but not the other direction;see using swift with cocoa and objective-c interacting with c apis variadic functions for more on that

from question  

Expose swift variadic parameter to Objective-C

Objective-c -documentary provides more content than the documentary for swift

from question  

How to create a foldable NSLog-Output using Swift?

So it should have always been gkagent under objective-c in order to be strictly correct however objective-c is less type-safe than swift so you could get away with it with the possibility that you d get an unrecognized selector exception if a gkagent object was ever passed to the delegate method and you assumed it was a gkagent2d

from question  

The protocol method of GKAgentDelegate is not right in Swift?

The swift designers went through a lot of trouble to make sure that it s more than just objective-c without the constraints of c in fact i almost wish the swift designers hadn t said that since it s so often misquoted

from question  

Can you use Swift as a web programming language?

That s because objective-c is far less strict and is willing to do some implicit casting on primitives;with that said swift has a handful of types that are more equivalent to c c++ and objective-c s int and the other sizes of integers

from question  

C++ and Swift: Cannot invoke 'externalMethodName' with an argument list of '(Int)'

Swift seems to be less dynamic than objective-c in these stuffs

from question  

Swift's equatable protocol conformance check

Equatable is a swift protocol not available in objective-c which requires that there is a operator defined for the type;in objective-c there is no operator overloading

from question  

Why does the following protocol have this required function?

I am using swift 5 and not so good with objective-c so swift code suggestions would be fantastic

from question  

Understanding the flow of adding facebook login to iOS app

After reading some related articles i don t think swift is more effective than objective-c

from question  

If Swift will replace Objective-C in the future

However when i switch to swift 4.0 the methods declared in swift is no longer visible in objective-c

from question  

Swift method not visible in objective C

As to where you do this it s the same as objective-c;swift makes it easier as it does not require you to import header files so you can either put it in the file of the client the class that uses it or in it s own file

from question  

How to create delegates in Swift?

One of the main differences between swift and objective-c is the type system and behaviour with nil;in objective-c it is more or less safe to use nil it may lead to unexpected behaviour but does not crash

from question  

UICollectionView Items not being reused properly (Swift 2.0+)

On a personal note i have to say calling core audio api from swift is oftentimes more pain than gain;because of that it might be faster although a bit unsafer wrapping those portions of code into objective-c or plain c and exposing them via the swift bridging header if your project allows the swift bridging header

from question  

List all available audio devices

You can work around the issue by wrapping your c++ code with objective-c and using the objective c wrapper in swift;swift is not directly compatible with c++

from question  

Can I mix Swift with C++? Like the Objective-C .mm files

You can check it in this answer in my scenario i am checking the error code if it is -999 then i just return from a function like following note unlike nserror of objective-c code property is not available with swift error

from question  

NSURLErrorDomain error -999 using UIWebView

Adding lightweight generics to your objective-c api makes it easier to interface with swift because your api gets translated more precisely

from question  

What type of class definition is this: ClassName<Variable> : parent

One of the reasons we want to move is because swift is more secure than objective-c

from question  

Are there security concerns I should keep in mind when converting my app from Obj-C to Swift?

I m not too savvy with objective-c but would like to use it for this cordova plugin instead of requiring another plugin to bridge swift files

from question  

@autoreleasepool when extending NSData?

There are plenty of patterns where a naive translation of objective-c code will result in slower swift implementations;in particular far more dramatic than your example where the swift code was a little slower i ve been startled by simple situations in which it s quite easy to write a routine in swift that looks logically very similar or even more elegant but is really much much slower or at least prior to the app developer refactoring the swift implementation a bit;bottom line i would personally hesitate to draw any simple conclusions of swift is faster than objective-c or vice versa

from question  

Swift vs Objective-C Fibonacci Sequence Speed Comparison

I m not too experienced in swift i am objective-c but from time to time i need too mess with swift as well

from question  

Is it a good practice to make an inner (nested) class in swift?

Therefore the usage of nstimer is not more swifty but the need for late binding is more obfuscated to make swift developers feel better;if i wanted to use objective-c i d not be writing swift.

from question  

Swift - scheduledTimerWithTimeInterval - NSInvocation

Furthermore swift is stricter than objective-c when it comes to initialisers

from question  

Initializers construction in Swift

Swift on linux is not interoperable with objective-c it is interoperable with c

from question  

Swift Objective-C interoperability on Linux, error: 'Foundation/Foundation.h' file not found

Swift will incur this penalty in fewer situations than objective-c will for instance method calls to swift-only protocol methods do not hit objc_msgsend but if the protocol is declared in objective-c or if the swift protocol is decorated with objective-c such that the swift protocol can be adopted by objective-c objects as well then method calls to methods in that protocol adopted by swift objects appear to be dispatched via objc_msgsend

from question  

Whats the cause, Swift is supposed to be that much faster than Objective-C?

I m not familiar with objective-c following is my swift definition http status enum in swift 4 based on httpstatusenum.strings

from question  

Are the HTTP status codes defined anywhere in the iOS SDK?

Swift is more strictly typed than objective-c

from question  

Swift - extract data from dictionary

Perhaps you could consider a more literal swift conversion using private stored property which is handled by a computed property;note this is not thread safe but your objective-c rendition isn t either but it accomplishes what you asked for

from question  

Self reference swift closure

Actually there is no difference at runtime between these two languages at delegate but swift is more easy to learn

from question  

How does AppDelegate.swift replace AppDelegate.h and AppDelegate.m in Xcode 6.3

Working with raw bytes in objective-c is generally a little more straightforward than swift

from question  

SHA256 Swift to Objective C equivalence

Create swift framework geolens.swift when i am trying to access in objective-c project cannot call 2 methods createuser startsessionforuser getting error like this method cannot be marked objective-c because the type of the parameter cannot be represented in objective-c

from question  

Cannot access Swift Framework in Objective-C

In objective-c looking for class and #import file.h might have been easier than in swift where the imports are implicit

from question  

Is it possible to install only components of Material that we use?

If i m correct the next lines read like put the outcome of in a new array named nameofarray if you know swift and not objective-c you may be thinking that arrays are value types so an assignment from one array into a var creates a new array;however in objective-c arrays are reference types and assignment of an value doesn t create a new array it just copies a reference to an existing array

from question  

How to convert this obj-c code to swift (NSArray with NSDictionary)

You will notice that swift bundles are always about 4-5 mb larger than their objective-c counterparts and this is precisely why

from question  

Will Swift 2 apps works after Swift 3 released?

Minimum deployment target for xcode 9 is 8.0 not 7.0 with coding there is no problem but xcode 9 storyboard add safearea for running layout properly in iphone x also i don t think there is users now running ios 7 regarding swift or objective-c you can accomplish anything with any of users now running ios 7 regarding swift or objective-c but swift is much easier all tutorial now written in swift for new features every wwdc

from question  

Disadvantages of Xcode7.3 with deployment target 7.0 Objective-C

#available and friends in swift are a simplification of and improvement on the more complex ways of dealing with new features and backward compatibility in objective-c;if you re using objective-c there isn t a direct equivalent to #available so you have to fall back to those old ways

from question  

Cocoa build for os x 10.11 with NSTouchbar support

Swift generics do not get included with this as they are not compatible with objective-c

from question  

Can not add class with generic type to swift realm

I know that swift is buggy as heck i run into bugs everyday but ill bet objective-c was even worse when it started out benefits of hindsight so in a couple of years swift will be equal or greater than objective-c keeping its basic simplicity as well

from question  

Why does Apple use Obj-C for their internal code rather than Swift

Can someone explain what someone explain what objective-c can support that swift fundamentally cannot when developing apps;what i used to take advantage of in objective-c was not so much dynamic typing as dynamic messaging

from question  

What effect does Swift's lack of dynamic capabilities have when developing?

Regarding your reply remember swift isn t fully baked yet and there may be many more apis available to us in future releases such as a unique set api reflection etc;this should not deter you from learning swift as well as objective-c so don t give up

from question  

Create unique-member collections in Swift

Back to Home
Data comes from Stack Exchange with CC-BY-SA-4.0