在类型中还要利用Objective-C和斯维·夫特(Sw·ift)语言

Why do the British not feel European?

苹果发表的斯维·夫特(Sw·ift)语言可以和事先的Objective-C语言同时存在于一个项目中。

英帝国人为何不认为温馨是亚洲人?

唯恐有人会觉得是同一个类公事中既可以有Objective-C也可以有斯维夫特,那是不对的。同一个类公事或同一个代码块中,不得以同时有这三个语言的代码,而是单独的斯威夫特类文件或Objective-C类文件之间能够相互调用。

赢得39.7k好评的作答 @斯图·亚特(Stuar·t) Aitken:

接下去就说说在Objective-C类中如何引用swift类和在斯维·夫特(Sw·ift)类中援引Objective-C类的具体步骤。

I spent a year living in an internationaldormitoryin China, with
students from all over the world. “Birds of a feather flock together”,
as they say. Of all the various categorisations that could be made based
on the way people formed their groups, the most obvious collections
were:

在Swift中使用Objective-C

我在炎黄住了一年留学生宿舍,那里有出自世界各地的学生。人们常说:“人以群分”,在各样小团体形成的归类方法中,最明显的分类是:

首先创立一个斯威·夫特(S·wift)的iOS项目:

Westerners – (European and American mainly)

语言 1

西方人(紧如若欧美人)

 

East Asians – (Thailand, Korea, Japan, Vietnam)

添加一个Objective-C的类公事,那么些类如下:

东亚人(泰国、韩国、日本、越南)

语言 2

South Asians – (India, Pakistan, Nepal, Bhutan)

语言 3 

东南亚人(印度、巴基斯坦、尼泊尔、不丹)

 

Middle-easterners/Arabic – (Iran, Yemen etc)

在添加Objective-C文书同时,Xcode会提醒:

中东/阿拉伯人(伊朗、也门等)

 语言 4

Slavic/Central Asian – (Russia, Ukraine, Kazakhstan etc)

点击Yes

斯拉内人/中亚人(俄联邦、乌克兰(Crane)、哈萨克斯坦等)

 

People really do gravitate into groups based on ethnic and cultural
identity. At that time, I knew more than ever that I was a European. The
way I as a Brit acted, thought was entirely in tune with the Europeans I
spent time with.

在ViewController.m中使用刚刚添加的Objective-C类:

大千世界进入一些交际圈真的是因为种族和学识的差异。那时自己才第三次更引人侧目地明白自己是南美洲人,作为大英帝国人的自己作为和思索方法都和身边的亚洲人一样。

语言 5

I am definitely European.

 

理所当然我是澳大利亚(Australia)人。

在Objective-C中使用Swift,步骤类似:

Before this experience, I’ll admit I wasn’t hugely aware of this.

第一创立一个Objective-C的iOS项目:

留学此前,我肯定自己不曾真的发现到这点。

语言 6

As to why most Brits don’t feel European, I suspect it’sbecause of the
rather large stretch of water that separates us from the mainland. So
Brits not identifying as European is quite a standard phenomenon, I
believe.

 

关于怎么一大半英帝国人都不把自己当亚洲人,我难以置信是因为在大家和陆地之间有大片水域相隔,所以我觉得英帝国人不把自己当北美洲人是很正规的气象。

拉长一个斯威夫特的类公事:

获取10.7k好评的作答 @杰弗里 Thorndyke:

语言 7

Why do the British not feel European?

以此类如下:

干什么英国人不觉得自己是北美洲人?

 语言 8

I am answering the question from a purely personal view. First I regard
myself as “English” not British. Secondly I do not feel European as
Europe is “abroad”. I have been there, Germany, Austria, France, but not
since 1961.

 

本人要从很私人的角度来回复这么些问题。首先自己把温馨作为是北爱尔兰人,而非大英帝国人。其次我不认为自己是南美洲人因为南美洲是“海外”,我去过北美洲,到过德国、奥地利共和国(Republik Österreich)、法国,但1961年过后就再没去过。

在YourProject-Bridging-Header.h中添加:

However the question! – Europe is other countries, other languages,
other histories Interesting but different. I do not feel any connection
with these other countries, and certainly do not feel part of any group
or association of other countries.

语言 9

无论怎么样,北美洲就是另国外家,说其余语言,有其他有趣但和大家不一致的历史。我不觉得和这么些“其他国家”有任何涉及,当然也不以为自己是“其余国家”任何小团体的一局地,或跟她俩有此外涉及。

 

Living a quiet life in a rural part of England, I do not have much
contact with citizens of other countries. I do not dislike them or
object to them, they simply do not impact on my life.

在ViewController.m中行使刚刚添加的斯维·夫特(Sw·ift)类:

自身在英格兰农村过着安逸的生存,和其他国家的人尚未稍微交集。我不是不希罕她们或反对他们,只可是他们对本人的生存一点震慑都没有。

 语言 10

It is the same with Europe, I know it’s there, know a reasonable amount
about it, but have absolutely no contact with it.

The
file:<#YourProjectName#>-Swift.h should already be created
automatically in your project, even if you can not see it. 

对澳国也是这么,我掌握它在当下,关于南美洲自我也方便精通一些,但跟它相对一点提到都未曾。

参考文档:http://stackoverflow.com/questions/24002369/how-to-call-objective-c-code-from-swift

更加多意大利语学习课程欢迎前向南外网课官网:http://www.beiwaiclass.com/got?ZRJfYn

发表评论

电子邮件地址不会被公开。 必填项已用*标注

网站地图xml地图