您的位置:首页 > 移动开发 > Swift

The beginning iOS8 Programming with Swift 中文翻译 - 2

2015-12-03 18:24 483 查看
Audience 读者说

This book is written for beginners without any prior programming experience and those 这本书是写给那些想要学习swift语言但之前没有过任何开发经验的初学者

who want to learn Swift programming. Whether you are a programmer who wants to learn 无论你是想学习一门新的语言的程序员或者是一个想把自己的设计融入到

a new programming language or a designer who wants to turn your design into an iOS 一个iOS app的设计人员,更或者是一个想要学习代码的企业主

app or an entrepreneur who wants to learn to code, this book is written for you. 这本书完全是为你准备的

I just assume you are comfortable using Mac OS X and iOS as a user. 当然,我假设你是一个觉得Mac os 及 iOS系统用起来比较舒服的人

Learning Tips 学习建议

I have been asked by some of my blog readers about the best way to start learning iOS 我曾经被一些我的部落格读者问过:什么是学习iOS开发最好的方式

programming. These are some of the learning tips I shared on my blog and I expect these 在我的部落格里有一些我曾经分享过的学习建议,现在,我希望这些建议也能对你有用

tips will be useful to you too.

1. As always, get your hands dirty. I emphasized this technique at the very beginning

when I wrote my first book. You can't learn programming just by reading. You need to take

action and write some code. Fire up Xcode, play around with Swift and follow the first few

chapters to build your first app. Try your best to understand how the Hello World app

works before moving on to the next chapter. If you are able to manage the basics, it will be

much easier for you to understand the rest of the materials.

首先,你必须勤敲代码.在我的写第一本书的时候我着重强调过这点.你不能在学习的过程中只读代码,你需要

写一些代码并且付诸行动.赶快打开你的xcode,创建你的第一个app,然后打开swift语言的学习操场,然后立

即写下一些代码.在你把注意力转移到下一句代码之前尽最大的努力去理解"Hello world"这个程序是怎样的

运行原理.如果你深入理解了掌握了这些基础知识,理解一些复杂的框架对你来说将变得异常简单.

2. Bugs are your friends when learning programming. From time to time, you'll hit bugs

or errors. You probably want to email me and say the sample app doesn't work. How can I

get the bug fixed? Questions are always welcome and I love to help you learn

programming. However, I encourage you to attempt to figure out the solutions by yourself

first. You may go over the code again and again. Or search the web (stackoverflow.com in

particular) for solutions. Just try your best to solve the problem before asking. Like every

programmer, I hate bugs especially when facing a project deadline. However it's always

the bugs that help me improve my programming skills.

If you do not have any programming experience, one useful hint for you is that Swift is a

case-sensitive language. That means a variable named 'message' is different from that

named 'Message'. This is one of the most common errors and frequently asked questions.

当你学习一门语言的时候出现的bug都是你的朋友.你一次又一次的遇到bug和错误.你可能想要通过email

联系我,然后询问我:我的程序无法运行,我该如何修复这些问题.就我个人而言,我非常乐意去帮你学习编程和

帮你解决你所遇到的问题.然而,我还是鼓励你首先通过自己的努力去找到问题的解决方案.你可能需要通过一遍又

一遍的尝试或者通过网络来找到解决方案(比如在stackoverflow.com中).在你开口询问之前尽最大的努力去尝试

自己解决.像所有的程序员一样,在项目截至日期马上到来的时候我特别讨厌出现bug.然而,正是由于这些bug,才让我不断

提高自己的编程技术.

如果你没有任何的编程经验,那么对你非常有用的一点是swift是一种对大小学极其敏感的语言.这就表示,一个名字为"message"

和一个"Message"的变量是不同的,要知道,这是一个非常平常且频繁的错误.

3. "The best way to learn is to teach" is an old saying. It still works in the modern

world, however. You don't need to be an expert to teach. I'm not talking about giving a

lecture in a university or teaching a bunch of students in a formal class. Teaching does not

always happen that way. It can be as simple as sharing your knowledge with a colleague

or a classmate sitting next to you. When you learn something new, try to explain the

materials to someone else. For example, after building the HelloWorld app, teach your

close friend how it works and how he/she can create an app too. When you become more

knowledgeable with the programming language and materials, you may arrange an

interest group and share what you've learnt to a larger group of people.

This is one of the most effective ways of learning as I learn so much while publishing

tutorials on appcoda.com, as well as developing my first book. Sometimes you think you

know the materials well. But once you need to explain the concept to someone else and

answer questions, you may find that you didn't understand the material thoroughly. And

this makes you study the materials even harder. Give this method a shot while you learn

iOS programming.

"最好的学习方法就是任教"这是一句老话,但是他在现代社会仍然有用.你不必成为一个教人的专家.我不是在

谈论如何在大学课堂开展讲座也不是在一个正式的教室里给学生上课,教人不是总在那种请客下才会出现.他可以

简单到在你与同事或者同桌分享知识的时候发生.当你在学习一些新东西的时候,试着解释原理给别人听.打个比方:

当你成功运行hello world程序后,你可以教给你亲密的小伙伴如何创建同样的项目并且告诉他这个项目运行的

原理是什么.当你在编程语言和原理中变得知识渊博,你可能就可以组建一个兴趣组并且分享给更多人你是如何学习的.

这个是学习最重要的途径之一.就像我,当我发布了教程在appcoda.com之后,我学习到了很多以及促使我发布了自己

的第一本书.有时候你觉得自己精通了所有的原理.但是,当你需要解释一些思想给别人的时候,你会发现,你其实并没有

彻底理解透彻其中的原理,这同样促使你更努力的去学习.这是我在你学习iOS开发的又一个忠告.

4. It takes time to become a great programmer. Be patient. The materials in this book

are not magical. You will learn the basics of iOS programming and how to build your own

apps. That said, it takes time and lots of practices to become a competent programmer.

Don't set your expectations too high for your first app. Just create something simple and

fun.

成为一个伟大的程序员是需要大量的时间的.耐心一点,这本书上的一些资料并不神奇.你将学习iOS开发的

一些基础知识,以及如何开发你自己的app.也就是说:想要成为一个大牛级别的程序员将会花费大量的时间.

在你的第一个应用程序中不要将自己的目标设定的过高,仅仅是建立一些简单的例子并且获得一些乐趣.

5. I know money matters. Some of the people begin learning app development just

because of money. There is nothing wrong with that. You may want to build your app

business to earn some side income and eventually turn it into a full time business. That's

completely understandable. Who doesn’t want to live a rich life? However, if money is your

primary reason for building apps, you'll be easily discouraged when you hit bugs or errors.

And then you may give up. Programming is not easy and it is challenging. I find people

who successfully master the language are those who have a strong desire to build apps

and are enthusiastic to learn programming. They have an idea in their mind and want to

turn it into a real app. Making money is not the number one concern. They know the app

can solve their own problems and will be beneficial to others. With such a powerful

purpose in mind, they understand that bugs and problems are a challenge to face. The

only way to move on is to figure out the solutions. So think again why you want to learn

programming.

Lastly, thanks for choosing the book. I hope you will enjoy reading it and launch your first

iOS app on the App Store. If you’d like to share the story of your first app, drop me an

email at simonng@appcoda.com. I would love to hear from you.

我知道关于钱的一些问题.一些人开始编写应用程序是为了钱,这无关对错.你可能想通过自己的app获取到

一些投资赞助,并且最终把它变成一个全职的业务.这是完全可以理解的,毕竟谁不想过富裕的生活,但是,如果

如果钱是你开发app最主要的原因,那么当你遇到bug或者错误的时候你是极其容易气馁的,然后你可能会放

弃.编程是一种不简单的,赋有挑战的事情.而且,我发现那些成为大牛的程序员都是那种对自己的app包含

强烈的欲望以及极其热爱学习的人.他们在有了idea之后迅速的使其成为一个真正的应用程序,赚钱不是他们的

首要目的,他们明白,他们的应用程序是可以切身的解决自己的问题或者是对他人有益的.当如此强烈的目的存在

他们的思想中,他们觉得所谓的bug和错误只是他们需要去面对的挑战而已,而唯一的路就是解决掉这些bug和

错误,所以再次思考一下,你为什么要学习编程.

最后,非常感谢你选择了这本书.我希望你会享受你的编程旅程并且在苹果商店尽快上架你的app.如果你想与我

分享自己的第一个app的故事,那么请用这个simonng@appcoda.com邮箱联系我,我期待你的来信.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: