From cb805086e4ff0b6a680c737e05fd599c2e5a2f8c Mon Sep 17 00:00:00 2001 From: Patrick Rengifo Date: Thu, 14 Sep 2017 15:57:14 -0400 Subject: [PATCH 1/7] Widget schema creation --- VEF Exchange.xcodeproj/project.pbxproj | 155 ++++++++++++++++++ .../Base.lproj/MainInterface.storyboard | 44 +++++ VEF Widget/Info.plist | 31 ++++ VEF Widget/TodayViewController.swift | 34 ++++ 4 files changed, 264 insertions(+) create mode 100644 VEF Widget/Base.lproj/MainInterface.storyboard create mode 100644 VEF Widget/Info.plist create mode 100644 VEF Widget/TodayViewController.swift diff --git a/VEF Exchange.xcodeproj/project.pbxproj b/VEF Exchange.xcodeproj/project.pbxproj index 1f20d4f..8f07545 100644 --- a/VEF Exchange.xcodeproj/project.pbxproj +++ b/VEF Exchange.xcodeproj/project.pbxproj @@ -12,8 +12,36 @@ B00E77401F6B138B00649500 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = B00E773E1F6B138B00649500 /* Main.storyboard */; }; B00E77421F6B138B00649500 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = B00E77411F6B138B00649500 /* Assets.xcassets */; }; B00E77451F6B138B00649500 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = B00E77431F6B138B00649500 /* LaunchScreen.storyboard */; }; + B00E77531F6B164100649500 /* NotificationCenter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B00E77521F6B164100649500 /* NotificationCenter.framework */; }; + B00E77561F6B164100649500 /* TodayViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B00E77551F6B164100649500 /* TodayViewController.swift */; }; + B00E77591F6B164100649500 /* MainInterface.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = B00E77571F6B164100649500 /* MainInterface.storyboard */; }; + B00E775D1F6B164100649500 /* VEF Widget.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = B00E77501F6B164100649500 /* VEF Widget.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; /* End PBXBuildFile section */ +/* Begin PBXContainerItemProxy section */ + B00E775B1F6B164100649500 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = B00E772F1F6B138B00649500 /* Project object */; + proxyType = 1; + remoteGlobalIDString = B00E774F1F6B164100649500; + remoteInfo = "VEF Widget"; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXCopyFilesBuildPhase section */ + B00E77611F6B164100649500 /* Embed App Extensions */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 13; + files = ( + B00E775D1F6B164100649500 /* VEF Widget.appex in Embed App Extensions */, + ); + name = "Embed App Extensions"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + /* Begin PBXFileReference section */ B00E77371F6B138B00649500 /* VEF Exchange.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "VEF Exchange.app"; sourceTree = BUILT_PRODUCTS_DIR; }; B00E773A1F6B138B00649500 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; @@ -22,6 +50,11 @@ B00E77411F6B138B00649500 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; B00E77441F6B138B00649500 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; B00E77461F6B138B00649500 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + B00E77501F6B164100649500 /* VEF Widget.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = "VEF Widget.appex"; sourceTree = BUILT_PRODUCTS_DIR; }; + B00E77521F6B164100649500 /* NotificationCenter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = NotificationCenter.framework; path = System/Library/Frameworks/NotificationCenter.framework; sourceTree = SDKROOT; }; + B00E77551F6B164100649500 /* TodayViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TodayViewController.swift; sourceTree = ""; }; + B00E77581F6B164100649500 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/MainInterface.storyboard; sourceTree = ""; }; + B00E775A1F6B164100649500 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -32,6 +65,14 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + B00E774D1F6B164100649500 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + B00E77531F6B164100649500 /* NotificationCenter.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ @@ -39,6 +80,8 @@ isa = PBXGroup; children = ( B00E77391F6B138B00649500 /* VEF Exchange */, + B00E77541F6B164100649500 /* VEF Widget */, + B00E77511F6B164100649500 /* Frameworks */, B00E77381F6B138B00649500 /* Products */, ); sourceTree = ""; @@ -47,6 +90,7 @@ isa = PBXGroup; children = ( B00E77371F6B138B00649500 /* VEF Exchange.app */, + B00E77501F6B164100649500 /* VEF Widget.appex */, ); name = Products; sourceTree = ""; @@ -64,6 +108,24 @@ path = "VEF Exchange"; sourceTree = ""; }; + B00E77511F6B164100649500 /* Frameworks */ = { + isa = PBXGroup; + children = ( + B00E77521F6B164100649500 /* NotificationCenter.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + B00E77541F6B164100649500 /* VEF Widget */ = { + isa = PBXGroup; + children = ( + B00E77551F6B164100649500 /* TodayViewController.swift */, + B00E77571F6B164100649500 /* MainInterface.storyboard */, + B00E775A1F6B164100649500 /* Info.plist */, + ); + path = "VEF Widget"; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -74,16 +136,35 @@ B00E77331F6B138B00649500 /* Sources */, B00E77341F6B138B00649500 /* Frameworks */, B00E77351F6B138B00649500 /* Resources */, + B00E77611F6B164100649500 /* Embed App Extensions */, ); buildRules = ( ); dependencies = ( + B00E775C1F6B164100649500 /* PBXTargetDependency */, ); name = "VEF Exchange"; productName = "VEF Exchange"; productReference = B00E77371F6B138B00649500 /* VEF Exchange.app */; productType = "com.apple.product-type.application"; }; + B00E774F1F6B164100649500 /* VEF Widget */ = { + isa = PBXNativeTarget; + buildConfigurationList = B00E775E1F6B164100649500 /* Build configuration list for PBXNativeTarget "VEF Widget" */; + buildPhases = ( + B00E774C1F6B164100649500 /* Sources */, + B00E774D1F6B164100649500 /* Frameworks */, + B00E774E1F6B164100649500 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "VEF Widget"; + productName = "VEF Widget"; + productReference = B00E77501F6B164100649500 /* VEF Widget.appex */; + productType = "com.apple.product-type.app-extension"; + }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ @@ -99,6 +180,11 @@ DevelopmentTeam = 88RQDVG2WX; ProvisioningStyle = Automatic; }; + B00E774F1F6B164100649500 = { + CreatedOnToolsVersion = 8.3.2; + DevelopmentTeam = 88RQDVG2WX; + ProvisioningStyle = Automatic; + }; }; }; buildConfigurationList = B00E77321F6B138B00649500 /* Build configuration list for PBXProject "VEF Exchange" */; @@ -115,6 +201,7 @@ projectRoot = ""; targets = ( B00E77361F6B138B00649500 /* VEF Exchange */, + B00E774F1F6B164100649500 /* VEF Widget */, ); }; /* End PBXProject section */ @@ -130,6 +217,14 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + B00E774E1F6B164100649500 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + B00E77591F6B164100649500 /* MainInterface.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ @@ -142,8 +237,24 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + B00E774C1F6B164100649500 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + B00E77561F6B164100649500 /* TodayViewController.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXSourcesBuildPhase section */ +/* Begin PBXTargetDependency section */ + B00E775C1F6B164100649500 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = B00E774F1F6B164100649500 /* VEF Widget */; + targetProxy = B00E775B1F6B164100649500 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + /* Begin PBXVariantGroup section */ B00E773E1F6B138B00649500 /* Main.storyboard */ = { isa = PBXVariantGroup; @@ -161,6 +272,14 @@ name = LaunchScreen.storyboard; sourceTree = ""; }; + B00E77571F6B164100649500 /* MainInterface.storyboard */ = { + isa = PBXVariantGroup; + children = ( + B00E77581F6B164100649500 /* Base */, + ); + name = MainInterface.storyboard; + sourceTree = ""; + }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ @@ -262,6 +381,7 @@ B00E774A1F6B138B00649500 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; DEVELOPMENT_TEAM = 88RQDVG2WX; INFOPLIST_FILE = "VEF Exchange/Info.plist"; @@ -275,6 +395,7 @@ B00E774B1F6B138B00649500 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; DEVELOPMENT_TEAM = 88RQDVG2WX; INFOPLIST_FILE = "VEF Exchange/Info.plist"; @@ -285,6 +406,32 @@ }; name = Release; }; + B00E775F1F6B164100649500 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + DEVELOPMENT_TEAM = 88RQDVG2WX; + INFOPLIST_FILE = "VEF Widget/Info.plist"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "com.prengifo.VEF-Exchange.VEF-Widget"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + SWIFT_VERSION = 3.0; + }; + name = Debug; + }; + B00E77601F6B164100649500 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + DEVELOPMENT_TEAM = 88RQDVG2WX; + INFOPLIST_FILE = "VEF Widget/Info.plist"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "com.prengifo.VEF-Exchange.VEF-Widget"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + SWIFT_VERSION = 3.0; + }; + name = Release; + }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ @@ -305,6 +452,14 @@ ); defaultConfigurationIsVisible = 0; }; + B00E775E1F6B164100649500 /* Build configuration list for PBXNativeTarget "VEF Widget" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + B00E775F1F6B164100649500 /* Debug */, + B00E77601F6B164100649500 /* Release */, + ); + defaultConfigurationIsVisible = 0; + }; /* End XCConfigurationList section */ }; rootObject = B00E772F1F6B138B00649500 /* Project object */; diff --git a/VEF Widget/Base.lproj/MainInterface.storyboard b/VEF Widget/Base.lproj/MainInterface.storyboard new file mode 100644 index 0000000..25f5609 --- /dev/null +++ b/VEF Widget/Base.lproj/MainInterface.storyboard @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/VEF Widget/Info.plist b/VEF Widget/Info.plist new file mode 100644 index 0000000..cd0ce02 --- /dev/null +++ b/VEF Widget/Info.plist @@ -0,0 +1,31 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleDisplayName + VEF Widget + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + XPC! + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + NSExtension + + NSExtensionMainStoryboard + MainInterface + NSExtensionPointIdentifier + com.apple.widget-extension + + + diff --git a/VEF Widget/TodayViewController.swift b/VEF Widget/TodayViewController.swift new file mode 100644 index 0000000..7a1d998 --- /dev/null +++ b/VEF Widget/TodayViewController.swift @@ -0,0 +1,34 @@ +// +// TodayViewController.swift +// VEF Widget +// +// Created by Patrick Rengifo on 9/14/17. +// Copyright © 2017 Patrick Rengifo. All rights reserved. +// + +import UIKit +import NotificationCenter + +class TodayViewController: UIViewController, NCWidgetProviding { + + override func viewDidLoad() { + super.viewDidLoad() + // Do any additional setup after loading the view from its nib. + } + + override func didReceiveMemoryWarning() { + super.didReceiveMemoryWarning() + // Dispose of any resources that can be recreated. + } + + func widgetPerformUpdate(completionHandler: (@escaping (NCUpdateResult) -> Void)) { + // Perform any setup necessary in order to update the view. + + // If an error is encountered, use NCUpdateResult.Failed + // If there's no update required, use NCUpdateResult.NoData + // If there's an update, use NCUpdateResult.NewData + + completionHandler(NCUpdateResult.newData) + } + +} From 99ba92bb8055207f6335cab0c4ee10c954547d52 Mon Sep 17 00:00:00 2001 From: Patrick Rengifo Date: Thu, 14 Sep 2017 16:09:24 -0400 Subject: [PATCH 2/7] Design for the widget --- .../Base.lproj/MainInterface.storyboard | 88 +++++++++++++++---- 1 file changed, 73 insertions(+), 15 deletions(-) diff --git a/VEF Widget/Base.lproj/MainInterface.storyboard b/VEF Widget/Base.lproj/MainInterface.storyboard index 25f5609..db9b17e 100644 --- a/VEF Widget/Base.lproj/MainInterface.storyboard +++ b/VEF Widget/Base.lproj/MainInterface.storyboard @@ -1,33 +1,90 @@ - - + + + + + - + + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + @@ -35,10 +92,11 @@ - + + From 67d7d39e72ca7a171bd414f752b40d240159bfc7 Mon Sep 17 00:00:00 2001 From: Patrick Rengifo Date: Thu, 14 Sep 2017 16:13:25 -0400 Subject: [PATCH 3/7] Variables and font change --- VEF Widget/Base.lproj/MainInterface.storyboard | 17 +++++++++++------ VEF Widget/TodayViewController.swift | 4 ++++ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/VEF Widget/Base.lproj/MainInterface.storyboard b/VEF Widget/Base.lproj/MainInterface.storyboard index db9b17e..64f374c 100644 --- a/VEF Widget/Base.lproj/MainInterface.storyboard +++ b/VEF Widget/Base.lproj/MainInterface.storyboard @@ -29,13 +29,13 @@ @@ -46,13 +46,13 @@ @@ -63,13 +63,13 @@ @@ -93,6 +93,11 @@ + + + + + diff --git a/VEF Widget/TodayViewController.swift b/VEF Widget/TodayViewController.swift index 7a1d998..3d0693b 100644 --- a/VEF Widget/TodayViewController.swift +++ b/VEF Widget/TodayViewController.swift @@ -11,6 +11,10 @@ import NotificationCenter class TodayViewController: UIViewController, NCWidgetProviding { + @IBOutlet weak var dolarTodayLabel: UILabel! + @IBOutlet weak var localBitcoinsLabel: UILabel! + @IBOutlet weak var usdBitcoinLabel: UILabel! + override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view from its nib. From 330d7757a0267c9445c5b5c93140efd659bbf57a Mon Sep 17 00:00:00 2001 From: Patrick Rengifo Date: Thu, 14 Sep 2017 16:23:49 -0400 Subject: [PATCH 4/7] Pods for Alamofire and SwiftyJson --- Podfile | 20 ++++ Podfile.lock | 15 +++ VEF Exchange.xcodeproj/project.pbxproj | 111 ++++++++++++++++++ .../contents.xcworkspacedata | 10 ++ 4 files changed, 156 insertions(+) create mode 100644 Podfile create mode 100644 Podfile.lock create mode 100644 VEF Exchange.xcworkspace/contents.xcworkspacedata diff --git a/Podfile b/Podfile new file mode 100644 index 0000000..1587ccf --- /dev/null +++ b/Podfile @@ -0,0 +1,20 @@ +# Uncomment the next line to define a global platform for your project +# platform :ios, '9.0' + +target 'VEF Exchange' do + # Comment the next line if you're not using Swift and don't want to use dynamic frameworks + use_frameworks! + + # Pods for VEF Exchange + +end + +target 'VEF Widget' do + # Comment the next line if you're not using Swift and don't want to use dynamic frameworks + use_frameworks! + + # Pods for VEF Widget + pod 'Alamofire', '~> 4.5' + pod 'SwiftyJSON' + +end diff --git a/Podfile.lock b/Podfile.lock new file mode 100644 index 0000000..1b427d5 --- /dev/null +++ b/Podfile.lock @@ -0,0 +1,15 @@ +PODS: + - Alamofire (4.5.1) + - SwiftyJSON (3.1.4) + +DEPENDENCIES: + - Alamofire (~> 4.5) + - SwiftyJSON + +SPEC CHECKSUMS: + Alamofire: 2d95912bf4c34f164fdfc335872e8c312acaea4a + SwiftyJSON: c2842d878f95482ffceec5709abc3d05680c0220 + +PODFILE CHECKSUM: 4734be76182f6dc417b9df50051c9153735fcad1 + +COCOAPODS: 1.2.1 diff --git a/VEF Exchange.xcodeproj/project.pbxproj b/VEF Exchange.xcodeproj/project.pbxproj index 8f07545..c9ddff5 100644 --- a/VEF Exchange.xcodeproj/project.pbxproj +++ b/VEF Exchange.xcodeproj/project.pbxproj @@ -7,6 +7,8 @@ objects = { /* Begin PBXBuildFile section */ + 5FD697A21DF88C4226D11AE7 /* Pods_VEF_Widget.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BF08E87D05AF0B03BC81948E /* Pods_VEF_Widget.framework */; }; + 856660A9E0D181F07663159D /* Pods_VEF_Exchange.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3C4E52B0205A1B22BD40E505 /* Pods_VEF_Exchange.framework */; }; B00E773B1F6B138B00649500 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = B00E773A1F6B138B00649500 /* AppDelegate.swift */; }; B00E773D1F6B138B00649500 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B00E773C1F6B138B00649500 /* ViewController.swift */; }; B00E77401F6B138B00649500 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = B00E773E1F6B138B00649500 /* Main.storyboard */; }; @@ -43,6 +45,9 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + 17BDEB85C9B3EFF38F25851D /* Pods-VEF Widget.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-VEF Widget.release.xcconfig"; path = "Pods/Target Support Files/Pods-VEF Widget/Pods-VEF Widget.release.xcconfig"; sourceTree = ""; }; + 3C4E52B0205A1B22BD40E505 /* Pods_VEF_Exchange.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_VEF_Exchange.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 84DBBA801C349BF63C36AFD7 /* Pods-VEF Widget.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-VEF Widget.debug.xcconfig"; path = "Pods/Target Support Files/Pods-VEF Widget/Pods-VEF Widget.debug.xcconfig"; sourceTree = ""; }; B00E77371F6B138B00649500 /* VEF Exchange.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "VEF Exchange.app"; sourceTree = BUILT_PRODUCTS_DIR; }; B00E773A1F6B138B00649500 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; B00E773C1F6B138B00649500 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; @@ -55,6 +60,9 @@ B00E77551F6B164100649500 /* TodayViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TodayViewController.swift; sourceTree = ""; }; B00E77581F6B164100649500 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/MainInterface.storyboard; sourceTree = ""; }; B00E775A1F6B164100649500 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + BF08E87D05AF0B03BC81948E /* Pods_VEF_Widget.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_VEF_Widget.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + C57CA29698C938B363115044 /* Pods-VEF Exchange.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-VEF Exchange.release.xcconfig"; path = "Pods/Target Support Files/Pods-VEF Exchange/Pods-VEF Exchange.release.xcconfig"; sourceTree = ""; }; + E2869EF7CFC31588F4DC6622 /* Pods-VEF Exchange.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-VEF Exchange.debug.xcconfig"; path = "Pods/Target Support Files/Pods-VEF Exchange/Pods-VEF Exchange.debug.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -62,6 +70,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 856660A9E0D181F07663159D /* Pods_VEF_Exchange.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -70,12 +79,24 @@ buildActionMask = 2147483647; files = ( B00E77531F6B164100649500 /* NotificationCenter.framework in Frameworks */, + 5FD697A21DF88C4226D11AE7 /* Pods_VEF_Widget.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 57406BB83DE1BDCA683CF5E4 /* Pods */ = { + isa = PBXGroup; + children = ( + E2869EF7CFC31588F4DC6622 /* Pods-VEF Exchange.debug.xcconfig */, + C57CA29698C938B363115044 /* Pods-VEF Exchange.release.xcconfig */, + 84DBBA801C349BF63C36AFD7 /* Pods-VEF Widget.debug.xcconfig */, + 17BDEB85C9B3EFF38F25851D /* Pods-VEF Widget.release.xcconfig */, + ); + name = Pods; + sourceTree = ""; + }; B00E772E1F6B138B00649500 = { isa = PBXGroup; children = ( @@ -83,6 +104,7 @@ B00E77541F6B164100649500 /* VEF Widget */, B00E77511F6B164100649500 /* Frameworks */, B00E77381F6B138B00649500 /* Products */, + 57406BB83DE1BDCA683CF5E4 /* Pods */, ); sourceTree = ""; }; @@ -112,6 +134,8 @@ isa = PBXGroup; children = ( B00E77521F6B164100649500 /* NotificationCenter.framework */, + 3C4E52B0205A1B22BD40E505 /* Pods_VEF_Exchange.framework */, + BF08E87D05AF0B03BC81948E /* Pods_VEF_Widget.framework */, ); name = Frameworks; sourceTree = ""; @@ -133,10 +157,13 @@ isa = PBXNativeTarget; buildConfigurationList = B00E77491F6B138B00649500 /* Build configuration list for PBXNativeTarget "VEF Exchange" */; buildPhases = ( + D7CFF1F0A00D32968579A179 /* [CP] Check Pods Manifest.lock */, B00E77331F6B138B00649500 /* Sources */, B00E77341F6B138B00649500 /* Frameworks */, B00E77351F6B138B00649500 /* Resources */, B00E77611F6B164100649500 /* Embed App Extensions */, + 1FB10CE311F70A673AC6833A /* [CP] Embed Pods Frameworks */, + F2603C99B0A3D9DDCDF5E20A /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -152,9 +179,11 @@ isa = PBXNativeTarget; buildConfigurationList = B00E775E1F6B164100649500 /* Build configuration list for PBXNativeTarget "VEF Widget" */; buildPhases = ( + 5B8D0B0527663CAE8E065E59 /* [CP] Check Pods Manifest.lock */, B00E774C1F6B164100649500 /* Sources */, B00E774D1F6B164100649500 /* Frameworks */, B00E774E1F6B164100649500 /* Resources */, + 01D8192400512744224FF0F8 /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -227,6 +256,84 @@ }; /* End PBXResourcesBuildPhase section */ +/* Begin PBXShellScriptBuildPhase section */ + 01D8192400512744224FF0F8 /* [CP] Copy Pods Resources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "[CP] Copy Pods Resources"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-VEF Widget/Pods-VEF Widget-resources.sh\"\n"; + showEnvVarsInLog = 0; + }; + 1FB10CE311F70A673AC6833A /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "[CP] Embed Pods Frameworks"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-VEF Exchange/Pods-VEF Exchange-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; + 5B8D0B0527663CAE8E065E59 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "[CP] Check Pods Manifest.lock"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; + showEnvVarsInLog = 0; + }; + D7CFF1F0A00D32968579A179 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "[CP] Check Pods Manifest.lock"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; + showEnvVarsInLog = 0; + }; + F2603C99B0A3D9DDCDF5E20A /* [CP] Copy Pods Resources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "[CP] Copy Pods Resources"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-VEF Exchange/Pods-VEF Exchange-resources.sh\"\n"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + /* Begin PBXSourcesBuildPhase section */ B00E77331F6B138B00649500 /* Sources */ = { isa = PBXSourcesBuildPhase; @@ -380,6 +487,7 @@ }; B00E774A1F6B138B00649500 /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = E2869EF7CFC31588F4DC6622 /* Pods-VEF Exchange.debug.xcconfig */; buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; @@ -394,6 +502,7 @@ }; B00E774B1F6B138B00649500 /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = C57CA29698C938B363115044 /* Pods-VEF Exchange.release.xcconfig */; buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; @@ -408,6 +517,7 @@ }; B00E775F1F6B164100649500 /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 84DBBA801C349BF63C36AFD7 /* Pods-VEF Widget.debug.xcconfig */; buildSettings = { DEVELOPMENT_TEAM = 88RQDVG2WX; INFOPLIST_FILE = "VEF Widget/Info.plist"; @@ -421,6 +531,7 @@ }; B00E77601F6B164100649500 /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 17BDEB85C9B3EFF38F25851D /* Pods-VEF Widget.release.xcconfig */; buildSettings = { DEVELOPMENT_TEAM = 88RQDVG2WX; INFOPLIST_FILE = "VEF Widget/Info.plist"; diff --git a/VEF Exchange.xcworkspace/contents.xcworkspacedata b/VEF Exchange.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..464fb3c --- /dev/null +++ b/VEF Exchange.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,10 @@ + + + + + + + From b8a9ef43fbd3ad6230e29775dc13b8ab1fcc8395 Mon Sep 17 00:00:00 2001 From: Patrick Rengifo Date: Thu, 14 Sep 2017 17:27:57 -0400 Subject: [PATCH 5/7] Gather information from the APIs and show it --- VEF Widget/Info.plist | 19 +++++++++++ VEF Widget/TodayViewController.swift | 48 ++++++++++++++++++++++++++-- 2 files changed, 65 insertions(+), 2 deletions(-) diff --git a/VEF Widget/Info.plist b/VEF Widget/Info.plist index cd0ce02..758d803 100644 --- a/VEF Widget/Info.plist +++ b/VEF Widget/Info.plist @@ -27,5 +27,24 @@ NSExtensionPointIdentifier com.apple.widget-extension + NSAppTransportSecurity + + NSAllowsArbitraryLoads + + NSExceptionDomains + + vefexange.appjango.com + + NSExceptionAllowsInsecureHTTPLoads + + NSExceptionRequiresForwardSecrecy + + NSIncludesSubdomains + + NSTemporaryExceptionMinimumTLSVersion + TLSv1.2 + + + diff --git a/VEF Widget/TodayViewController.swift b/VEF Widget/TodayViewController.swift index 3d0693b..2db0832 100644 --- a/VEF Widget/TodayViewController.swift +++ b/VEF Widget/TodayViewController.swift @@ -8,6 +8,8 @@ import UIKit import NotificationCenter +import Alamofire +import SwiftyJSON class TodayViewController: UIViewController, NCWidgetProviding { @@ -15,6 +17,10 @@ class TodayViewController: UIViewController, NCWidgetProviding { @IBOutlet weak var localBitcoinsLabel: UILabel! @IBOutlet weak var usdBitcoinLabel: UILabel! + var vefBtc : Double = 0.0 + var usdBtc : Double = 0.0 + var vefDtd : Double = 0.0 + override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view from its nib. @@ -31,8 +37,46 @@ class TodayViewController: UIViewController, NCWidgetProviding { // If an error is encountered, use NCUpdateResult.Failed // If there's no update required, use NCUpdateResult.NoData // If there's an update, use NCUpdateResult.NewData - - completionHandler(NCUpdateResult.newData) + getData(completionHandler: completionHandler) } + func getData(completionHandler: (@escaping (NCUpdateResult) -> Void)) { + Alamofire.request("https://localbitcoins.com/bitcoinaverage/ticker-all-currencies").responseJSON { response in + + if let jsonResponse = response.result.value { + let json = JSON(jsonResponse) + self.vefBtc = Double(json["VEF"]["avg_24h"].stringValue)! + + Alamofire.request("https://coinbase.com/api/v1/prices/spot_rate").responseJSON { response2 in + + if let jsonResponse2 = response2.result.value { + let json2 = JSON(jsonResponse2) + self.usdBtc = Double(json2["amount"].stringValue)! + self.vefBtc = self.vefBtc / self.usdBtc + self.localBitcoinsLabel.text = String(format: "1$ - Bs.%.2f", self.vefBtc) + self.usdBitcoinLabel.text = String(format: "1XBT - $%.2f", self.usdBtc) + + Alamofire.request("http://vefexange.appjango.com/api/vefdtd").responseJSON { response3 in + + if let jsonResponse3 = response3.result.value { + let json3 = JSON(jsonResponse3) + self.vefDtd = json3["USD"]["dolartoday"].double! + self.dolarTodayLabel.text = String(format: "1$ - Bs.%.2f", self.vefDtd) + + completionHandler(NCUpdateResult.newData) + } else { + completionHandler(NCUpdateResult.failed) + } + + } + } else { + completionHandler(NCUpdateResult.failed) + } + + } + } else { + completionHandler(NCUpdateResult.failed) + } + } + } } From 42cdfa9070adb9550451702b05b15d70ee0314d7 Mon Sep 17 00:00:00 2001 From: Patrick Rengifo Date: Thu, 14 Sep 2017 17:29:17 -0400 Subject: [PATCH 6/7] Erased placeholders --- VEF Widget/Base.lproj/MainInterface.storyboard | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/VEF Widget/Base.lproj/MainInterface.storyboard b/VEF Widget/Base.lproj/MainInterface.storyboard index 64f374c..5e7c209 100644 --- a/VEF Widget/Base.lproj/MainInterface.storyboard +++ b/VEF Widget/Base.lproj/MainInterface.storyboard @@ -33,7 +33,7 @@ -