{"id":225297,"date":"2014-06-05T10:29:03","date_gmt":"2014-06-05T06:29:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=225297"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=225297","title":{"rendered":"<span class=\"post_title\">\u0417\u043d\u0430\u043a\u043e\u043c\u044c\u0442\u0435\u0441\u044c, Swift!<\/span>"},"content":{"rendered":"<div class=\"content html_format\"> \t\t\t2 \u0438\u044e\u043d\u044f \u043d\u0430 \u043a\u043e\u043d\u0444\u0435\u0440\u0435\u043d\u0446\u0438\u0438 WWDC 2014 Apple \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u043b\u0430 \u043d\u043e\u0432\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442\u043d\u043e-\u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u044f\u0437\u044b\u043a \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u2014 Swift. \u042f \u0434\u0443\u043c\u0430\u044e, \u043c\u043d\u043e\u0433\u0438\u0435 \u0443\u0436\u0435 \u0443\u0441\u043f\u0435\u043b\u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u0447\u0442\u043e \u0438\u0437 \u0441\u0435\u0431\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u044d\u0442\u043e\u0442 \u044f\u0437\u044b\u043a (<a href=\"http:\/\/habrahabr.ru\/post\/225089\/\">Swift \u2014 \u043d\u043e\u0432\u043e\u0432\u0432\u0435\u0434\u0435\u043d\u0438\u044f<\/a>), \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u043d\u0435 \u0431\u0443\u0434\u0443 \u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u043d\u043e\u0432\u043e\u0432\u0432\u0435\u0434\u0435\u043d\u0438\u044f\u0445. \u042f \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u0435\u043d\u044c\u043a\u0438\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u043d\u0430 \u044f\u0437\u044b\u043a\u0435 Swift, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043d\u044f\u0442\u044c \u043d\u0430 \u0434\u0435\u043b\u0435 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043e\u0442\u043b\u0438\u0447\u0438\u044f \u043e\u0442 \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u043e\u0433\u043e Obj-C.  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\"  src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/d93\/6c7\/03c\/d936c703c717205e57a06153e4e79db0.png\"\/><\/div>\n<p>  <a name=\"habracut\"><\/a><\/p>\n<h4>\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430<\/h4>\n<p>  \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c Xcode 6 Beta. \u0421\u043a\u0430\u0447\u0430\u0442\u044c \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u043e\u0442\u0441\u044e\u0434\u0430:<br \/>  <a href=\"https:\/\/developer.apple.com\/devcenter\/ios\/index.action\">https:\/\/developer.apple.com\/devcenter\/ios\/index.action<\/a><br \/>  \u0421\u043a\u0430\u0447\u0438\u0432\u0430\u0435\u043c, \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0438 \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c (\u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0441 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u043e\u0439 \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0443\u0442\u044c, beta \u0432\u0435\u0440\u0441\u0438\u044f \u0441\u0442\u0430\u0432\u0438\u0442\u0441\u044f \u043a\u0430\u043a \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0438 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 Xcode \u043d\u0438\u043a\u0430\u043a \u043d\u0435 \u0432\u043b\u0438\u044f\u0435\u0442).<br \/>  \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043d\u043e\u0432\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 (Single View Application) -&gt; \u0432\u0432\u043e\u0434\u0438\u043c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0438 \u043d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0435\u043c \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u044f\u0437\u044b\u043a Swift! <\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/332\/644\/26b\/33264426bc6db9cc0961eacab459452a.png\"\/><\/p>\n<h4>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430<\/h4>\n<p>  \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443, \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0444\u0430\u0439\u043b\u043e\u0432 \u0442\u0435\u043f\u0435\u0440\u044c \u0432 2 \u0440\u0430\u0437\u0430 \u043c\u0435\u043d\u044c\u0448\u0435, \u0442\u0435\u043f\u0435\u0440\u044c \u043d\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0432 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u0447\u043d\u044b\u0445 \u0444\u0430\u0439\u043b\u0430\u0445. \u041a\u043e\u0434, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u0432 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u043e\u0439 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0442\u043e\u0447\u043a\u0438 \u0432\u0445\u043e\u0434\u0430 \u0434\u043b\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b, \u0442\u0430\u043a \u0447\u0442\u043e \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435 \u043d\u0443\u0436\u043d\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f main. <br \/>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/ca8\/4e0\/45e\/ca84e045e2e13d8ce6f2a1ddef710305.png\"\/><\/p>\n<p>  \u0412\u043e\u0442 \u043a\u0430\u043a \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0435\u043f\u0435\u0440\u044c AppDelegate:<\/p>\n<pre><code class=\"objectivec\">import UIKit  @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate {                                  var window: UIWindow?      func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: NSDictionary?) -&gt; Bool {         \/\/ Override point for customization after application launch.         return true     }      func applicationWillResignActive(application: UIApplication) {         \/\/ Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.         \/\/ Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.     }      func applicationDidEnterBackground(application: UIApplication) {         \/\/ Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.         \/\/ If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.     }      func applicationWillEnterForeground(application: UIApplication) {         \/\/ Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.     }      func applicationDidBecomeActive(application: UIApplication) {         \/\/ Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.     }      func applicationWillTerminate(application: UIApplication) {         \/\/ Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.     } } <\/code><\/pre>\n<h4>Hello World<\/h4>\n<p>  \u0418\u0437\u0443\u0447\u0435\u043d\u0438\u0435 \u043b\u044e\u0431\u043e\u0433\u043e \u044f\u0437\u044b\u043a\u0430 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0441 Hello World. \u041d\u0435 \u0441\u0442\u0430\u043d\u0435\u043c \u043d\u0430\u0440\u0443\u0448\u0430\u0442\u044c \u0442\u0440\u0430\u0434\u0438\u0446\u0438\u044e. \u041e\u0442\u043a\u0440\u043e\u0439\u0442\u0435 AppDelegate.swift \u0438 \u0434\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0432<code> func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: NSDictionary?) -&gt; Bool <\/code>\u0441\u0442\u0440\u043e\u043a\u0443:<\/p>\n<pre><code class=\"objectivec\">println(&quot;Hello World&quot;) \/\/\u0412\u044b\u0432\u043e\u0434\u0438\u0442 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c<\/code><\/pre>\n<p>  \u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 \u0438 \u0432\u044b \u0443\u0432\u0438\u0434\u0438\u0442\u0435 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u0437\u0430\u0432\u0435\u0442\u043d\u044b\u0439 Hello World. \u0412\u043e\u0442 \u0442\u0430\u043a \u0432\u0441\u0435 \u043f\u0440\u043e\u0441\u0442\u043e. <\/p>\n<h4>\u0423\u0441\u043b\u043e\u0436\u043d\u0438\u043c<\/h4>\n<p>  \u041d\u0435\u043c\u043d\u043e\u0433\u043e \u0443\u0441\u043b\u043e\u0436\u043d\u0438\u043c \u043f\u0440\u043e\u0435\u043a\u0442. \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u043b\u044e\u0431\u0438\u043c\u044b\u0439 TableView.<br \/>  \u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c Main.storyboard. \u041a\u0441\u0442\u0430\u0442\u0438, \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u0447\u0442\u043e \u0434\u043b\u044f \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f \u043d\u0435 \u0434\u0432\u0430 storyboard, \u043a\u0430\u043a \u0431\u044b\u043b\u043e \u0440\u0430\u043d\u044c\u0448\u0435, \u0430 \u0432\u0441\u0435\u0433\u043e \u043b\u0438\u0448\u044c \u043e\u0434\u0438\u043d. \u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0438\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u043e\u0432 \u0442\u043e\u0436\u0435 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u043b\u043e\u0441\u044c:<br \/>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/672\/9ea\/d8d\/6729ead8df142004156eee164f6427df.png\"\/><\/p>\n<p>  \u041d\u0430\u0445\u043e\u0434\u0438\u043c \u0432 Object Library \u0437\u0430\u0432\u0435\u0442\u043d\u044b\u0439 Table View \u0438 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0438\u043c \u0435\u0433\u043e \u043d\u0430 \u044d\u043a\u0440\u0430\u043d \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u0420\u0430\u0441\u0442\u044f\u0433\u0438\u0432\u0430\u0435\u043c \u0442\u0430\u0431\u043b\u0438\u0446\u0443, \u0447\u0442\u043e\u0431\u044b \u043e\u043d\u0430 \u0431\u044b\u043b\u0430 \u043d\u0430 \u0432\u0435\u0441\u044c \u044d\u043a\u0440\u0430\u043d (\u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e, \u0447\u0442\u043e\u0431\u044b \u043e\u043d\u0430 \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u043b\u0430 \u0441 \u043a\u0440\u0430\u044f\u043c\u0438). <br \/>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/ff5\/cbb\/286\/ff5cbb28689fae1a78b69172a5ea161a.png\"\/><\/p>\n<p>  \u0414\u0430\u043b\u044c\u0448\u0435 \u0432\u0441\u0435 \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u043a\u0430\u043a \u0438 \u0440\u0430\u043d\u044c\u0448\u0435, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u0434\u0430\u0442\u044c \u0434\u043b\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u044b dataSource \u0438 delegate. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c Connection Inspector, \u043e\u0442 delegate \u0442\u044f\u043d\u0435\u043c \u043a \u043e\u0431\u044a\u0435\u043a\u0442\u0443 ViewController \u0438 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u0434\u043b\u044f dataSource. <\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/479\/7ef\/676\/4797ef6764f462447256981a60ae8639.png\"\/><\/p>\n<p>  \u0412\u043e ViewController.swift \u043d\u0443\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u044f\u0442\u0441\u044f: UITableViewDataSource \u0438 UITableViewDelegate <br \/>  \u0422\u0435\u043f\u0435\u0440\u044c \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0442\u0430\u043a:<\/p>\n<pre><code class=\"objectivec\">class ViewController: UIViewController, UITableViewDataSource, UITableViewDelegate<\/code><\/pre>\n<p>  \u041a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u0441\u0440\u0430\u0437\u0443 \u0440\u0443\u0433\u043d\u0435\u0442\u0441\u044f:<br \/>  <i>Type &#8216;ViewController&#8217; does not conform to protocol &#8216;UITableViewDataSource&#8217;<\/i><br \/>  \u041a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u0441\u043e\u043e\u0431\u0449\u0430\u0435\u0442 \u043d\u0430\u043c, \u0447\u0442\u043e \u043c\u044b \u043d\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043b\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430 <code>'UITableViewDataSource'<\/code>. \u0427\u0442\u043e\u0431\u044b \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043a\u0430\u043a\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043d\u0443\u0436\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c, \u0437\u0430\u0436\u043c\u0438\u0442\u0435 command + \u043a\u043b\u0438\u043a\u043d\u0438\u0442\u0435 \u043f\u043e \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0443. <\/p>\n<pre><code class=\"objectivec\">protocol UITableViewDataSource : NSObjectProtocol {          func tableView(tableView: UITableView!, numberOfRowsInSection section: Int) -&gt; Int     func tableView(tableView: UITableView!, cellForRowAtIndexPath indexPath: NSIndexPath!) -&gt; UITableViewCell!<\/code><\/pre>\n<p>  \u0412\u043e\u0442 \u044d\u0442\u0438 \u0434\u0432\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 \u043d\u0430\u0448 ViewController.swift<br \/>  \u041f\u0435\u0440\u0432\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043e\u043b\u0436\u043d\u0430 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0442\u0440\u043e\u043a \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 (Int):<\/p>\n<pre><code class=\"objectivec\">func tableView(tableView: UITableView!, numberOfRowsInSection section: Int) -&gt; Int  {         return 20   }<\/code><\/pre>\n<p>   \u0410 \u0432\u0442\u043e\u0440\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u044f\u0447\u0435\u0439\u043a\u0443 \u0442\u0430\u0431\u043b\u0438\u0446\u044b:<\/p>\n<pre><code class=\"objectivec\">func tableView(tableView: UITableView!, cellForRowAtIndexPath indexPath: NSIndexPath!) -&gt; UITableViewCell!     {         let cell: UITableViewCell = UITableViewCell(style: UITableViewCellStyle.Subtitle, reuseIdentifier: &quot;MyTestSwiftCell&quot;)                  cell.text = &quot;Habrapost \\(indexPath.row)&quot;         cell.detailTextLabel.text = &quot;Hi, \\(indexPath.row)&quot;                  return cell     }<\/code><\/pre>\n<p>  \u0412 \u043f\u0435\u0440\u0432\u043e\u0439 \u0441\u0442\u0440\u043e\u0447\u043a\u0435 \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u044f\u0447\u0435\u0439\u043a\u0443. \u0420\u0430\u0437\u0431\u0435\u0440\u0435\u043c \u0437\u0430\u043f\u0438\u0441\u044c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0439:<br \/>  let \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0443, \u0430 \u043d\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e. <br \/>  let cell: UITableViewCell \u0441\u043e\u043e\u0431\u0449\u0430\u0435\u043c, \u0447\u0442\u043e \u0442\u0438\u043f \u044d\u0442\u043e\u0439 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b \u0431\u0443\u0434\u0435\u0442 UITableViewCell. \u041f\u043e \u0438\u0434\u0435\u0435, \u043d\u0435\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u043e\u043e\u0431\u0449\u0430\u0442\u044c \u043a\u0430\u043a\u043e\u0439 \u0442\u0438\u043f \u0431\u0443\u0434\u0435\u0442 \u0443 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b \u0438\u043b\u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439. \u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0438 \u0442\u0430\u043a: <\/p>\n<pre><code class=\"objectivec\">let cell = UITableViewCell(style: UITableViewCellStyle.Subtitle, reuseIdentifier: &quot;MyTestSwiftCell&quot;)<\/code><\/pre>\n<p>  \u041d\u043e \u043a\u0430\u043a \u043c\u043d\u0435 \u043a\u0430\u0436\u0435\u0442\u0441\u044f, \u043b\u0443\u0447\u0448\u0435 \u0432\u0441\u0435-\u0442\u0430\u043a\u0438 \u0441\u043e\u043e\u0431\u0449\u0430\u0442\u044c, Apple \u0434\u0430\u0435\u0442 \u0445\u043e\u0440\u043e\u0448\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u043e\u0447\u0435\u043c\u0443:<\/p>\n<pre><code class=\"objectivec\">let implicitInteger = 70 let implicitDouble = 70.0 let explicitDouble: Double = 70<\/code><\/pre>\n<p>  \u041d\u0430\u043f\u043e\u043c\u043d\u044e, \u043a\u0430\u043a \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u043b\u0438 \u044f\u0447\u0435\u0439\u043a\u0443 \u0432 Obj-C:<\/p>\n<pre><code class=\"objectivec\">UITableCell *cell =[[UITableCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@&quot;MyTestSwiftCell&quot;]<\/code><\/pre>\n<p>  \u041d\u0435 \u043d\u0443\u0436\u0435\u043d \u0431\u043e\u043b\u044c\u0448\u0435 alloc, Swift \u0432\u0441\u0435 \u0434\u0435\u043b\u0430\u0435\u0442 \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e. \u0412\u0441\u0435 \u043c\u0435\u0442\u043e\u0434\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430\u0447\u0438\u043d\u0430\u043b\u0438\u0441\u044c \u0441 init \u0431\u044b\u043b\u0438 \u0443\u0431\u0440\u0430\u043d\u044b, \u0438 \u0442\u0435\u043f\u0435\u0440\u044c \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432 \u0441\u0442\u0438\u043b\u0435 Swift (\u0442.\u0435 MyClass()). \u041f\u0440\u0438\u0447\u0435\u043c \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u044b \u0441 with \u0442\u043e\u0436\u0435 \u0431\u044b\u043b\u0438 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u044b, \u0442\u043e \u0447\u0442\u043e \u0448\u043b\u043e \u043f\u043e\u0441\u043b\u0435 with \u2014 \u0441\u0442\u0430\u043b\u043e \u043f\u0435\u0440\u0432\u044b\u043c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u043c \u0432 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0435 Swift.<\/p>\n<p>  \u0412\u043e\u0442 \u044d\u0442\u0430 \u0437\u0430\u043f\u0438\u0441\u044c \u043c\u043d\u0435 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0441\u0438\u043b\u044c\u043d\u043e \u043f\u043e\u043d\u0440\u0430\u0432\u0438\u043b\u0430\u0441\u044c:<\/p>\n<pre><code class=\"objectivec\">cell.text = &quot;Habrapost \\(indexPath.row)&quot;<\/code><\/pre>\n<p>  \u0412 Obj-C, \u0447\u0442\u043e\u0431\u044b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044e \u043a\u043e\u043d\u043a\u0430\u0442\u0435\u043d\u0430\u0446\u0438\u044e \u0441\u0442\u0440\u043e\u043a, \u043d\u0443\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0438\u0437\u0433\u0430\u043b\u044f\u0442\u044c\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"objectivec\">cell.text = [NSString stringWithFormat:@&quot;Habrapost %@&quot;, indexPath.row];<\/code><\/pre>\n<p>  \u041f\u043e \u043c\u043d\u0435, \u0442\u0430\u043a \u044d\u0442\u043e \u043f\u0440\u0438\u044f\u0442\u043d\u043e\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435.<br \/>  \u0421\u043a\u0430\u0436\u0435\u043c \u0442\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u0437\u0430\u0445\u043e\u0442\u0435\u043b\u0438 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0446\u0432\u0435\u0442 \u0442\u0435\u043a\u0441\u0442\u0430 \u043d\u0430 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u0444\u0438\u043e\u043b\u0435\u0442\u043e\u0432\u044b\u0439. \u0421\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u0442\u043e\u043c\u0443 \u043a\u0430\u043a \u0431\u044b\u043b\u043e \u0432 Obj-C, \u043e\u0431\u0440\u0430\u0442\u0438\u043c\u0441\u044f \u043a \u043c\u0435\u0442\u043e\u0434\u0443 \u043a\u043b\u0430\u0441\u0441\u0430 <\/p>\n<pre><code class=\"objectivec\">cell.detailTextLabel.textColor = UIColor.purpleColor()<\/code><\/pre>\n<p>  \u0412 \u0438\u0442\u043e\u0433\u0435, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c<br \/>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/43c\/6f2\/3a1\/43c6f23a11ad366fc616494956f15bdf.png\"\/><\/p>\n<h4>\u041d\u0435\u043c\u043d\u043e\u0433\u043e \u043e playground<\/h4>\n<p>  Playground \u2014 \u044d\u0442\u043e \u043f\u043b\u043e\u0449\u0430\u0434\u043a\u0430, \u0433\u0434\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u0438 \u0435\u0441\u043b\u0438 \u043f\u043e\u043d\u0440\u0430\u0432\u0438\u0442\u044c\u0441\u044f \u043f\u0435\u0440\u0435\u043d\u0435\u0441\u0442\u0438 \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u043f\u0440\u043e\u0435\u043a\u0442.<br \/>  \u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c playgroung \u0432\u044b\u0431\u0435\u0440\u0435\u0442\u0435 File-&gt;New-&gt;File:<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/712\/72a\/634\/71272a6345144f23121cbafbdade6cbd.png\"\/><\/p>\n<p>  \u0412\u043e\u0442 \u0438 \u0432\u0441\u0435, \u043c\u043e\u0436\u043d\u043e \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u044f \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0430 \u044f\u0447\u0435\u0439\u043a\u0443 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u0447\u0442\u043e\u0431\u044b \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u043a\u0430\u043a \u043e\u043d\u0430 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c. <\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/3c4\/b83\/d03\/3c4b83d03b9a0540e8f9ca1792be3b4e.png\"\/><br \/>  \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0439 \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u043c\u043e\u0436\u043d\u043e \u0437\u0434\u0435\u0441\u044c <a href=\"https:\/\/developer.apple.com\/library\/prerelease\/ios\/recipes\/xcode_help-source_editor\/ExploringandEvaluatingSwiftCodeinaPlayground\/ExploringandEvaluatingSwiftCodeinaPlayground.html\">https:\/\/developer.apple.com\/&#8230;<\/a><\/p>\n<h4>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h4>\n<p>  \u041d\u0430 \u043f\u0435\u0440\u0432\u044b\u0439 \u0432\u0437\u0433\u043b\u044f\u0434, \u043c\u043d\u0435 \u044f\u0437\u044b\u043a \u043f\u043e\u043d\u0440\u0430\u0432\u0438\u043b\u0441\u044f. \u0414\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043b\u0435\u0433\u043a\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043e\u0442 Obj-C \u043d\u0430 Swift, \u043a \u0442\u043e\u043c\u0443 \u0436\u0435 Swift \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u043e \u0443\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0441 Obj-C. \u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043a\u043e\u0434\u0430 \u0443\u043c\u0435\u043d\u044c\u0448\u0438\u043b\u043e\u0441\u044c \u0432 \u0440\u0430\u0437\u044b, \u0447\u0438\u0442\u0430\u0435\u043c\u043e\u0441\u0442\u044c \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u043b\u0430\u0441\u044c. \u0421 \u043f\u0430\u043c\u044f\u0442\u044c\u044e \u0442\u0435\u043f\u0435\u0440\u044c \u0432\u043e\u043e\u0431\u0449\u0435 \u0432\u043e\u0437\u0438\u0442\u044c\u0441\u044f \u043d\u0435 \u043d\u0430\u0434\u043e, \u0432\u0441\u0435 \u044d\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442 Swift.<\/p>\n<p>  \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043f\u0440\u043e Swift: <a href=\"https:\/\/itunes.apple.com\/us\/book\/swift-programming-language\/id881256329?mt=11\">The Swift Programming Language<\/a> \t\t\t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/225297\/\"> http:\/\/habrahabr.ru\/post\/225297\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\"> \t\t\t2 \u0438\u044e\u043d\u044f \u043d\u0430 \u043a\u043e\u043d\u0444\u0435\u0440\u0435\u043d\u0446\u0438\u0438 WWDC 2014 Apple \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u043b\u0430 \u043d\u043e\u0432\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442\u043d\u043e-\u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u044f\u0437\u044b\u043a \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u2014 Swift. \u042f \u0434\u0443\u043c\u0430\u044e, \u043c\u043d\u043e\u0433\u0438\u0435 \u0443\u0436\u0435 \u0443\u0441\u043f\u0435\u043b\u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u0447\u0442\u043e \u0438\u0437 \u0441\u0435\u0431\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u044d\u0442\u043e\u0442 \u044f\u0437\u044b\u043a (<a href=\"http:\/\/habrahabr.ru\/post\/225089\/\">Swift \u2014 \u043d\u043e\u0432\u043e\u0432\u0432\u0435\u0434\u0435\u043d\u0438\u044f<\/a>), \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u043d\u0435 \u0431\u0443\u0434\u0443 \u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u043d\u043e\u0432\u043e\u0432\u0432\u0435\u0434\u0435\u043d\u0438\u044f\u0445. \u042f \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u0435\u043d\u044c\u043a\u0438\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u043d\u0430 \u044f\u0437\u044b\u043a\u0435 Swift, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043d\u044f\u0442\u044c \u043d\u0430 \u0434\u0435\u043b\u0435 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043e\u0442\u043b\u0438\u0447\u0438\u044f \u043e\u0442 \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u043e\u0433\u043e Obj-C.  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\"  src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/d93\/6c7\/03c\/d936c703c717205e57a06153e4e79db0.png\"\/><\/div>\n<p>  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-225297","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/225297","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=225297"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/225297\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=225297"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=225297"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=225297"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}