├── source
├── svm.swift
├── math
│ ├── mathFunc.swift
│ └── Matrix.swift
├── statistics
│ └── kalman.swift
└── NeuralNetwork.swift
├── swiftplay.playground
├── Contents.swift
├── contents.xcplayground
└── playground.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcuserdata
│ └── Vee.xcuserdatad
│ └── UserInterfaceState.xcuserstate
├── swift-brain-app
├── swift-brain
│ ├── Assets.xcassets
│ │ ├── first.imageset
│ │ │ ├── first.pdf
│ │ │ └── Contents.json
│ │ ├── second.imageset
│ │ │ ├── second.pdf
│ │ │ └── Contents.json
│ │ └── AppIcon.appiconset
│ │ │ └── Contents.json
│ ├── FirstViewController.swift
│ ├── SecondViewController.swift
│ ├── Info.plist
│ ├── Base.lproj
│ │ ├── LaunchScreen.storyboard
│ │ └── Main.storyboard
│ └── AppDelegate.swift
├── swift-brain.xcodeproj
│ ├── project.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ └── xcuserdata
│ │ │ └── Vee.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ ├── xcuserdata
│ │ └── Vee.xcuserdatad
│ │ │ └── xcschemes
│ │ │ ├── xcschememanagement.plist
│ │ │ └── swift-brain.xcscheme
│ └── project.pbxproj
├── swift-brainTests
│ ├── Info.plist
│ └── swift_brainTests.swift
└── swift-brainUITests
│ ├── Info.plist
│ └── swift_brainUITests.swift
├── README.md
├── LICENSE.md
└── .gitignore
/source/svm.swift:
--------------------------------------------------------------------------------
1 | // TO DO: Make SVM with demo.
2 |
--------------------------------------------------------------------------------
/swiftplay.playground/Contents.swift:
--------------------------------------------------------------------------------
1 | //: Playground - noun: a place where people can play
2 |
3 | import UIKit
4 | //import Surge
5 | var str = "Hello, playground"
6 | //prin
7 |
--------------------------------------------------------------------------------
/swift-brain-app/swift-brain/Assets.xcassets/first.imageset/first.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vlall/Swift-Brain/HEAD/swift-brain-app/swift-brain/Assets.xcassets/first.imageset/first.pdf
--------------------------------------------------------------------------------
/swift-brain-app/swift-brain/Assets.xcassets/second.imageset/second.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vlall/Swift-Brain/HEAD/swift-brain-app/swift-brain/Assets.xcassets/second.imageset/second.pdf
--------------------------------------------------------------------------------
/swiftplay.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/swiftplay.playground/playground.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/swiftplay.playground/playground.xcworkspace/xcuserdata/Vee.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vlall/Swift-Brain/HEAD/swiftplay.playground/playground.xcworkspace/xcuserdata/Vee.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/swift-brain-app/swift-brain.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/swift-brain-app/swift-brain.xcodeproj/project.xcworkspace/xcuserdata/Vee.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vlall/Swift-Brain/HEAD/swift-brain-app/swift-brain.xcodeproj/project.xcworkspace/xcuserdata/Vee.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/swift-brain-app/swift-brain/Assets.xcassets/first.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "first.pdf"
6 | }
7 | ],
8 | "info" : {
9 | "version" : 1,
10 | "author" : "xcode"
11 | }
12 | }
--------------------------------------------------------------------------------
/swift-brain-app/swift-brain/Assets.xcassets/second.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "second.pdf"
6 | }
7 | ],
8 | "info" : {
9 | "version" : 1,
10 | "author" : "xcode"
11 | }
12 | }
--------------------------------------------------------------------------------
/source/math/mathFunc.swift:
--------------------------------------------------------------------------------
1 | //
2 | // MathFunc.swift
3 | // Brain
4 | //
5 | // Created by Vishal on 201X-XX-XX.
6 | // Copyright (c) 2015 Vishal. All rights reserved.
7 | //
8 |
9 | import Foundation
10 |
11 | class mathFunc {
12 | func randomFunc(a: Double, b:Double) -> (Double) {
13 | let randNum = arc4random_uniform(100)/100
14 | let output = (b-a)*Double(randNum) + (a)
15 |
16 | return output
17 | }
18 |
19 | func dydx(x: Double)->(Double){
20 | return 1.0 - x**2.0
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/swift-brain-app/swift-brain/FirstViewController.swift:
--------------------------------------------------------------------------------
1 | //
2 | // FirstViewController.swift
3 | // swift-brain
4 | //
5 | // Created by V Lall on 10/5/15.
6 | // Copyright © 2015 vlall. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | class FirstViewController: UIViewController {
12 |
13 | override func viewDidLoad() {
14 | super.viewDidLoad()
15 | // Do any additional setup after loading the view, typically from a nib.
16 | }
17 |
18 | override func didReceiveMemoryWarning() {
19 | super.didReceiveMemoryWarning()
20 | // Dispose of any resources that can be recreated.
21 | }
22 |
23 |
24 | }
25 |
26 |
--------------------------------------------------------------------------------
/swift-brain-app/swift-brain/SecondViewController.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SecondViewController.swift
3 | // swift-brain
4 | //
5 | // Created by V Lall on 10/5/15.
6 | // Copyright © 2015 vlall. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | class SecondViewController: UIViewController {
12 |
13 | override func viewDidLoad() {
14 | super.viewDidLoad()
15 | // Do any additional setup after loading the view, typically from a nib.
16 | }
17 |
18 | override func didReceiveMemoryWarning() {
19 | super.didReceiveMemoryWarning()
20 | // Dispose of any resources that can be recreated.
21 | }
22 |
23 |
24 | }
25 |
26 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Swift Brain
2 | The first neural network / machine learning library written in Swift. This is a project for AI algorithms in Swift for iOS and OS X development. This project includes algorithms focused on Bayes theorem, neural networks, SVMs, Matrices, etc.. Feel free to contribute.
3 |
4 | ### Development
5 | Tools:
6 | - [x] Matrix operations
7 | Machine Learning algorithms
8 | - [ ] Basic regressions
9 | - [x] Kalman filter
10 | - [x] Neural networks
11 | - [x] Support vector machines
12 | - [ ] Bayesian Classifiers
13 | - [ ] Clustering
14 | - [ ] Self Organizing
15 | Statistics
16 | - [ ] Bayes theorem/naive classifier
17 | - [ ] Markov model
18 |
19 | ### Installation and Setup
20 | Podfile coming
21 |
22 | ### Working Example Application coming.
23 |
--------------------------------------------------------------------------------
/swift-brain-app/swift-brain/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "iphone",
5 | "size" : "29x29",
6 | "scale" : "2x"
7 | },
8 | {
9 | "idiom" : "iphone",
10 | "size" : "29x29",
11 | "scale" : "3x"
12 | },
13 | {
14 | "idiom" : "iphone",
15 | "size" : "40x40",
16 | "scale" : "2x"
17 | },
18 | {
19 | "idiom" : "iphone",
20 | "size" : "40x40",
21 | "scale" : "3x"
22 | },
23 | {
24 | "idiom" : "iphone",
25 | "size" : "60x60",
26 | "scale" : "2x"
27 | },
28 | {
29 | "idiom" : "iphone",
30 | "size" : "60x60",
31 | "scale" : "3x"
32 | }
33 | ],
34 | "info" : {
35 | "version" : 1,
36 | "author" : "xcode"
37 | }
38 | }
--------------------------------------------------------------------------------
/swift-brain-app/swift-brainTests/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | BNDL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 |
24 |
25 |
--------------------------------------------------------------------------------
/swift-brain-app/swift-brainUITests/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | BNDL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 |
24 |
25 |
--------------------------------------------------------------------------------
/swift-brain-app/swift-brain.xcodeproj/xcuserdata/Vee.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | swift-brain.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 |
13 | SuppressBuildableAutocreation
14 |
15 | 85A2844B1BC2FA73001C04AF
16 |
17 | primary
18 |
19 |
20 | 85A284611BC2FA73001C04AF
21 |
22 | primary
23 |
24 |
25 | 85A2846C1BC2FA73001C04AF
26 |
27 | primary
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/source/math/Matrix.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Matrix.swift
3 | // Brain
4 | //
5 | // Created by Vishal on 201X-XX-XX.
6 | // Copyright (c) 2015 Vishal. All rights reserved.
7 | //
8 | // Stole some of these from the original Neural Network. I'll make it look fancier soon.
9 | //
10 |
11 | import Foundation
12 |
13 | infix operator *& {}
14 | func *& (fill: Array, I: NSInteger) -> Array {
15 | var m = Array()
16 | let length = fill.count-1
17 | for _ in 1...I{
18 | for index in 0...length{
19 | m.append(fill[index])
20 | }
21 | }
22 |
23 | return m
24 | }
25 |
26 | class Matrix {
27 |
28 |
29 | func makeMatrix(I:NSInteger, J:NSInteger)->(Array>){
30 | let NumColumns = I
31 | let NumRows = J
32 | var array = Array>()
33 | for _ in 0..(){
16 | // X = dot(A, X) + dot(B, U)
17 | // P = dot(A, dot(P, A.T)) + Q
18 | //
19 | // return(X,P)
20 | //}
21 | //
22 | //func kf_update(X, P, Y, H, R)->(){
23 | // IM = dot(H, X)
24 | // IS = R + dot(H, dot(P, H.T))
25 | // K = dot(P, dot(H.T, inv(IS)))
26 | // X = X + dot(K, (Y-IM))
27 | // P = P - dot(K, dot(IS, K.T))
28 | // LH = gauss_pdf(Y, IM, IS)
29 | //
30 | // return (X,P,K,IM,IS,LH)
31 | //}
32 | //
33 | //func gauss_pdf(X, M, S)->(){
34 | // if M.shape()[1] == 1:
35 | // DX = X - tile(M, X.shape()[1])
36 | // E = 0.5 * sum(DX * (dot(inv(S), DX)), axis=0)
37 | // E = E + 0.5 * M.shape()[0] * log(2 * pi) + 0.5 * log(det(S))
38 | // P = exp(-E)
39 | // elif X.shape()[1] == 1:
40 | // DX = tile(X, M.shape()[1])- M
41 | // E = 0.5 * sum(DX * (dot(inv(S), DX)), axis=0)
42 | // E = E + 0.5 * M.shape()[0] * log(2 * pi) + 0.5 * log(det(S))
43 | // P = exp(-E)
44 | // else: DX = X-M
45 | // E = 0.5 * dot(DX.T, dot(inv(S), DX))
46 | // E = E + 0.5 * M.shape()[0] * log(2 * pi) + 0.5 * log(det(S))
47 | // P = exp(-E)
48 | //
49 | // return (P[0],E[0])
50 | //}
51 |
--------------------------------------------------------------------------------
/swift-brain-app/swift-brain/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 | LSRequiresIPhoneOS
24 |
25 | UILaunchStoryboardName
26 | LaunchScreen
27 | UIMainStoryboardFile
28 | Main
29 | UIRequiredDeviceCapabilities
30 |
31 | armv7
32 |
33 | UIStatusBarTintParameters
34 |
35 | UINavigationBar
36 |
37 | Style
38 | UIBarStyleDefault
39 | Translucent
40 |
41 |
42 |
43 | UISupportedInterfaceOrientations
44 |
45 | UIInterfaceOrientationPortrait
46 | UIInterfaceOrientationLandscapeLeft
47 | UIInterfaceOrientationLandscapeRight
48 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 |
3 | # Xcode
4 | #
5 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
6 |
7 | ## Build generated
8 | build/
9 | DerivedData/
10 |
11 | ## Various settings
12 | *.pbxuser
13 | !default.pbxuser
14 | *.mode1v3
15 | !default.mode1v3
16 | *.mode2v3
17 | !default.mode2v3
18 | *.perspectivev3
19 | !default.perspectivev3
20 | xcuserdata/
21 |
22 | ## Other
23 | *.moved-aside
24 | *.xcuserstate
25 |
26 | ## Obj-C/Swift specific
27 | *.hmap
28 | *.ipa
29 | *.dSYM.zip
30 | *.dSYM
31 |
32 | ## Playgrounds
33 | timeline.xctimeline
34 | playground.xcworkspace
35 |
36 | # Swift Package Manager
37 | #
38 | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
39 | # Packages/
40 | .build/
41 |
42 | # CocoaPods
43 | #
44 | # We recommend against adding the Pods directory to your .gitignore. However
45 | # you should judge for yourself, the pros and cons are mentioned at:
46 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
47 | #
48 | # Pods/
49 |
50 | # Carthage
51 | #
52 | # Add this line if you want to avoid checking in source code from Carthage dependencies.
53 | # Carthage/Checkouts
54 |
55 | Carthage/Build
56 |
57 | # fastlane
58 | #
59 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
60 | # screenshots whenever they are needed.
61 | # For more information about the recommended setup visit:
62 | # https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md
63 |
64 | fastlane/report.xml
65 | fastlane/Preview.html
66 | fastlane/screenshots
67 | fastlane/test_output
--------------------------------------------------------------------------------
/swift-brain-app/swift-brain/Base.lproj/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/swift-brain-app/swift-brain/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.swift
3 | // swift-brain
4 | //
5 | // Created by V Lall on 10/5/15.
6 | // Copyright © 2015 vlall. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | @UIApplicationMain
12 | class AppDelegate: UIResponder, UIApplicationDelegate {
13 |
14 | var window: UIWindow?
15 |
16 |
17 | func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
18 | // Override point for customization after application launch.
19 | return true
20 | }
21 |
22 | func applicationWillResignActive(application: UIApplication) {
23 | // 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.
24 | // 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.
25 | }
26 |
27 | func applicationDidEnterBackground(application: UIApplication) {
28 | // 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.
29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
30 | }
31 |
32 | func applicationWillEnterForeground(application: UIApplication) {
33 | // 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.
34 | }
35 |
36 | func applicationDidBecomeActive(application: UIApplication) {
37 | // 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.
38 | }
39 |
40 | func applicationWillTerminate(application: UIApplication) {
41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
42 | }
43 |
44 |
45 | }
46 |
47 |
--------------------------------------------------------------------------------
/swift-brain-app/swift-brain.xcodeproj/xcuserdata/Vee.xcuserdatad/xcschemes/swift-brain.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
33 |
39 |
40 |
41 |
43 |
49 |
50 |
51 |
52 |
53 |
59 |
60 |
61 |
62 |
63 |
64 |
74 |
76 |
82 |
83 |
84 |
85 |
86 |
87 |
93 |
95 |
101 |
102 |
103 |
104 |
106 |
107 |
110 |
111 |
112 |
--------------------------------------------------------------------------------
/source/NeuralNetwork.swift:
--------------------------------------------------------------------------------
1 | //
2 | // NeuralNetwork.swift
3 | // Brain
4 | //
5 | // Created by Vishal on 2014-06-08.
6 | // Copyright (c) 2015 Vishal. All rights reserved.
7 | //
8 |
9 | import Foundation
10 |
11 | infix operator ** {}
12 |
13 | func ** (num: Double, power: Double) -> Double{
14 | return pow(num, power)
15 | }
16 |
17 | func randomFunc(a: Double, _ b:Double) -> (Double) {
18 | let randNum = arc4random_uniform(100)/100
19 | let output = (b-a)*Double(randNum) + (a)
20 |
21 | return output
22 | }
23 |
24 | func makeMatrix(I:NSInteger, _ J:NSInteger)->(Array>){
25 | var array = Array>()
26 | for _ in 0..(Double){
35 | return tanh(x)
36 | }
37 |
38 |
39 | // derivative of our sigmoid function
40 | func dsigmoid(x: Double)->(Double){
41 | return 1.0 - x**2.0
42 | }
43 |
44 | class NN {
45 |
46 | // Using default values may break this... You should initialize ni,nh,no
47 | var ni = 2
48 | var nh = 2
49 | var no = 2
50 | var ai = Array()
51 | var ah = Array()
52 | var ao = Array()
53 | var wi = Array>()
54 | var wo = Array>()
55 | var ci = Array>()
56 | var co = Array>()
57 |
58 | init(ni:NSInteger, nh:NSInteger, no:NSInteger) {
59 | // number of input, hidden, and output nodes
60 | self.ni = ni+1 // +1 for bias node
61 | self.nh = nh
62 | self.no = no
63 |
64 | // activations for nodes
65 | self.ai = [1.0]*&self.ni
66 | self.ah = [1.0]*&self.nh
67 | self.ao = [1.0]*&self.no
68 |
69 | //create weights
70 | self.wi = makeMatrix(self.ni, self.nh)
71 | self.wo = makeMatrix(self.nh, self.no)
72 |
73 | for i in 0...(self.ni-1){
74 | for j in 0...(self.nh-1){
75 | self.wi[i][j]=randomFunc(-0.2, 0.2)
76 | }
77 | }
78 |
79 | for j in 0...(self.nh-1){
80 | for k in 0...(self.no-1){
81 | self.wo[j][k] = randomFunc(-2.0, 2.0)
82 | }
83 | }
84 |
85 | // last change in weights for momentum
86 | self.ci = makeMatrix(self.ni, self.nh)
87 | self.co = makeMatrix(self.nh, self.no)
88 |
89 | }
90 |
91 | func update(inputs:Array) -> (Array) {
92 | if (inputs.count != self.ni-1){
93 | print("[NeuralNetwork] wrong number of inputs")
94 | }
95 |
96 | // input activations
97 | // println(inputs)
98 | // println(self.ai)
99 | // println(self.ni)
100 | // println(inputs.count)
101 | // println(self.ni-1)
102 |
103 | for i in 0..<(self.ni-1){
104 | //self.ai[i] = sigmoid(inputs[i])
105 | self.ai[i] = inputs[i]
106 | }
107 | // hidden activations
108 | for j in 1...(self.nh-1){
109 | var sum = 0.0
110 | for i in 1...(self.ni-1){
111 | sum = sum + self.ai[i] * self.wi[i][j]
112 | }
113 |
114 | self.ah[j] = sigmoid(sum)
115 |
116 | }
117 |
118 | // output activations
119 | for k in 1...(self.no-1){
120 | var sum = 0.0
121 | for j in 1...(self.nh-1){
122 | sum = sum + self.ah[j] * self.wo[j][k]
123 | }
124 |
125 | self.ao[k] = sigmoid(sum)
126 | }
127 |
128 | return self.ao
129 | }
130 |
131 | func backPropagate(targets:Array, N:Double, M:Double)->(Double){
132 | if targets.count != self.no{
133 | print("[NeuralNetwork] wrong number of target values")
134 | }
135 |
136 | // calculate error terms for output
137 | var output_deltas = [0.0] *& self.no
138 | for k in 0..<(self.no){
139 | let error = targets[k]-self.ao[k]
140 | output_deltas[k] = dsigmoid(self.ao[k]) * error
141 | }
142 |
143 | // calculate error terms for hidden
144 | var hidden_deltas = [0.0] *& self.nh
145 | for j in 0..<(self.nh){
146 | var error = 0.0
147 | for k in 0..<(self.no){
148 | error = error + output_deltas[k]*self.wo[j][k]
149 | }
150 |
151 | hidden_deltas[j] = dsigmoid(self.ah[j]) * error
152 | }
153 |
154 | // update output weights
155 | for j in 0..<(self.nh){
156 | for k in 0..<(self.no){
157 | let change = output_deltas[k]*self.ah[j]
158 | self.wo[j][k] = self.wo[j][k] + N*change + M*self.co[j][k]
159 | self.co[j][k] = change
160 | //print N*change, M*self.co[j][k]
161 | }
162 | }
163 |
164 | // update input weights
165 | for i in 0..<(self.ni){
166 | for j in 0..<(self.nh){
167 | let change = hidden_deltas[j]*self.ai[i]
168 | self.wi[i][j] = self.wi[i][j] + N*change + M*self.ci[i][j]
169 | self.ci[i][j] = change
170 | }
171 | }
172 |
173 | // calculate error
174 | var error = 0.0
175 | for k in 0...(targets.count){
176 | error = error + 0.5*(targets[k]-self.ao[k])**2
177 | }
178 |
179 | return error
180 | }
181 |
182 | func test(patterns:Array>>)->(){
183 | for _ in 0...patterns.count{
184 | // println("\(patterns[p][0]) -> \(self.update(patterns[p][0]))")
185 | }
186 | }
187 |
188 | func weights() {
189 | print("[NeuralNetwork] Input weights:")
190 | for i in 0..<(self.ni){
191 | print("[NeuralNetwork] \(self.wi[i])")
192 | print("[NeuralNetwork] Output weights:")
193 | }
194 |
195 | for j in 0..<(self.nh){
196 | print("[NeuralNetwork] \(self.wo[j])")
197 | }
198 |
199 | }
200 |
201 | func train(patterns:Array>>, iterations:NSInteger=1000, N:Double=0.5, M:Double=0.1){
202 | // N: learning rate
203 | // M: momentum factor
204 | for i in 0..(){
221 | //Teach network XOR function
222 | var pat = Array>>()
223 |
224 | pat = [
225 | [[0,0], [0]],
226 | [[0,1], [1]],
227 | [[1,0], [1]],
228 | [[1,1], [0]]
229 | ]
230 |
231 | // create a network with two input, two hidden, and one output nodes
232 | let n = NN(ni: 2,nh: 2,no: 1)
233 | // train it with some patterns
234 | n.train(pat)
235 | // test it
236 | n.test(pat)
237 | }
238 |
239 | // let myFirstNN = NN(ni: 10,nh: 10,no: 10)
240 | // var x = [2.0]*&4
241 | // print(demo())
242 |
243 |
244 |
--------------------------------------------------------------------------------
/swift-brain-app/swift-brain/Base.lproj/Main.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
26 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
66 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
--------------------------------------------------------------------------------
/swift-brain-app/swift-brain.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 32FAFFA61D64FD9A00F5EC03 /* mathFunc.swift in Sources */ = {isa = PBXBuildFile; fileRef = 32FAFFA01D64FD9A00F5EC03 /* mathFunc.swift */; };
11 | 32FAFFA71D64FD9A00F5EC03 /* Matrix.swift in Sources */ = {isa = PBXBuildFile; fileRef = 32FAFFA11D64FD9A00F5EC03 /* Matrix.swift */; };
12 | 32FAFFA81D64FD9A00F5EC03 /* NeuralNetwork.swift in Sources */ = {isa = PBXBuildFile; fileRef = 32FAFFA21D64FD9A00F5EC03 /* NeuralNetwork.swift */; };
13 | 32FAFFA91D64FD9A00F5EC03 /* kalman.swift in Sources */ = {isa = PBXBuildFile; fileRef = 32FAFFA41D64FD9A00F5EC03 /* kalman.swift */; };
14 | 32FAFFAA1D64FD9A00F5EC03 /* svm.swift in Sources */ = {isa = PBXBuildFile; fileRef = 32FAFFA51D64FD9A00F5EC03 /* svm.swift */; };
15 | 85A284501BC2FA73001C04AF /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 85A2844F1BC2FA73001C04AF /* AppDelegate.swift */; };
16 | 85A284521BC2FA73001C04AF /* FirstViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 85A284511BC2FA73001C04AF /* FirstViewController.swift */; };
17 | 85A284541BC2FA73001C04AF /* SecondViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 85A284531BC2FA73001C04AF /* SecondViewController.swift */; };
18 | 85A284571BC2FA73001C04AF /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 85A284551BC2FA73001C04AF /* Main.storyboard */; };
19 | 85A284591BC2FA73001C04AF /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 85A284581BC2FA73001C04AF /* Assets.xcassets */; };
20 | 85A2845C1BC2FA73001C04AF /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 85A2845A1BC2FA73001C04AF /* LaunchScreen.storyboard */; };
21 | 85A284671BC2FA73001C04AF /* swift_brainTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 85A284661BC2FA73001C04AF /* swift_brainTests.swift */; };
22 | 85A284721BC2FA73001C04AF /* swift_brainUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 85A284711BC2FA73001C04AF /* swift_brainUITests.swift */; };
23 | /* End PBXBuildFile section */
24 |
25 | /* Begin PBXContainerItemProxy section */
26 | 85A284631BC2FA73001C04AF /* PBXContainerItemProxy */ = {
27 | isa = PBXContainerItemProxy;
28 | containerPortal = 85A284441BC2FA73001C04AF /* Project object */;
29 | proxyType = 1;
30 | remoteGlobalIDString = 85A2844B1BC2FA73001C04AF;
31 | remoteInfo = "swift-brain";
32 | };
33 | 85A2846E1BC2FA73001C04AF /* PBXContainerItemProxy */ = {
34 | isa = PBXContainerItemProxy;
35 | containerPortal = 85A284441BC2FA73001C04AF /* Project object */;
36 | proxyType = 1;
37 | remoteGlobalIDString = 85A2844B1BC2FA73001C04AF;
38 | remoteInfo = "swift-brain";
39 | };
40 | /* End PBXContainerItemProxy section */
41 |
42 | /* Begin PBXFileReference section */
43 | 32FAFFA01D64FD9A00F5EC03 /* mathFunc.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = mathFunc.swift; sourceTree = ""; };
44 | 32FAFFA11D64FD9A00F5EC03 /* Matrix.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Matrix.swift; sourceTree = ""; };
45 | 32FAFFA21D64FD9A00F5EC03 /* NeuralNetwork.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NeuralNetwork.swift; sourceTree = ""; };
46 | 32FAFFA41D64FD9A00F5EC03 /* kalman.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = kalman.swift; sourceTree = ""; };
47 | 32FAFFA51D64FD9A00F5EC03 /* svm.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = svm.swift; sourceTree = ""; };
48 | 85A2844C1BC2FA73001C04AF /* swift-brain.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "swift-brain.app"; sourceTree = BUILT_PRODUCTS_DIR; };
49 | 85A2844F1BC2FA73001C04AF /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; };
50 | 85A284511BC2FA73001C04AF /* FirstViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FirstViewController.swift; sourceTree = ""; };
51 | 85A284531BC2FA73001C04AF /* SecondViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecondViewController.swift; sourceTree = ""; };
52 | 85A284561BC2FA73001C04AF /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; };
53 | 85A284581BC2FA73001C04AF /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
54 | 85A2845B1BC2FA73001C04AF /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; };
55 | 85A2845D1BC2FA73001C04AF /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
56 | 85A284621BC2FA73001C04AF /* swift-brainTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "swift-brainTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
57 | 85A284661BC2FA73001C04AF /* swift_brainTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = swift_brainTests.swift; sourceTree = ""; };
58 | 85A284681BC2FA73001C04AF /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
59 | 85A2846D1BC2FA73001C04AF /* swift-brainUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "swift-brainUITests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
60 | 85A284711BC2FA73001C04AF /* swift_brainUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = swift_brainUITests.swift; sourceTree = ""; };
61 | 85A284731BC2FA73001C04AF /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
62 | /* End PBXFileReference section */
63 |
64 | /* Begin PBXFrameworksBuildPhase section */
65 | 85A284491BC2FA73001C04AF /* Frameworks */ = {
66 | isa = PBXFrameworksBuildPhase;
67 | buildActionMask = 2147483647;
68 | files = (
69 | );
70 | runOnlyForDeploymentPostprocessing = 0;
71 | };
72 | 85A2845F1BC2FA73001C04AF /* Frameworks */ = {
73 | isa = PBXFrameworksBuildPhase;
74 | buildActionMask = 2147483647;
75 | files = (
76 | );
77 | runOnlyForDeploymentPostprocessing = 0;
78 | };
79 | 85A2846A1BC2FA73001C04AF /* Frameworks */ = {
80 | isa = PBXFrameworksBuildPhase;
81 | buildActionMask = 2147483647;
82 | files = (
83 | );
84 | runOnlyForDeploymentPostprocessing = 0;
85 | };
86 | /* End PBXFrameworksBuildPhase section */
87 |
88 | /* Begin PBXGroup section */
89 | 32FAFF9E1D64FD9A00F5EC03 /* source */ = {
90 | isa = PBXGroup;
91 | children = (
92 | 32FAFF9F1D64FD9A00F5EC03 /* math */,
93 | 32FAFFA21D64FD9A00F5EC03 /* NeuralNetwork.swift */,
94 | 32FAFFA31D64FD9A00F5EC03 /* statistics */,
95 | 32FAFFA51D64FD9A00F5EC03 /* svm.swift */,
96 | );
97 | name = source;
98 | path = ../../source;
99 | sourceTree = "";
100 | };
101 | 32FAFF9F1D64FD9A00F5EC03 /* math */ = {
102 | isa = PBXGroup;
103 | children = (
104 | 32FAFFA01D64FD9A00F5EC03 /* mathFunc.swift */,
105 | 32FAFFA11D64FD9A00F5EC03 /* Matrix.swift */,
106 | );
107 | path = math;
108 | sourceTree = "";
109 | };
110 | 32FAFFA31D64FD9A00F5EC03 /* statistics */ = {
111 | isa = PBXGroup;
112 | children = (
113 | 32FAFFA41D64FD9A00F5EC03 /* kalman.swift */,
114 | );
115 | path = statistics;
116 | sourceTree = "";
117 | };
118 | 85A284431BC2FA73001C04AF = {
119 | isa = PBXGroup;
120 | children = (
121 | 85A2844E1BC2FA73001C04AF /* swift-brain */,
122 | 85A284651BC2FA73001C04AF /* swift-brainTests */,
123 | 85A284701BC2FA73001C04AF /* swift-brainUITests */,
124 | 85A2844D1BC2FA73001C04AF /* Products */,
125 | );
126 | sourceTree = "";
127 | };
128 | 85A2844D1BC2FA73001C04AF /* Products */ = {
129 | isa = PBXGroup;
130 | children = (
131 | 85A2844C1BC2FA73001C04AF /* swift-brain.app */,
132 | 85A284621BC2FA73001C04AF /* swift-brainTests.xctest */,
133 | 85A2846D1BC2FA73001C04AF /* swift-brainUITests.xctest */,
134 | );
135 | name = Products;
136 | sourceTree = "";
137 | };
138 | 85A2844E1BC2FA73001C04AF /* swift-brain */ = {
139 | isa = PBXGroup;
140 | children = (
141 | 32FAFF9E1D64FD9A00F5EC03 /* source */,
142 | 85A2844F1BC2FA73001C04AF /* AppDelegate.swift */,
143 | 85A284511BC2FA73001C04AF /* FirstViewController.swift */,
144 | 85A284531BC2FA73001C04AF /* SecondViewController.swift */,
145 | 85A284551BC2FA73001C04AF /* Main.storyboard */,
146 | 85A284581BC2FA73001C04AF /* Assets.xcassets */,
147 | 85A2845A1BC2FA73001C04AF /* LaunchScreen.storyboard */,
148 | 85A2845D1BC2FA73001C04AF /* Info.plist */,
149 | );
150 | path = "swift-brain";
151 | sourceTree = "";
152 | };
153 | 85A284651BC2FA73001C04AF /* swift-brainTests */ = {
154 | isa = PBXGroup;
155 | children = (
156 | 85A284661BC2FA73001C04AF /* swift_brainTests.swift */,
157 | 85A284681BC2FA73001C04AF /* Info.plist */,
158 | );
159 | path = "swift-brainTests";
160 | sourceTree = "";
161 | };
162 | 85A284701BC2FA73001C04AF /* swift-brainUITests */ = {
163 | isa = PBXGroup;
164 | children = (
165 | 85A284711BC2FA73001C04AF /* swift_brainUITests.swift */,
166 | 85A284731BC2FA73001C04AF /* Info.plist */,
167 | );
168 | path = "swift-brainUITests";
169 | sourceTree = "";
170 | };
171 | /* End PBXGroup section */
172 |
173 | /* Begin PBXNativeTarget section */
174 | 85A2844B1BC2FA73001C04AF /* swift-brain */ = {
175 | isa = PBXNativeTarget;
176 | buildConfigurationList = 85A284761BC2FA73001C04AF /* Build configuration list for PBXNativeTarget "swift-brain" */;
177 | buildPhases = (
178 | 85A284481BC2FA73001C04AF /* Sources */,
179 | 85A284491BC2FA73001C04AF /* Frameworks */,
180 | 85A2844A1BC2FA73001C04AF /* Resources */,
181 | );
182 | buildRules = (
183 | );
184 | dependencies = (
185 | );
186 | name = "swift-brain";
187 | productName = "swift-brain";
188 | productReference = 85A2844C1BC2FA73001C04AF /* swift-brain.app */;
189 | productType = "com.apple.product-type.application";
190 | };
191 | 85A284611BC2FA73001C04AF /* swift-brainTests */ = {
192 | isa = PBXNativeTarget;
193 | buildConfigurationList = 85A284791BC2FA73001C04AF /* Build configuration list for PBXNativeTarget "swift-brainTests" */;
194 | buildPhases = (
195 | 85A2845E1BC2FA73001C04AF /* Sources */,
196 | 85A2845F1BC2FA73001C04AF /* Frameworks */,
197 | 85A284601BC2FA73001C04AF /* Resources */,
198 | );
199 | buildRules = (
200 | );
201 | dependencies = (
202 | 85A284641BC2FA73001C04AF /* PBXTargetDependency */,
203 | );
204 | name = "swift-brainTests";
205 | productName = "swift-brainTests";
206 | productReference = 85A284621BC2FA73001C04AF /* swift-brainTests.xctest */;
207 | productType = "com.apple.product-type.bundle.unit-test";
208 | };
209 | 85A2846C1BC2FA73001C04AF /* swift-brainUITests */ = {
210 | isa = PBXNativeTarget;
211 | buildConfigurationList = 85A2847C1BC2FA73001C04AF /* Build configuration list for PBXNativeTarget "swift-brainUITests" */;
212 | buildPhases = (
213 | 85A284691BC2FA73001C04AF /* Sources */,
214 | 85A2846A1BC2FA73001C04AF /* Frameworks */,
215 | 85A2846B1BC2FA73001C04AF /* Resources */,
216 | );
217 | buildRules = (
218 | );
219 | dependencies = (
220 | 85A2846F1BC2FA73001C04AF /* PBXTargetDependency */,
221 | );
222 | name = "swift-brainUITests";
223 | productName = "swift-brainUITests";
224 | productReference = 85A2846D1BC2FA73001C04AF /* swift-brainUITests.xctest */;
225 | productType = "com.apple.product-type.bundle.ui-testing";
226 | };
227 | /* End PBXNativeTarget section */
228 |
229 | /* Begin PBXProject section */
230 | 85A284441BC2FA73001C04AF /* Project object */ = {
231 | isa = PBXProject;
232 | attributes = {
233 | LastUpgradeCheck = 0700;
234 | ORGANIZATIONNAME = vlall;
235 | TargetAttributes = {
236 | 85A2844B1BC2FA73001C04AF = {
237 | CreatedOnToolsVersion = 7.0.1;
238 | };
239 | 85A284611BC2FA73001C04AF = {
240 | CreatedOnToolsVersion = 7.0.1;
241 | TestTargetID = 85A2844B1BC2FA73001C04AF;
242 | };
243 | 85A2846C1BC2FA73001C04AF = {
244 | CreatedOnToolsVersion = 7.0.1;
245 | TestTargetID = 85A2844B1BC2FA73001C04AF;
246 | };
247 | };
248 | };
249 | buildConfigurationList = 85A284471BC2FA73001C04AF /* Build configuration list for PBXProject "swift-brain" */;
250 | compatibilityVersion = "Xcode 3.2";
251 | developmentRegion = English;
252 | hasScannedForEncodings = 0;
253 | knownRegions = (
254 | en,
255 | Base,
256 | );
257 | mainGroup = 85A284431BC2FA73001C04AF;
258 | productRefGroup = 85A2844D1BC2FA73001C04AF /* Products */;
259 | projectDirPath = "";
260 | projectRoot = "";
261 | targets = (
262 | 85A2844B1BC2FA73001C04AF /* swift-brain */,
263 | 85A284611BC2FA73001C04AF /* swift-brainTests */,
264 | 85A2846C1BC2FA73001C04AF /* swift-brainUITests */,
265 | );
266 | };
267 | /* End PBXProject section */
268 |
269 | /* Begin PBXResourcesBuildPhase section */
270 | 85A2844A1BC2FA73001C04AF /* Resources */ = {
271 | isa = PBXResourcesBuildPhase;
272 | buildActionMask = 2147483647;
273 | files = (
274 | 85A2845C1BC2FA73001C04AF /* LaunchScreen.storyboard in Resources */,
275 | 85A284591BC2FA73001C04AF /* Assets.xcassets in Resources */,
276 | 85A284571BC2FA73001C04AF /* Main.storyboard in Resources */,
277 | );
278 | runOnlyForDeploymentPostprocessing = 0;
279 | };
280 | 85A284601BC2FA73001C04AF /* Resources */ = {
281 | isa = PBXResourcesBuildPhase;
282 | buildActionMask = 2147483647;
283 | files = (
284 | );
285 | runOnlyForDeploymentPostprocessing = 0;
286 | };
287 | 85A2846B1BC2FA73001C04AF /* Resources */ = {
288 | isa = PBXResourcesBuildPhase;
289 | buildActionMask = 2147483647;
290 | files = (
291 | );
292 | runOnlyForDeploymentPostprocessing = 0;
293 | };
294 | /* End PBXResourcesBuildPhase section */
295 |
296 | /* Begin PBXSourcesBuildPhase section */
297 | 85A284481BC2FA73001C04AF /* Sources */ = {
298 | isa = PBXSourcesBuildPhase;
299 | buildActionMask = 2147483647;
300 | files = (
301 | 85A284541BC2FA73001C04AF /* SecondViewController.swift in Sources */,
302 | 32FAFFA71D64FD9A00F5EC03 /* Matrix.swift in Sources */,
303 | 32FAFFAA1D64FD9A00F5EC03 /* svm.swift in Sources */,
304 | 32FAFFA91D64FD9A00F5EC03 /* kalman.swift in Sources */,
305 | 85A284501BC2FA73001C04AF /* AppDelegate.swift in Sources */,
306 | 85A284521BC2FA73001C04AF /* FirstViewController.swift in Sources */,
307 | 32FAFFA61D64FD9A00F5EC03 /* mathFunc.swift in Sources */,
308 | 32FAFFA81D64FD9A00F5EC03 /* NeuralNetwork.swift in Sources */,
309 | );
310 | runOnlyForDeploymentPostprocessing = 0;
311 | };
312 | 85A2845E1BC2FA73001C04AF /* Sources */ = {
313 | isa = PBXSourcesBuildPhase;
314 | buildActionMask = 2147483647;
315 | files = (
316 | 85A284671BC2FA73001C04AF /* swift_brainTests.swift in Sources */,
317 | );
318 | runOnlyForDeploymentPostprocessing = 0;
319 | };
320 | 85A284691BC2FA73001C04AF /* Sources */ = {
321 | isa = PBXSourcesBuildPhase;
322 | buildActionMask = 2147483647;
323 | files = (
324 | 85A284721BC2FA73001C04AF /* swift_brainUITests.swift in Sources */,
325 | );
326 | runOnlyForDeploymentPostprocessing = 0;
327 | };
328 | /* End PBXSourcesBuildPhase section */
329 |
330 | /* Begin PBXTargetDependency section */
331 | 85A284641BC2FA73001C04AF /* PBXTargetDependency */ = {
332 | isa = PBXTargetDependency;
333 | target = 85A2844B1BC2FA73001C04AF /* swift-brain */;
334 | targetProxy = 85A284631BC2FA73001C04AF /* PBXContainerItemProxy */;
335 | };
336 | 85A2846F1BC2FA73001C04AF /* PBXTargetDependency */ = {
337 | isa = PBXTargetDependency;
338 | target = 85A2844B1BC2FA73001C04AF /* swift-brain */;
339 | targetProxy = 85A2846E1BC2FA73001C04AF /* PBXContainerItemProxy */;
340 | };
341 | /* End PBXTargetDependency section */
342 |
343 | /* Begin PBXVariantGroup section */
344 | 85A284551BC2FA73001C04AF /* Main.storyboard */ = {
345 | isa = PBXVariantGroup;
346 | children = (
347 | 85A284561BC2FA73001C04AF /* Base */,
348 | );
349 | name = Main.storyboard;
350 | sourceTree = "";
351 | };
352 | 85A2845A1BC2FA73001C04AF /* LaunchScreen.storyboard */ = {
353 | isa = PBXVariantGroup;
354 | children = (
355 | 85A2845B1BC2FA73001C04AF /* Base */,
356 | );
357 | name = LaunchScreen.storyboard;
358 | sourceTree = "";
359 | };
360 | /* End PBXVariantGroup section */
361 |
362 | /* Begin XCBuildConfiguration section */
363 | 85A284741BC2FA73001C04AF /* Debug */ = {
364 | isa = XCBuildConfiguration;
365 | buildSettings = {
366 | ALWAYS_SEARCH_USER_PATHS = NO;
367 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
368 | CLANG_CXX_LIBRARY = "libc++";
369 | CLANG_ENABLE_MODULES = YES;
370 | CLANG_ENABLE_OBJC_ARC = YES;
371 | CLANG_WARN_BOOL_CONVERSION = YES;
372 | CLANG_WARN_CONSTANT_CONVERSION = YES;
373 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
374 | CLANG_WARN_EMPTY_BODY = YES;
375 | CLANG_WARN_ENUM_CONVERSION = YES;
376 | CLANG_WARN_INT_CONVERSION = YES;
377 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
378 | CLANG_WARN_UNREACHABLE_CODE = YES;
379 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
380 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
381 | COPY_PHASE_STRIP = NO;
382 | DEBUG_INFORMATION_FORMAT = dwarf;
383 | ENABLE_STRICT_OBJC_MSGSEND = YES;
384 | ENABLE_TESTABILITY = YES;
385 | GCC_C_LANGUAGE_STANDARD = gnu99;
386 | GCC_DYNAMIC_NO_PIC = NO;
387 | GCC_NO_COMMON_BLOCKS = YES;
388 | GCC_OPTIMIZATION_LEVEL = 0;
389 | GCC_PREPROCESSOR_DEFINITIONS = (
390 | "DEBUG=1",
391 | "$(inherited)",
392 | );
393 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
394 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
395 | GCC_WARN_UNDECLARED_SELECTOR = YES;
396 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
397 | GCC_WARN_UNUSED_FUNCTION = YES;
398 | GCC_WARN_UNUSED_VARIABLE = YES;
399 | IPHONEOS_DEPLOYMENT_TARGET = 9.0;
400 | MTL_ENABLE_DEBUG_INFO = YES;
401 | ONLY_ACTIVE_ARCH = YES;
402 | SDKROOT = iphoneos;
403 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
404 | };
405 | name = Debug;
406 | };
407 | 85A284751BC2FA73001C04AF /* Release */ = {
408 | isa = XCBuildConfiguration;
409 | buildSettings = {
410 | ALWAYS_SEARCH_USER_PATHS = NO;
411 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
412 | CLANG_CXX_LIBRARY = "libc++";
413 | CLANG_ENABLE_MODULES = YES;
414 | CLANG_ENABLE_OBJC_ARC = YES;
415 | CLANG_WARN_BOOL_CONVERSION = YES;
416 | CLANG_WARN_CONSTANT_CONVERSION = YES;
417 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
418 | CLANG_WARN_EMPTY_BODY = YES;
419 | CLANG_WARN_ENUM_CONVERSION = YES;
420 | CLANG_WARN_INT_CONVERSION = YES;
421 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
422 | CLANG_WARN_UNREACHABLE_CODE = YES;
423 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
424 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
425 | COPY_PHASE_STRIP = NO;
426 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
427 | ENABLE_NS_ASSERTIONS = NO;
428 | ENABLE_STRICT_OBJC_MSGSEND = YES;
429 | GCC_C_LANGUAGE_STANDARD = gnu99;
430 | GCC_NO_COMMON_BLOCKS = YES;
431 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
432 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
433 | GCC_WARN_UNDECLARED_SELECTOR = YES;
434 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
435 | GCC_WARN_UNUSED_FUNCTION = YES;
436 | GCC_WARN_UNUSED_VARIABLE = YES;
437 | IPHONEOS_DEPLOYMENT_TARGET = 9.0;
438 | MTL_ENABLE_DEBUG_INFO = NO;
439 | SDKROOT = iphoneos;
440 | VALIDATE_PRODUCT = YES;
441 | };
442 | name = Release;
443 | };
444 | 85A284771BC2FA73001C04AF /* Debug */ = {
445 | isa = XCBuildConfiguration;
446 | buildSettings = {
447 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
448 | INFOPLIST_FILE = "swift-brain/Info.plist";
449 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
450 | PRODUCT_BUNDLE_IDENTIFIER = "com.vlall.swift-brain";
451 | PRODUCT_NAME = "$(TARGET_NAME)";
452 | };
453 | name = Debug;
454 | };
455 | 85A284781BC2FA73001C04AF /* Release */ = {
456 | isa = XCBuildConfiguration;
457 | buildSettings = {
458 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
459 | INFOPLIST_FILE = "swift-brain/Info.plist";
460 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
461 | PRODUCT_BUNDLE_IDENTIFIER = "com.vlall.swift-brain";
462 | PRODUCT_NAME = "$(TARGET_NAME)";
463 | };
464 | name = Release;
465 | };
466 | 85A2847A1BC2FA73001C04AF /* Debug */ = {
467 | isa = XCBuildConfiguration;
468 | buildSettings = {
469 | BUNDLE_LOADER = "$(TEST_HOST)";
470 | INFOPLIST_FILE = "swift-brainTests/Info.plist";
471 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
472 | PRODUCT_BUNDLE_IDENTIFIER = "com.vlall.swift-brainTests";
473 | PRODUCT_NAME = "$(TARGET_NAME)";
474 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/swift-brain.app/swift-brain";
475 | };
476 | name = Debug;
477 | };
478 | 85A2847B1BC2FA73001C04AF /* Release */ = {
479 | isa = XCBuildConfiguration;
480 | buildSettings = {
481 | BUNDLE_LOADER = "$(TEST_HOST)";
482 | INFOPLIST_FILE = "swift-brainTests/Info.plist";
483 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
484 | PRODUCT_BUNDLE_IDENTIFIER = "com.vlall.swift-brainTests";
485 | PRODUCT_NAME = "$(TARGET_NAME)";
486 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/swift-brain.app/swift-brain";
487 | };
488 | name = Release;
489 | };
490 | 85A2847D1BC2FA73001C04AF /* Debug */ = {
491 | isa = XCBuildConfiguration;
492 | buildSettings = {
493 | INFOPLIST_FILE = "swift-brainUITests/Info.plist";
494 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
495 | PRODUCT_BUNDLE_IDENTIFIER = "com.vlall.swift-brainUITests";
496 | PRODUCT_NAME = "$(TARGET_NAME)";
497 | TEST_TARGET_NAME = "swift-brain";
498 | USES_XCTRUNNER = YES;
499 | };
500 | name = Debug;
501 | };
502 | 85A2847E1BC2FA73001C04AF /* Release */ = {
503 | isa = XCBuildConfiguration;
504 | buildSettings = {
505 | INFOPLIST_FILE = "swift-brainUITests/Info.plist";
506 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
507 | PRODUCT_BUNDLE_IDENTIFIER = "com.vlall.swift-brainUITests";
508 | PRODUCT_NAME = "$(TARGET_NAME)";
509 | TEST_TARGET_NAME = "swift-brain";
510 | USES_XCTRUNNER = YES;
511 | };
512 | name = Release;
513 | };
514 | /* End XCBuildConfiguration section */
515 |
516 | /* Begin XCConfigurationList section */
517 | 85A284471BC2FA73001C04AF /* Build configuration list for PBXProject "swift-brain" */ = {
518 | isa = XCConfigurationList;
519 | buildConfigurations = (
520 | 85A284741BC2FA73001C04AF /* Debug */,
521 | 85A284751BC2FA73001C04AF /* Release */,
522 | );
523 | defaultConfigurationIsVisible = 0;
524 | defaultConfigurationName = Release;
525 | };
526 | 85A284761BC2FA73001C04AF /* Build configuration list for PBXNativeTarget "swift-brain" */ = {
527 | isa = XCConfigurationList;
528 | buildConfigurations = (
529 | 85A284771BC2FA73001C04AF /* Debug */,
530 | 85A284781BC2FA73001C04AF /* Release */,
531 | );
532 | defaultConfigurationIsVisible = 0;
533 | defaultConfigurationName = Release;
534 | };
535 | 85A284791BC2FA73001C04AF /* Build configuration list for PBXNativeTarget "swift-brainTests" */ = {
536 | isa = XCConfigurationList;
537 | buildConfigurations = (
538 | 85A2847A1BC2FA73001C04AF /* Debug */,
539 | 85A2847B1BC2FA73001C04AF /* Release */,
540 | );
541 | defaultConfigurationIsVisible = 0;
542 | defaultConfigurationName = Release;
543 | };
544 | 85A2847C1BC2FA73001C04AF /* Build configuration list for PBXNativeTarget "swift-brainUITests" */ = {
545 | isa = XCConfigurationList;
546 | buildConfigurations = (
547 | 85A2847D1BC2FA73001C04AF /* Debug */,
548 | 85A2847E1BC2FA73001C04AF /* Release */,
549 | );
550 | defaultConfigurationIsVisible = 0;
551 | defaultConfigurationName = Release;
552 | };
553 | /* End XCConfigurationList section */
554 | };
555 | rootObject = 85A284441BC2FA73001C04AF /* Project object */;
556 | }
557 |
--------------------------------------------------------------------------------