Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions LICENCE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2016

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
7 changes: 6 additions & 1 deletion MVVM.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@
attributes = {
LastSwiftMigration = 0710;
LastSwiftUpdateCheck = 0710;
LastUpgradeCheck = 0630;
LastUpgradeCheck = 0730;
ORGANIZATIONNAME = "Carlos García";
TargetAttributes = {
07ACCA2C1AD523EE006D228C = {
Expand Down Expand Up @@ -334,6 +334,7 @@
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
Expand Down Expand Up @@ -400,6 +401,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
INFOPLIST_FILE = MVVM/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.cgn.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Debug;
Expand All @@ -410,6 +412,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
INFOPLIST_FILE = MVVM/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.cgn.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Release;
Expand All @@ -428,6 +431,7 @@
);
INFOPLIST_FILE = MVVMTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.cgn.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/MVVM.app/MVVM";
};
Expand All @@ -443,6 +447,7 @@
);
INFOPLIST_FILE = MVVMTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.cgn.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/MVVM.app/MVVM";
};
Expand Down
Binary file not shown.
101 changes: 101 additions & 0 deletions MVVM.xcodeproj/xcuserdata/vle.xcuserdatad/xcschemes/MVVM.xcscheme
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0730"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "07ACCA2C1AD523EE006D228C"
BuildableName = "MVVM.app"
BlueprintName = "MVVM"
ReferencedContainer = "container:MVVM.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "07ACCA441AD523EF006D228C"
BuildableName = "MVVMTests.xctest"
BlueprintName = "MVVMTests"
ReferencedContainer = "container:MVVM.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "07ACCA2C1AD523EE006D228C"
BuildableName = "MVVM.app"
BlueprintName = "MVVM"
ReferencedContainer = "container:MVVM.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "07ACCA2C1AD523EE006D228C"
BuildableName = "MVVM.app"
BlueprintName = "MVVM"
ReferencedContainer = "container:MVVM.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "07ACCA2C1AD523EE006D228C"
BuildableName = "MVVM.app"
BlueprintName = "MVVM"
ReferencedContainer = "container:MVVM.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>MVVM.xcscheme</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>
<dict>
<key>07ACCA2C1AD523EE006D228C</key>
<dict>
<key>primary</key>
<true/>
</dict>
<key>07ACCA441AD523EF006D228C</key>
<dict>
<key>primary</key>
<true/>
</dict>
</dict>
</dict>
</plist>
8 changes: 0 additions & 8 deletions MVVM/AppDelegate.swift
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
//
// AppDelegate.swift
// MVVM
//
// Created by carlos on 8/4/15.
// Copyright (c) 2015 Carlos García. All rights reserved.
//

import UIKit
import CoreData

Expand Down
1 change: 0 additions & 1 deletion MVVM/Context.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

import Foundation

public class Context {
Expand Down
16 changes: 3 additions & 13 deletions MVVM/DetailViewController.swift
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
//
// AddViewController.swift
// MVVM
//
// Created by carlos on 8/4/15.
// Copyright (c) 2015 Carlos García. All rights reserved.
//

import UIKit

class DetailViewController: UIViewController, DetailViewModelDelegate {
Expand All @@ -20,10 +12,11 @@ class DetailViewController: UIViewController, DetailViewModelDelegate {
navigationItem.title = viewModel.title
nameField.text = viewModel.name
amountField.text = viewModel.amount
amountField.keyboardType = .NumberPad
nameField.becomeFirstResponder()

nameField.addTarget(self, action: "nameChanged", forControlEvents: UIControlEvents.EditingChanged)
amountField.addTarget(self, action: "ammountChanged", forControlEvents: UIControlEvents.EditingChanged)
nameField.addTarget(self, action: #selector(nameChanged), forControlEvents: UIControlEvents.EditingChanged)
amountField.addTarget(self, action: #selector(ammountChanged), forControlEvents: UIControlEvents.EditingChanged)
}

func nameChanged() {
Expand All @@ -36,7 +29,6 @@ class DetailViewController: UIViewController, DetailViewModelDelegate {
resultLabel.text = viewModel.infoText
}


// MARK: - AddViewModelDelegate

func showInvalidName() {
Expand All @@ -53,8 +45,6 @@ class DetailViewController: UIViewController, DetailViewModelDelegate {
navigationController?.popViewControllerAnimated(true)
}



// MARK: - IBActions

@IBAction func cancelPressed(sender: AnyObject) {
Expand Down
2 changes: 0 additions & 2 deletions MVVM/DetailViewModel.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

import Foundation

public class DetailViewModel {
Expand All @@ -10,7 +9,6 @@ public class DetailViewModel {
public weak var delegate: DetailViewModelDelegate?

public var infoText: String {
let names = nameComponents
let amount = (self.amount as NSString).doubleValue
return "\(name)\n\(amount)"
}
Expand Down
2 changes: 1 addition & 1 deletion MVVM/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>com.cgn.$(PRODUCT_NAME:rfc1034identifier)</string>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
Expand Down
1 change: 0 additions & 1 deletion MVVM/ListViewModel.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

import Foundation

public class ListViewModel {
Expand Down
8 changes: 0 additions & 8 deletions MVVM/MasterTableViewController.swift
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
//
// MasterTableViewController.swift
// MVVM
//
// Created by carlos on 8/4/15.
// Copyright (c) 2015 Carlos García. All rights reserved.
//

import UIKit

class MasterTableViewController: UITableViewController {
Expand Down
2 changes: 0 additions & 2 deletions MVVM/Payback.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

import Foundation

class Payback: Equatable {
Expand All @@ -16,7 +15,6 @@ class Payback: Equatable {
self.updatedAt = createdAt
self.amount = amount
}

}

func ==(l: Payback, r: Payback) -> Bool {
Expand Down
2 changes: 1 addition & 1 deletion MVVMTests/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>com.cgn.$(PRODUCT_NAME:rfc1034identifier)</string>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
Expand Down