Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate Connectivity + Example Project #16

Closed
wants to merge 22 commits into from
Closed
Show file tree
Hide file tree
Changes from 11 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
1 change: 1 addition & 0 deletions Cara.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@ Cara is the webservice layer that is (or should be) most commonly used throughou

s.source_files = 'Sources/**/*'
s.dependency 'CryptoSwift', '~> 0.13'
s.dependency 'Connectivity', '~> 2.0.0'
end
265 changes: 263 additions & 2 deletions Example/Cara.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

91 changes: 91 additions & 0 deletions Example/Cara.xcodeproj/xcshareddata/xcschemes/Example.xcscheme
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1010"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "4858290021DD41A8007EB5D9"
BuildableName = "Example.app"
BlueprintName = "Example"
ReferencedContainer = "container:Cara.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "4858290021DD41A8007EB5D9"
BuildableName = "Example.app"
BlueprintName = "Example"
ReferencedContainer = "container:Cara.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 = "4858290021DD41A8007EB5D9"
BuildableName = "Example.app"
BlueprintName = "Example"
ReferencedContainer = "container:Cara.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "4858290021DD41A8007EB5D9"
BuildableName = "Example.app"
BlueprintName = "Example"
ReferencedContainer = "container:Cara.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
Expand Up @@ -32,7 +32,7 @@
<CodeCoverageTargets>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "000000000930"
BlueprintIdentifier = "000000000EE0"
BuildableName = "Cara.framework"
BlueprintName = "Cara"
ReferencedContainer = "container:Pods/Pods.xcodeproj">
Expand Down
21 changes: 21 additions & 0 deletions Example/Example/AppDelegate.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//
// AppDelegate.swift
// Example
//
// Created by Dylan Gyesbreghs on 02/01/2019.
// Copyright © 2019 icapps. All rights reserved.
//

import UIKit

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

var window: UIWindow?

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
}

69 changes: 69 additions & 0 deletions Example/Example/Modules/Demo/Demo.storyboard
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="1TA-kC-qwv">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14460.20"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--Demo View Controller-->
<scene sceneID="k6t-ic-mNz">
<objects>
<viewController id="UJa-Dr-7yO" customClass="DemoViewController" customModule="Example" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="rNy-gw-US6">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="7fF-ak-WWB">
<rect key="frame" x="115" y="318.5" width="145" height="30"/>
<state key="normal" title="Network Reachability"/>
<connections>
<segue destination="8Qp-Ax-yqr" kind="show" id="Yxx-1C-KaV"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="7fF-ak-WWB" firstAttribute="centerY" secondItem="rNy-gw-US6" secondAttribute="centerY" id="0VO-Bo-IgO"/>
<constraint firstItem="7fF-ak-WWB" firstAttribute="centerX" secondItem="rNy-gw-US6" secondAttribute="centerX" id="Rw2-at-xcv"/>
</constraints>
<viewLayoutGuide key="safeArea" id="Pih-wg-Joh"/>
</view>
<navigationItem key="navigationItem" id="YYw-mW-rel"/>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="eGI-nR-xrp" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="912.79999999999995" y="99.400299850074973"/>
</scene>
<!--NetworkReachability-->
<scene sceneID="ePL-kW-2Bd">
<objects>
<viewControllerPlaceholder storyboardName="NetworkReachability" id="8Qp-Ax-yqr" sceneMemberID="viewController"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="lfQ-AN-5S9" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1570.4000000000001" y="98.950524737631198"/>
</scene>
<!--Navigation Controller-->
<scene sceneID="smg-XL-6Qm">
<objects>
<navigationController automaticallyAdjustsScrollViewInsets="NO" id="1TA-kC-qwv" sceneMemberID="viewController">
<toolbarItems/>
<navigationBar key="navigationBar" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" id="dnF-db-UMj">
<rect key="frame" x="0.0" y="20" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
</navigationBar>
<nil name="viewControllers"/>
<connections>
<segue destination="UJa-Dr-7yO" kind="relationship" relationship="rootViewController" id="g8K-00-L5Y"/>
</connections>
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="LEe-k7-XkC" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-26.399999999999999" y="99.400299850074973"/>
</scene>
</scenes>
</document>
18 changes: 18 additions & 0 deletions Example/Example/Modules/Demo/DemoViewController.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//
// DemoViewController.swift
// Example
//
// Created by Dylan Gyesbreghs on 02/01/2019.
// Copyright © 2019 icapps. All rights reserved.
//

import UIKit

class DemoViewController: UIViewController {

override func viewDidLoad() {
super.viewDidLoad()
title = "Demo"
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="Q6P-5d-GHx">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14460.20"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--Network Reachability View Controller-->
<scene sceneID="zGb-BS-e9X">
<objects>
<viewController id="Q6P-5d-GHx" customClass="NetworkReachabilityViewController" customModule="Example" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="lpS-Zl-Pd4">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" distribution="fillEqually" spacing="10" translatesAutoresizingMaskIntoConstraints="NO" id="mvY-ZZ-fiL">
<rect key="frame" x="10" y="40" width="355" height="648"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="CKj-ew-prN">
<rect key="frame" x="0.0" y="0.0" width="355" height="154.5"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="JK3-5g-Jox">
<rect key="frame" x="0.0" y="164.5" width="355" height="154.5"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ARW-zm-aXP">
<rect key="frame" x="0.0" y="329" width="355" height="154.5"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="fyb-PL-mO7">
<rect key="frame" x="0.0" y="493.5" width="355" height="154.5"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
</stackView>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="mvY-ZZ-fiL" firstAttribute="leading" secondItem="VYG-2m-Oje" secondAttribute="leading" constant="10" id="Tyh-S2-6Mq"/>
<constraint firstItem="VYG-2m-Oje" firstAttribute="trailing" secondItem="mvY-ZZ-fiL" secondAttribute="trailing" constant="10" id="Vrb-31-POz"/>
<constraint firstItem="mvY-ZZ-fiL" firstAttribute="top" secondItem="VYG-2m-Oje" secondAttribute="top" constant="20" id="oVZ-VM-M7v"/>
</constraints>
<viewLayoutGuide key="safeArea" id="VYG-2m-Oje"/>
</view>
<connections>
<outlet property="connectedLabel" destination="JK3-5g-Jox" id="EET-Iv-MFH"/>
<outlet property="connectedViaCellular" destination="ARW-zm-aXP" id="TSL-Hk-gMR"/>
<outlet property="connectedViaWiFi" destination="fyb-PL-mO7" id="QUa-DQ-M82"/>
<outlet property="statusLabel" destination="CKj-ew-prN" id="yhj-2K-5eg"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="KAn-Sh-bv2" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="39" y="-62"/>
</scene>
</scenes>
</document>
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
//
// NetworkReachabilityViewController.swift
// Example
//
// Created by Dylan Gyesbreghs on 02/01/2019.
// Copyright © 2019 icapps. All rights reserved.
//

import UIKit
import Cara

class NetworkReachabilityViewController: UIViewController {

fileprivate let networkReachability = NetworkReachability()

@IBOutlet weak var statusLabel: UILabel!
@IBOutlet weak var connectedLabel: UILabel!
@IBOutlet weak var connectedViaCellular: UILabel!
@IBOutlet weak var connectedViaWiFi: UILabel!

override func viewDidLoad() {
super.viewDidLoad()
title = "Network Reachability"
setupView()
}

func setupView() {
networkReachability.listener = { status in
self.statusLabel.text = "🍞 Status: \(status)"
}
networkReachability.startListening()

DispatchQueue.main.asyncAfter(deadline: .now() + 2) {
self.connectedLabel.text = "🍞 Connected: \(self.networkReachability.isConnected)"
self.connectedViaCellular.text = "🍞 Cellular: \(self.networkReachability.isConnectedViaCellular)"
self.connectedViaWiFi.text = "🍞 WiFi: \(self.networkReachability.isConnectedViaWiFi)"
}
}
}
Loading