AR 开发资料汇

总结了AR开发的平台汇总,AR视频经典教程,AR主流资讯网站,Vuforia,EasyAR一些实例教程以及AR精选应用。 AR 平台 Vuforia

iOS面试题大集合[转]

iOS有用的面试题大集合 面试题从何处得来 招聘一个靠谱的 iOS 知乎-如何面试 iOS 工程师? 阅读面试题之前 在正式开始之前,我期望你能对iOS/Mac OS X

腾讯云之小直播开发

视频服务 直播LVB 开发指南 移动直播MLVB 开发指南 移动直播是一套移动终端直播解决方案的集合,它以免费源码的形式向您展示:如何利用腾讯云直播(

迁移SVN库到git库保留branchs和tags

SVN was a great advance in its day, but it’s now clear that distributed version control systems are the way forward and that Git is the de facto standard. Having helped many clients migrate from SVN to Git, here are my notes for a pain-free transition that will preserve the tags and branches in your SVN repository. 首先导入一个本地存储

swift错误处理

Error handling is the process of responding to and recovering from error conditions in your program. Swift provides first-class support for throwing, catching, propagating, and manipulating recoverable errors at runtime. Some operations aren’t guaranteed to always complete execution or produce a useful output. Optionals are used to represent the absence of a value, but when an operation fails, it’s often useful to understand what caused the failure, so that your code can respond accordingly. As an example, consider the task of reading and processing data from a file on disk. There are a number of ways this task can fail, including the file not existing at the specified path, the file not having read permissions, or the file not being encoded in a compatible format. Distinguishing among these different situations allows a program to resolve some errors and to communicate to the user any errors it can’t resolve. 举例,在读取和处理磁盘上的一个文件的数据时,会有有许多方法失败,包括指定的文件路径找不到,没有文件的读取权限,或文件编码格式不兼容。在这些不同情况下,就可以让程序提示用户导致程序无法执行的具体原因。

Representing and Throwing Errors

In Swift, errors are represented by values of types that conform to the Error protocol. This empty protocol indicates that a type can be used for error handling. 在swift中,错误类型是遵循Error 协议。

Swift enumerations are particularly well suited to modeling a group of related error conditions, with associated values allowing for additional information about the nature of an error to be communicated. For example, here’s how you might represent the error conditions of operating a vending machine inside a game: swift枚举类型特别适合为一组错误条件建模,用来关联导致错误的真正原因的相关信息。例如: 一个在操作一台游戏机时的会出现的错误枚举类:

1
2
3
4
5
enum VendingMachineError: Error {
case invalidSelection
case insufficientFunds(coinsNeeded: Int)
case outOfStock
}

Throwing an error lets you indicate that something unexpected happened and the normal flow of execution can’t continue. You use a throw statement to throw an error. For example, the following code throws an error to indicate that five additional coins are needed by the vending machine: 抛出错误说明游戏出现异常,导致其他操作无法进行。这是需要通过Throw语句来抛出这个错误。例如,以下代码抛出了一个错误表明需要five:

1
throw VendingMachineError.insufficientFunds(coinsNeeded: 5)

Handling Errors

When an error is thrown, some surrounding piece of code must be responsible for handling the error—for example, by correcting the problem, trying an alternative approach, or informing the user of the failure. 当错误抛出后,这段代码必须来处理这个错误。例如:通过纠正问题,尝试其他方式实现,或通知用户的失败。

There are four ways to handle errors in Swift. You can propagate the error from a function to the code that calls that function, handle the error using a do-catch statement, handle the error as an optional value, or assert that the error will not occur. Each approach is described in a section below. 在swift中有四种处理错误机制: 1. 向调用方法中传递这个错误 2. 使用do-catch语句处理 3. 把错误设置为可选型 4.断言不会出现异常的情况下,使用try!禁止异常抛出

When a function throws an error, it changes the flow of your program, so it’s important that you can quickly identify places in your code that can throw errors. To identify these places in your code, write the try keyword—or the try? or try! variation—before a piece of code that calls a function, method, or initializer that can throw an error. These keywords are described in the sections below. 当一个方法抛出错误时,会打断程序正常的工作流,必须快速定位到可能抛出错误的代码。可以使用关键字try 要注意 try?try!之间的差异。在调用一个函数,方法或者构造器之前,来抛出异常。

Propagating Errors Using Throwing Functions

To indicate that a function, method, or initializer can throw an error, you write the throws keyword in the function’s declaration after its parameters. A function marked with throws is called a throwing function. If the function specifies a return type, you write the throwskeyword before the return arrow (->). 函数,方法或构造器都可以抛出异常,只需要在声明它们时添加关键字:throws即可,这种方法被称为throws函数,throws关键字位置在参数之后,返回值(->)之前

A throwing function propagates errors that are thrown inside of it to the scope from which it’s called. 抛出函数会把错误抛给调用它的函数周期中去。

在OC和swift中区分多个targets

build setting预编译位置 Preprocessor Macros Other Swift Flags 为生产和开发target配置预处理宏/编译器标识。之后我们就可以使用该标识在我们的代码来检测应用程序正在

Swift 语言指南[转]

Swift 语言指南 @SwiftLanguage 更新于 2016-6-6,更新内容详见 Issue 55。往期更新回顾详见《收录周报》 这份指南汇集了 Swift 语言主流学习资源,并以开发者的视角整理编

Docker使用

安装Docker for Mac 在Mac上运行Docker。系统要求,OS X 10.10.3 或者更高版本,至少4G内存,4.3.30版本以前的VirtualBox会与

hackmd使用

編輯

快速鍵

跟又快又方便的Sublime text很像

更多訊息請至 這裡

自動完成

提供完整的 Markdown 自動完成與提示

  • 表情符號:輸入 : 顯示提示
  • 程式碼區塊:輸入 3个 ` 加上一個字元 顯示提示
  • 標頭:輸入 # 顯示提示
  • 參考:輸入 [] 顯示提示
  • 外部:輸入 {} 顯示提示
  • 圖片:輸入 ! 顯示提示

標題

會使用 第一個第一級標頭 作為筆記標題

標籤

如同以下方式來使用標籤,它們會顯示在您的 歷史紀錄

tags: 功能 更新

YAML metadata

提供描述筆記的資訊,以進階設定瀏覽行為,詳細請至上連結

  • robots: 設定網路機器人 meta
  • lang: 設定瀏覽器顯示語言
  • dir: 設定文字方向
  • breaks: 設定是否使用分行
  • mathjax: 設定是否使用 mathjax

表情符號

您可以像是這樣使用表情符號 😄 😃 😢 😉

完整的表情符號列表 在這裡

待辦清單

  • 待辦
    • 買些沙拉
    • 刷牙
    • 喝水