This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
class Comment { | |
// MARK: プロパティ | |
var id: Int | |
var text: String | |
// MARK: イニシャライザ | |
init(id:Int, text:String) { | |
self.id = id |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
class MovieRepo { | |
// MARK: プロパティ | |
var movies = [MovieT]() | |
// MARK: イニシャライザ | |
init() { | |
let photo1 = UIImage(named: "movie01")! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
<plist version="1.0"> | |
<dict> | |
<key>NSAppTransportSecurity</key> | |
<dict> | |
<key>NSAllowsArbitraryLoads</key> | |
<true/> | |
</dict> | |
... | |
</dict> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import XCTest | |
@testable import App | |
class AppTests: XCTestCase { | |
override func setUp() { | |
super.setUp() | |
// Put setup code here. This method is called before the invocation of each test method in the class. | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//: Playground - noun: a place where people can play | |
import UIKit | |
//## クラスとストラクチャ ##### | |
//## 定義 | |
struct S住所 { | |
// MARK:プロパティ | |
var 郵便番号 = "" | |
var 都道府県 = "" | |
var 市区町村 = "" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
//## 配列の定義 | |
//# 空の配列の作成 | |
var v整数配列 = [Int]() //[] | |
print("v整数配列の要素数:\(v整数配列.count)") | |
//結果:v整数配列の要素数:0\n | |
//# 配列に値を追加 | |
v整数配列.append(5) //[5] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
//## シンタックス: {(引数リスト) -> (戻り値) in 文} | |
//# 変数にクロージャを代入 | |
//例1 {() -> () } | |
var v引数無し戻り値無し: ()->() = { | |
print("引数無し戻り値無しのクロージャ") | |
} | |
v引数無し戻り値無し() //"引数無し戻り値無しのクロージャ" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//: Playground - noun: a place where people can play | |
import UIKit | |
//## for-in | |
for i in 1...3 { | |
//3回繰り返し | |
} | |
// 配列の要素の数だけ繰り返して合計を求める | |
var v合計 = 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
//## シンタックス: (パラメータリスト) -> (戻り値) | |
//## 定義と呼び出し | |
// 1. (String) -> (String) | |
func f挨拶(名前: String) -> String { | |
let l挨拶 = 名前 + "さん、今日は" | |
return l挨拶 | |
} | |
// 呼び出し |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
//## iOS:ファイルシステム ##### | |
//標準ディレクトリ ( Documents/, Library/, tmp/ ... ) | |
//## OS X:ファイルシステム ##### | |
//ローカルドメイン ( Applications/Utilities, Developer/, Library/ ) | |
//ユーザードメイン ( Users/user1, ... ) | |
//ファイルまたはディレクトリのパス |