Commits (8)
Pod::Spec.new do |s|
s.name = 'ARConsole'
s.version = '1.0.0'
s.version = '1.1.0'
s.summary = 'ARConsole lets you know in real time your application logs.'
s.description = <<-DESC
......@@ -13,10 +13,12 @@ ARConsole lets you know in real time your application logs. It's easy.
s.source = { :git => 'https://gitlab.com/ArkitectureRepository/ARConsole.git', :tag => s.version.to_s }
s.ios.deployment_target = '10.0'
s.source_files = 'ARconsole/Console/*.swift'
s.resources = 'ARconsole/Console/*.xib'
s.source_files = 'ARconsole/Console/*.swift', 'ARconsole/Console/Views/*.swift', 'ARconsole/Console/Models/*.swift'
s.framework = 'UIKit'
s.framework = 'AVFoundation'
#s.dependency = 'AKModel'
end
\ No newline at end of file
......@@ -7,21 +7,24 @@
objects = {
/* Begin PBXBuildFile section */
32593E7CC1F0B5DE087D3357 /* Pods_ARConsole.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5684000D4BE2C85ACCDC1502 /* Pods_ARConsole.framework */; };
D5CA9E2F1F4C1EBC004958CD /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5CA9E2E1F4C1EBC004958CD /* AppDelegate.swift */; };
D5CA9E311F4C1EBC004958CD /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5CA9E301F4C1EBC004958CD /* ViewController.swift */; };
D5CA9E341F4C1EBC004958CD /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D5CA9E321F4C1EBC004958CD /* Main.storyboard */; };
D5CA9E361F4C1EBC004958CD /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = D5CA9E351F4C1EBC004958CD /* Assets.xcassets */; };
D5CA9E391F4C1EBC004958CD /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D5CA9E371F4C1EBC004958CD /* LaunchScreen.storyboard */; };
D5CA9E481F4C1F96004958CD /* ARConsoleTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5CA9E411F4C1F96004958CD /* ARConsoleTableViewCell.swift */; };
D5CA9E491F4C1F96004958CD /* ARConsoleTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = D5CA9E421F4C1F96004958CD /* ARConsoleTableViewCell.xib */; };
D5CA9E4A1F4C1F96004958CD /* ARConsoleViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5CA9E431F4C1F96004958CD /* ARConsoleViewController.swift */; };
D5CA9E4B1F4C1F96004958CD /* ARConsoleViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = D5CA9E441F4C1F96004958CD /* ARConsoleViewController.xib */; };
D5CA9E4C1F4C1F96004958CD /* ARFunctions.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5CA9E451F4C1F96004958CD /* ARFunctions.swift */; };
D5CA9E4D1F4C1F96004958CD /* ARPrint.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5CA9E461F4C1F96004958CD /* ARPrint.swift */; };
D5CA9E4E1F4C1F96004958CD /* ARPrintString.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5CA9E471F4C1F96004958CD /* ARPrintString.swift */; };
D5F551B91F4D807D00D530D5 /* ARConsoleTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5F551B51F4D807D00D530D5 /* ARConsoleTableViewCell.swift */; };
D5F551BB1F4D807D00D530D5 /* ARConsoleViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5F551B71F4D807D00D530D5 /* ARConsoleViewController.swift */; };
D5F551C01F4D808A00D530D5 /* ARFunctions.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5F551BD1F4D808A00D530D5 /* ARFunctions.swift */; };
D5F551C11F4D808A00D530D5 /* ARPrintString.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5F551BE1F4D808A00D530D5 /* ARPrintString.swift */; };
D5F551C21F4D808A00D530D5 /* Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5F551BF1F4D808A00D530D5 /* Extensions.swift */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
47D6D2C9D3A52BA4294AE60C /* Pods-ARConsole.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ARConsole.debug.xcconfig"; path = "Pods/Target Support Files/Pods-ARConsole/Pods-ARConsole.debug.xcconfig"; sourceTree = "<group>"; };
5684000D4BE2C85ACCDC1502 /* Pods_ARConsole.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_ARConsole.framework; sourceTree = BUILT_PRODUCTS_DIR; };
CB6E2F4C94ACF30D3E5A7895 /* Pods-ARConsole.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ARConsole.release.xcconfig"; path = "Pods/Target Support Files/Pods-ARConsole/Pods-ARConsole.release.xcconfig"; sourceTree = "<group>"; };
D5CA9E2B1F4C1EBC004958CD /* ARConsole.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ARConsole.app; sourceTree = BUILT_PRODUCTS_DIR; };
D5CA9E2E1F4C1EBC004958CD /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
D5CA9E301F4C1EBC004958CD /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
......@@ -29,13 +32,13 @@
D5CA9E351F4C1EBC004958CD /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
D5CA9E381F4C1EBC004958CD /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
D5CA9E3A1F4C1EBC004958CD /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
D5CA9E411F4C1F96004958CD /* ARConsoleTableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ARConsoleTableViewCell.swift; path = Console/ARConsoleTableViewCell.swift; sourceTree = "<group>"; };
D5CA9E421F4C1F96004958CD /* ARConsoleTableViewCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = ARConsoleTableViewCell.xib; path = Console/ARConsoleTableViewCell.xib; sourceTree = "<group>"; };
D5CA9E431F4C1F96004958CD /* ARConsoleViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ARConsoleViewController.swift; path = Console/ARConsoleViewController.swift; sourceTree = "<group>"; };
D5CA9E441F4C1F96004958CD /* ARConsoleViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = ARConsoleViewController.xib; path = Console/ARConsoleViewController.xib; sourceTree = "<group>"; };
D5CA9E451F4C1F96004958CD /* ARFunctions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ARFunctions.swift; path = Console/ARFunctions.swift; sourceTree = "<group>"; };
D5CA9E461F4C1F96004958CD /* ARPrint.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ARPrint.swift; path = Console/ARPrint.swift; sourceTree = "<group>"; };
D5CA9E471F4C1F96004958CD /* ARPrintString.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ARPrintString.swift; path = Console/ARPrintString.swift; sourceTree = "<group>"; };
D5CA9E511F4C4151004958CD /* AKModel.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AKModel.framework; path = "../../Library/Developer/Xcode/DerivedData/ARConsole-gkqyvypwweiwsccxcmrmunxhuhtr/Build/Products/Debug-iphoneos/AKModel/AKModel.framework"; sourceTree = "<group>"; };
D5F551B51F4D807D00D530D5 /* ARConsoleTableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ARConsoleTableViewCell.swift; path = Console/Views/ARConsoleTableViewCell.swift; sourceTree = "<group>"; };
D5F551B71F4D807D00D530D5 /* ARConsoleViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ARConsoleViewController.swift; path = Console/Views/ARConsoleViewController.swift; sourceTree = "<group>"; };
D5F551BD1F4D808A00D530D5 /* ARFunctions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ARFunctions.swift; path = Console/Models/ARFunctions.swift; sourceTree = "<group>"; };
D5F551BE1F4D808A00D530D5 /* ARPrintString.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ARPrintString.swift; path = Console/Models/ARPrintString.swift; sourceTree = "<group>"; };
D5F551BF1F4D808A00D530D5 /* Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Extensions.swift; path = Console/Models/Extensions.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
......@@ -43,17 +46,38 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
32593E7CC1F0B5DE087D3357 /* Pods_ARConsole.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
2049080FD8C4823C799645A7 /* Frameworks */ = {
isa = PBXGroup;
children = (
D5CA9E511F4C4151004958CD /* AKModel.framework */,
5684000D4BE2C85ACCDC1502 /* Pods_ARConsole.framework */,
);
name = Frameworks;
sourceTree = "<group>";
};
B3EBF71CE40605A91D226C45 /* Pods */ = {
isa = PBXGroup;
children = (
47D6D2C9D3A52BA4294AE60C /* Pods-ARConsole.debug.xcconfig */,
CB6E2F4C94ACF30D3E5A7895 /* Pods-ARConsole.release.xcconfig */,
);
name = Pods;
sourceTree = "<group>";
};
D5CA9E221F4C1EBC004958CD = {
isa = PBXGroup;
children = (
D5CA9E2D1F4C1EBC004958CD /* ARConsole */,
D5CA9E2C1F4C1EBC004958CD /* Products */,
2049080FD8C4823C799645A7 /* Frameworks */,
B3EBF71CE40605A91D226C45 /* Pods */,
);
sourceTree = "<group>";
};
......@@ -82,17 +106,32 @@
D5CA9E401F4C1F89004958CD /* Console */ = {
isa = PBXGroup;
children = (
D5CA9E411F4C1F96004958CD /* ARConsoleTableViewCell.swift */,
D5CA9E421F4C1F96004958CD /* ARConsoleTableViewCell.xib */,
D5CA9E431F4C1F96004958CD /* ARConsoleViewController.swift */,
D5CA9E441F4C1F96004958CD /* ARConsoleViewController.xib */,
D5CA9E451F4C1F96004958CD /* ARFunctions.swift */,
D5F551AC1F4D800C00D530D5 /* Models */,
D5F551AB1F4D7FEC00D530D5 /* Views */,
D5CA9E461F4C1F96004958CD /* ARPrint.swift */,
D5CA9E471F4C1F96004958CD /* ARPrintString.swift */,
);
name = Console;
sourceTree = "<group>";
};
D5F551AB1F4D7FEC00D530D5 /* Views */ = {
isa = PBXGroup;
children = (
D5F551B51F4D807D00D530D5 /* ARConsoleTableViewCell.swift */,
D5F551B71F4D807D00D530D5 /* ARConsoleViewController.swift */,
);
name = Views;
sourceTree = "<group>";
};
D5F551AC1F4D800C00D530D5 /* Models */ = {
isa = PBXGroup;
children = (
D5F551BD1F4D808A00D530D5 /* ARFunctions.swift */,
D5F551BE1F4D808A00D530D5 /* ARPrintString.swift */,
D5F551BF1F4D808A00D530D5 /* Extensions.swift */,
);
name = Models;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
......@@ -100,9 +139,12 @@
isa = PBXNativeTarget;
buildConfigurationList = D5CA9E3D1F4C1EBC004958CD /* Build configuration list for PBXNativeTarget "ARConsole" */;
buildPhases = (
71FB8D9F8BD460C334F6A365 /* [CP] Check Pods Manifest.lock */,
D5CA9E271F4C1EBC004958CD /* Sources */,
D5CA9E281F4C1EBC004958CD /* Frameworks */,
D5CA9E291F4C1EBC004958CD /* Resources */,
1A90DF6C8A1C9E6CE8BF889D /* [CP] Embed Pods Frameworks */,
8D992AA861194A65D04CFCB1 /* [CP] Copy Pods Resources */,
);
buildRules = (
);
......@@ -125,7 +167,7 @@
TargetAttributes = {
D5CA9E2A1F4C1EBC004958CD = {
CreatedOnToolsVersion = 8.3.3;
DevelopmentTeam = E4ZU6XA9L6;
DevelopmentTeam = FGEQE267D2;
ProvisioningStyle = Automatic;
};
};
......@@ -153,8 +195,6 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
D5CA9E491F4C1F96004958CD /* ARConsoleTableViewCell.xib in Resources */,
D5CA9E4B1F4C1F96004958CD /* ARConsoleViewController.xib in Resources */,
D5CA9E391F4C1EBC004958CD /* LaunchScreen.storyboard in Resources */,
D5CA9E361F4C1EBC004958CD /* Assets.xcassets in Resources */,
D5CA9E341F4C1EBC004958CD /* Main.storyboard in Resources */,
......@@ -163,18 +203,73 @@
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
1A90DF6C8A1C9E6CE8BF889D /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
"${SRCROOT}/Pods/Target Support Files/Pods-ARConsole/Pods-ARConsole-frameworks.sh",
"${BUILT_PRODUCTS_DIR}/AKModel/AKModel.framework",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/AKModel.framework",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-ARConsole/Pods-ARConsole-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
71FB8D9F8BD460C334F6A365 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
"${PODS_ROOT}/Manifest.lock",
);
name = "[CP] Check Pods Manifest.lock";
outputPaths = (
"$(DERIVED_FILE_DIR)/Pods-ARConsole-checkManifestLockResult.txt",
);
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# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
8D992AA861194A65D04CFCB1 /* [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-ARConsole/Pods-ARConsole-resources.sh\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
D5CA9E271F4C1EBC004958CD /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
D5CA9E311F4C1EBC004958CD /* ViewController.swift in Sources */,
D5CA9E4E1F4C1F96004958CD /* ARPrintString.swift in Sources */,
D5CA9E4A1F4C1F96004958CD /* ARConsoleViewController.swift in Sources */,
D5F551C11F4D808A00D530D5 /* ARPrintString.swift in Sources */,
D5CA9E4D1F4C1F96004958CD /* ARPrint.swift in Sources */,
D5F551C21F4D808A00D530D5 /* Extensions.swift in Sources */,
D5CA9E2F1F4C1EBC004958CD /* AppDelegate.swift in Sources */,
D5CA9E481F4C1F96004958CD /* ARConsoleTableViewCell.swift in Sources */,
D5CA9E4C1F4C1F96004958CD /* ARFunctions.swift in Sources */,
D5F551BB1F4D807D00D530D5 /* ARConsoleViewController.swift in Sources */,
D5F551C01F4D808A00D530D5 /* ARFunctions.swift in Sources */,
D5F551B91F4D807D00D530D5 /* ARConsoleTableViewCell.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -244,6 +339,7 @@
IPHONEOS_DEPLOYMENT_TARGET = 10.3;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = "";
SDKROOT = iphoneos;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
......@@ -295,12 +391,13 @@
};
D5CA9E3E1F4C1EBC004958CD /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 47D6D2C9D3A52BA4294AE60C /* Pods-ARConsole.debug.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
DEVELOPMENT_TEAM = E4ZU6XA9L6;
DEVELOPMENT_TEAM = FGEQE267D2;
INFOPLIST_FILE = ARConsole/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.alvaroroyo.ARConsole;
PRODUCT_BUNDLE_IDENTIFIER = com.alvaroroyo.Console;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
};
......@@ -308,12 +405,13 @@
};
D5CA9E3F1F4C1EBC004958CD /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = CB6E2F4C94ACF30D3E5A7895 /* Pods-ARConsole.release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
DEVELOPMENT_TEAM = E4ZU6XA9L6;
DEVELOPMENT_TEAM = FGEQE267D2;
INFOPLIST_FILE = ARConsole/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.alvaroroyo.ARConsole;
PRODUCT_BUNDLE_IDENTIFIER = com.alvaroroyo.Console;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
};
......
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "group:ARConsole.xcodeproj">
</FileRef>
<FileRef
location = "group:Pods/Pods.xcodeproj">
</FileRef>
</Workspace>
......@@ -16,6 +16,12 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
print(NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true).first!)
let arprint = ARPrint.sharedInstance()
// arprint.maxRecording = 10
arprint.start()
return true
}
......
......@@ -23,19 +23,32 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="x94-ul-x6g">
<rect key="frame" x="16" y="20" width="343" height="647"/>
<rect key="frame" x="16" y="20" width="343" height="547"/>
<state key="normal" title="Show Console"/>
<connections>
<action selector="showConsoleAction" destination="BYZ-38-t0r" eventType="touchUpInside" id="5ah-z8-0Jp"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Dpm-dp-fKz">
<rect key="frame" x="16" y="567" width="343" height="100"/>
<constraints>
<constraint firstAttribute="height" constant="100" id="TBq-J5-3CZ"/>
</constraints>
<state key="normal" title="Share Log File"/>
<connections>
<action selector="shareAction" destination="BYZ-38-t0r" eventType="touchUpInside" id="pJO-Jy-6KR"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="wfy-db-euE" firstAttribute="top" secondItem="x94-ul-x6g" secondAttribute="bottom" id="0H5-Pw-Cgu"/>
<constraint firstAttribute="trailingMargin" secondItem="Dpm-dp-fKz" secondAttribute="trailing" id="0vN-ID-8tY"/>
<constraint firstItem="Dpm-dp-fKz" firstAttribute="top" secondItem="x94-ul-x6g" secondAttribute="bottom" id="ACJ-7g-SSA"/>
<constraint firstAttribute="trailingMargin" secondItem="x94-ul-x6g" secondAttribute="trailing" id="MCf-Ny-zxO"/>
<constraint firstItem="Dpm-dp-fKz" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leadingMargin" id="Q1E-Nu-cN0"/>
<constraint firstItem="x94-ul-x6g" firstAttribute="top" secondItem="y3c-jy-aDJ" secondAttribute="bottom" id="awl-ts-txg"/>
<constraint firstItem="x94-ul-x6g" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leadingMargin" id="bop-ot-EFZ"/>
<constraint firstItem="wfy-db-euE" firstAttribute="top" secondItem="Dpm-dp-fKz" secondAttribute="bottom" id="ceX-XC-Toq"/>
</constraints>
</view>
</viewController>
......
//
// ARConsoleTableViewCell.swift
// CapitalManagement
//
// Created by Alvaro on 21/8/17.
// Copyright © 2017 Alvaro Royo. All rights reserved.
//
import UIKit
class ARConsoleTableViewCell: UITableViewCell {
@IBOutlet weak var contentHeader: UIView!
@IBOutlet weak var tagLbl: UILabel!
@IBOutlet weak var dateLbl: UILabel!
@IBOutlet weak var messageLbl: UILabel!
@IBOutlet var lbls: [UILabel]!
override func awakeFromNib() {
super.awakeFromNib()
contentHeader.layer.cornerRadius = 5
contentHeader.layer.borderWidth = 1
contentHeader.layer.borderColor = UIColor.lightGray.cgColor
self.contentView.backgroundColor = UIColor.clear
self.backgroundColor = UIColor.clear
}
func setView(with string:ARPrintString){
tagLbl.text = string.tag
dateLbl.text = string.getDateString()
messageLbl.text = string.message
lbls.forEach{ $0.textColor = string.colour }
}
override func prepareForReuse() {
lbls.forEach{ lbl in
lbl.text = ""
lbl.textColor = ARPrint.defaultColor
}
}
}
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="12121" systemVersion="16G29" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12089"/>
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
<capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<tableViewCell contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" reuseIdentifier="ARConsoleTableViewCell" rowHeight="75" id="KGk-i7-Jjw" customClass="ARConsoleTableViewCell" customModule="CapitalManagement" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="320" height="75"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
<rect key="frame" x="0.0" y="0.0" width="320" height="74.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="u2h-SR-kfA">
<rect key="frame" x="8" y="8" width="304" height="30"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Warning" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="10" translatesAutoresizingMaskIntoConstraints="NO" id="xSP-mj-5LI">
<rect key="frame" x="5" y="0.0" width="137" height="30"/>
<fontDescription key="fontDescription" name="Courier" family="Courier" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="01/01/2033 00:33:15" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="d31-Se-C5B">
<rect key="frame" x="162" y="0.0" width="137" height="30"/>
<fontDescription key="fontDescription" name="Courier" family="Courier" pointSize="11"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="bottom" secondItem="d31-Se-C5B" secondAttribute="bottom" id="40N-Ja-qlJ"/>
<constraint firstItem="xSP-mj-5LI" firstAttribute="width" secondItem="u2h-SR-kfA" secondAttribute="width" multiplier="45:100" id="8Wu-zb-cS1"/>
<constraint firstItem="d31-Se-C5B" firstAttribute="top" secondItem="u2h-SR-kfA" secondAttribute="top" id="9HH-3s-pe5"/>
<constraint firstAttribute="bottom" secondItem="xSP-mj-5LI" secondAttribute="bottom" id="B3n-aT-Wjf"/>
<constraint firstItem="xSP-mj-5LI" firstAttribute="leading" secondItem="u2h-SR-kfA" secondAttribute="leading" constant="5" id="KwG-84-stg"/>
<constraint firstAttribute="height" constant="30" id="USp-f0-4MP"/>
<constraint firstAttribute="trailing" secondItem="d31-Se-C5B" secondAttribute="trailing" constant="5" id="YUd-T8-p7e"/>
<constraint firstItem="xSP-mj-5LI" firstAttribute="top" secondItem="u2h-SR-kfA" secondAttribute="top" id="ofo-QR-DRQ"/>
<constraint firstItem="d31-Se-C5B" firstAttribute="width" secondItem="xSP-mj-5LI" secondAttribute="width" id="tEI-kc-VCo"/>
</constraints>
</view>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Something" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="jjh-e0-IWN">
<rect key="frame" x="13" y="46" width="294" height="18"/>
<fontDescription key="fontDescription" name="Courier" family="Courier" pointSize="17"/>
<color key="textColor" red="0.0" green="1" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="De3-pX-f2m">
<rect key="frame" x="0.0" y="73.5" width="320" height="1"/>
<color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="height" constant="1" id="P8b-Rd-cgh"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="trailingMargin" secondItem="u2h-SR-kfA" secondAttribute="trailing" id="1Wb-tK-SJw"/>
<constraint firstItem="jjh-e0-IWN" firstAttribute="top" secondItem="u2h-SR-kfA" secondAttribute="bottom" constant="8" id="5JR-OA-8Ug"/>
<constraint firstItem="jjh-e0-IWN" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leadingMargin" constant="5" id="8sA-ND-X3j"/>
<constraint firstAttribute="bottom" secondItem="De3-pX-f2m" secondAttribute="bottom" id="Coo-5k-VG0"/>
<constraint firstItem="u2h-SR-kfA" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="topMargin" id="EGY-4q-hPI"/>
<constraint firstItem="De3-pX-f2m" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" id="OXF-Y0-awk"/>
<constraint firstItem="u2h-SR-kfA" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leadingMargin" id="RPk-l7-fU1"/>
<constraint firstAttribute="trailingMargin" secondItem="jjh-e0-IWN" secondAttribute="trailing" constant="5" id="WDf-7n-mT0"/>
<constraint firstItem="De3-pX-f2m" firstAttribute="top" secondItem="jjh-e0-IWN" secondAttribute="bottom" constant="9.5" id="u2W-Sr-JqJ"/>
<constraint firstAttribute="trailing" secondItem="De3-pX-f2m" secondAttribute="trailing" id="u4Z-W4-nK8"/>
</constraints>
</tableViewCellContentView>
<connections>
<outlet property="contentHeader" destination="u2h-SR-kfA" id="uMu-2G-64t"/>
<outlet property="dateLbl" destination="d31-Se-C5B" id="74S-Cr-r4A"/>
<outlet property="messageLbl" destination="jjh-e0-IWN" id="4cC-yf-R8B"/>
<outlet property="tagLbl" destination="xSP-mj-5LI" id="9f3-Mr-Z3n"/>
<outletCollection property="lbls" destination="xSP-mj-5LI" collectionClass="NSMutableArray" id="FBq-YO-QLi"/>
<outletCollection property="lbls" destination="d31-Se-C5B" collectionClass="NSMutableArray" id="2OR-kc-2rw"/>
<outletCollection property="lbls" destination="jjh-e0-IWN" collectionClass="NSMutableArray" id="GcO-60-OYZ"/>
</connections>
<point key="canvasLocation" x="34" y="69.5"/>
</tableViewCell>
</objects>
</document>
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="12121" systemVersion="16G29" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina3_5" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12089"/>
<capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="ARConsoleViewController" customModule="ARConsole" customModuleProvider="target">
<connections>
<outlet property="startStop" destination="goC-ZD-2qz" id="igs-Iu-nuc"/>
<outlet property="tableView" destination="w8W-25-9W2" id="Otm-Mq-pp1"/>
<outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/>
</connections>
</placeholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view clearsContextBeforeDrawing="NO" contentMode="scaleToFill" id="i5M-Pr-FkT">
<rect key="frame" x="0.0" y="0.0" width="320" height="480"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="FVJ-fW-9iG">
<rect key="frame" x="0.0" y="0.0" width="320" height="60"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="VeS-KT-j8C">
<rect key="frame" x="0.0" y="58" width="320" height="2"/>
<color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="height" constant="2" id="sjt-1T-FhZ"/>
</constraints>
</view>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="QXE-Ph-GNF">
<rect key="frame" x="0.0" y="0.0" width="106.5" height="58"/>
<fontDescription key="fontDescription" type="system" weight="semibold" pointSize="17"/>
<state key="normal" title="CLOSE">
<color key="titleColor" red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color key="titleShadowColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
</state>
<connections>
<action selector="closeAction" destination="-1" eventType="touchUpInside" id="JGY-W0-C7t"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="e9q-Vr-KB6">
<rect key="frame" x="213.5" y="0.0" width="106.5" height="58"/>
<fontDescription key="fontDescription" type="system" weight="semibold" pointSize="17"/>
<state key="normal" title="CLEAR">
<color key="titleColor" red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color key="titleShadowColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
</state>
<connections>
<action selector="clearAction" destination="-1" eventType="touchUpInside" id="teh-rF-84E"/>
</connections>
</button>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="sJG-Zo-iy1">
<rect key="frame" x="106.5" y="0.0" width="107" height="58"/>
<subviews>
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="goC-ZD-2qz">
<rect key="frame" x="29" y="25" width="51" height="31"/>
<constraints>
<constraint firstAttribute="height" constant="31" id="3ZL-kv-cMi"/>
<constraint firstAttribute="width" constant="49" id="dXD-rc-Bpm"/>
</constraints>
<connections>
<action selector="startStop:" destination="-1" eventType="valueChanged" id="WTY-5W-9lF"/>
</connections>
</switch>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Start/Stop" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="059-qE-6kD">
<rect key="frame" x="0.0" y="5" width="107" height="15"/>
<constraints>
<constraint firstAttribute="height" constant="15" id="X23-sM-3SM"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="059-qE-6kD" firstAttribute="leading" secondItem="sJG-Zo-iy1" secondAttribute="leading" id="C0C-Ez-12I"/>
<constraint firstItem="059-qE-6kD" firstAttribute="top" secondItem="sJG-Zo-iy1" secondAttribute="top" constant="5" id="CIl-WP-yM4"/>
<constraint firstAttribute="bottom" secondItem="goC-ZD-2qz" secondAttribute="bottom" constant="2" id="bHc-KN-ymm"/>
<constraint firstItem="goC-ZD-2qz" firstAttribute="centerX" secondItem="sJG-Zo-iy1" secondAttribute="centerX" id="kyM-A7-nUb"/>
<constraint firstAttribute="trailing" secondItem="059-qE-6kD" secondAttribute="trailing" id="qfI-fL-V6C"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="trailing" secondItem="e9q-Vr-KB6" secondAttribute="trailing" id="5Q9-2V-o4z"/>
<constraint firstItem="VeS-KT-j8C" firstAttribute="leading" secondItem="FVJ-fW-9iG" secondAttribute="leading" id="BEK-fq-AQG"/>
<constraint firstItem="e9q-Vr-KB6" firstAttribute="top" secondItem="FVJ-fW-9iG" secondAttribute="top" id="CKc-W7-h7H"/>
<constraint firstAttribute="trailing" secondItem="VeS-KT-j8C" secondAttribute="trailing" id="Chr-rG-MZ3"/>
<constraint firstItem="sJG-Zo-iy1" firstAttribute="top" secondItem="FVJ-fW-9iG" secondAttribute="top" id="I0s-8t-8hu"/>
<constraint firstItem="QXE-Ph-GNF" firstAttribute="top" secondItem="FVJ-fW-9iG" secondAttribute="top" id="KDE-H8-jm6"/>
<constraint firstAttribute="height" constant="60" id="Kmu-pg-qg9"/>
<constraint firstItem="QXE-Ph-GNF" firstAttribute="width" secondItem="FVJ-fW-9iG" secondAttribute="width" multiplier="1:3" id="L48-kx-I1X"/>
<constraint firstItem="e9q-Vr-KB6" firstAttribute="leading" secondItem="sJG-Zo-iy1" secondAttribute="trailing" id="Pbd-bX-F5O"/>
<constraint firstItem="VeS-KT-j8C" firstAttribute="top" secondItem="QXE-Ph-GNF" secondAttribute="bottom" id="RRw-tg-PkJ"/>
<constraint firstItem="VeS-KT-j8C" firstAttribute="top" secondItem="sJG-Zo-iy1" secondAttribute="bottom" id="Ygz-YK-14Z"/>
<constraint firstItem="sJG-Zo-iy1" firstAttribute="leading" secondItem="QXE-Ph-GNF" secondAttribute="trailing" id="fff-Hw-Q3h"/>
<constraint firstItem="VeS-KT-j8C" firstAttribute="top" secondItem="e9q-Vr-KB6" secondAttribute="bottom" id="gNX-fg-oRI"/>
<constraint firstAttribute="bottom" secondItem="VeS-KT-j8C" secondAttribute="bottom" id="gw0-z7-fT9"/>
<constraint firstItem="e9q-Vr-KB6" firstAttribute="width" secondItem="QXE-Ph-GNF" secondAttribute="width" id="u0R-zX-zD5"/>
<constraint firstItem="QXE-Ph-GNF" firstAttribute="leading" secondItem="FVJ-fW-9iG" secondAttribute="leading" id="xMY-LL-yVS"/>
</constraints>
</view>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="w8W-25-9W2">
<rect key="frame" x="0.0" y="60" width="320" height="420"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
</tableView>
</subviews>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="displayP3"/>
<constraints>
<constraint firstItem="FVJ-fW-9iG" firstAttribute="top" secondItem="i5M-Pr-FkT" secondAttribute="top" id="0jL-TY-kNh"/>
<constraint firstItem="FVJ-fW-9iG" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" id="1pD-hb-m6y"/>
<constraint firstItem="w8W-25-9W2" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" id="b3M-2E-I2U"/>
<constraint firstAttribute="bottom" secondItem="w8W-25-9W2" secondAttribute="bottom" id="ctA-A4-yDF"/>
<constraint firstAttribute="trailing" secondItem="w8W-25-9W2" secondAttribute="trailing" id="e0d-Gs-1Bh"/>
<constraint firstItem="w8W-25-9W2" firstAttribute="top" secondItem="FVJ-fW-9iG" secondAttribute="bottom" id="eeD-PU-y2B"/>
<constraint firstAttribute="trailing" secondItem="FVJ-fW-9iG" secondAttribute="trailing" id="tOX-o9-x2N"/>
</constraints>
<nil key="simulatedStatusBarMetrics"/>
</view>
</objects>
</document>
......@@ -9,27 +9,73 @@
import UIKit
import AVFoundation
class ARPrint: NSObject {
public class ARPrint: NSObject {
static let sharedInstance = ARPrint()
private static var instance:ARPrint? = nil
static let defaultColor = UIColor.green
static let NC_ARCONSOLE_CHANGED = "NC_ARCONSOLE_CHANGED"
static let ARCONSOLE_PATH = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true).first! + "/ARCONSOLE/"
static let ARCONSOLE_FILE = "Log.json"
private var printStrings:[ARPrintString] = []
var isRecording = true
public var isRecording = false
private var lastDateVolume = Date()
private var clicks = 0
var showWithVolume = true
public var showWithVolume = true
override init() {
super.init()
private var autoSaveQueue = DispatchQueue(label: "Auto Save ARConsole", attributes: .concurrent)
// private let resourceManager = AKResourceManager()
public var maxRecording = 0 //Infinite
private var started = false
public static func sharedInstance(_ fromPrint:Bool = false) -> ARPrint {
if ARPrint.instance == nil {
ARPrint.instance = ARPrint()
if fromPrint {
ARPrint.instance?.start()
}
}
return ARPrint.instance!
}
/**
See Docs at https://gitlab.com/ArkitectureRepository/ARConsole
*/
public func start() {
self.started = true
self.isRecording = true
loadFromJSON()
self.listenVolumeButton()
self.autoSave()
}
public func addString(_ str:String, _ tag:String = "", colour:UIColor = ARPrint.defaultColor) {
/**
See Docs at https://gitlab.com/ArkitectureRepository/ARConsole
*/
public func addString(_ str:String, _ tag:String = "---", colour:UIColor = ARPrint.defaultColor) {
if !self.started {
print("Please start first the console. Read documentation https://gitlab.com/ArkitectureRepository/ARConsole.")
return
}
if self.isRecording {
if maxRecording > 0 && printStrings.count == maxRecording {
printStrings.remove(at: 0)
}
let str = ARPrintString.init(str, tag: tag, colour: colour)
printStrings.append(str)
......@@ -37,36 +83,167 @@ class ARPrint: NSObject {
}
}
private func autoSave() {
self.autoSaveQueue.async {
sleep(15)
self.saveJSON()
self.autoSave()
}
}
private func consoleChange() {
NotificationCenter.default.post(name: Notification.Name(ARPrint.NC_ARCONSOLE_CHANGED), object: nil)
}
/**
See Docs at https://gitlab.com/ArkitectureRepository/ARConsole
*/
public func showConsole() {
DispatchQueue.main.async {
let vc = ARConsoleViewController()
vc.consolePrints = self.getStrings()
if let appDelegate = UIApplication.shared.delegate as? NSObject {
if let wind = appDelegate.value(forKey: "window") as? UIWindow {
wind.rootViewController?.present(vc, animated: true, completion: nil)
}
if let window = self.getAppWindow() {
window.rootViewController?.present(vc, animated: true, completion: nil)
}
}
}
private func getAppWindow() -> UIWindow? {
if let appDelegate = UIApplication.shared.delegate as? NSObject {
if let wind = appDelegate.value(forKey: "window") as? UIWindow {
return wind
}
}
return nil
}
/**
See Docs at https://gitlab.com/ArkitectureRepository/ARConsole
*/
public func getStrings() -> [ARPrintString] {
let arr = printStrings.sorted{ $0.date < $1.date }
return arr
}
/**
See Docs at https://gitlab.com/ArkitectureRepository/ARConsole
*/
public func clearData() {
AKDiskManager.removeFile(ARPrint.ARCONSOLE_PATH + ARPrint.ARCONSOLE_FILE)
printStrings = []
self.consoleChange()
}
//VOLUME HANDLER ONLY DEBUG MODE
//MARK: - Load from JSON
private func loadFromJSON() {
if let arr = getJSON() {
for dic in arr {
if let arprintstr = ARPrintString.initialized(with: dic) {
self.printStrings.append(arprintstr)
}
}
var arrObj = getStrings()
if self.maxRecording > 0 {
let diference = arrObj.count - maxRecording
if diference > 0 {
for _ in 0..<diference {
arrObj.remove(at: 0)
}
self.printStrings = arrObj
}
}
}
}
//MARK: - Save JSON
private func saveJSON() {
if !isRecording { return }
var arr:[[String:Any]] = []
for obj in self.printStrings {
arr.append(obj.toDictionary())
}
let data = try! JSONSerialization.data(withJSONObject: arr, options: [])
AKDiskManager.writeFile(data: data, path: ARPrint.ARCONSOLE_PATH, fileName: ARPrint.ARCONSOLE_FILE)
}
private func getJSON() -> [[String:Any]]? {
let dat = AKDiskManager.readFile(ARPrint.ARCONSOLE_PATH + ARPrint.ARCONSOLE_FILE)
guard let data = dat else { return nil }
return try! JSONSerialization.jsonObject(with: data, options: []) as! [[String : Any]]
}
//MARK: - Share file
/**
See Docs at https://gitlab.com/ArkitectureRepository/ARConsole
*/
public func shareLogFile(_ completion:((Bool) -> ())? = nil) {
let recordingState = self.isRecording
self.isRecording = false
self.saveJSON()
let filePath = ARPrint.ARCONSOLE_PATH + ARPrint.ARCONSOLE_FILE
if FileManager.default.fileExists(atPath: filePath) {
let fileUrl = URL(fileURLWithPath: ARPrint.ARCONSOLE_PATH + ARPrint.ARCONSOLE_FILE)
let activityVC = UIActivityViewController(activityItems: [fileUrl], applicationActivities: nil)
if let window = getAppWindow() {
DispatchQueue.main.async {
window.rootViewController?.present(activityVC, animated: true, completion: {
if let completion = completion { completion(true) }
})
}
}
} else {
if let completion = completion { completion(false) }
}
self.isRecording = recordingState
}
//MARK: - VOLUME HANDLER ONLY DEBUG MODE
func listenVolumeButton(){
private func listenVolumeButton(){
let audioSession = AVAudioSession.sharedInstance()
try! audioSession.setActive(true)
......@@ -74,7 +251,7 @@ class ARPrint: NSObject {
options: NSKeyValueObservingOptions.new, context: nil)
}
override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) {
override public func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) {
if keyPath == "outputVolume" && showWithVolume{
let diference = Date().timeIntervalSince1970 - lastDateVolume.timeIntervalSince1970
......
......@@ -9,7 +9,7 @@
import UIKit
public func println(_ message: String, tag:String = "", colour:UIColor = ARPrint.defaultColor) {
ARPrint.sharedInstance.addString(message, tag, colour: colour)
ARPrint.sharedInstance(true).addString(message, tag, colour: colour)
print(message)
}
......
......@@ -8,7 +8,7 @@
import UIKit
class ARPrintString {
public class ARPrintString {
var date = Date()
var tag = ""
......@@ -21,6 +21,27 @@ class ARPrintString {
self.message = message
}
class func initialized(with dictionary:[String:Any]) -> ARPrintString? {
guard
let dat = dictionary["date"] as? Double,
let tag = dictionary["tag"] as? String,
let message = dictionary["message"] as? String,
let color = dictionary["colour"] as? String
else {
return nil
}
let date = Date.init(timeIntervalSince1970: dat)
let colour = UIColor.init(color)
let obj = ARPrintString(message, tag: tag, colour: colour)
obj.date = date
return obj
}
func getDateString() -> String {
let df = DateFormatter()
......@@ -30,4 +51,17 @@ class ARPrintString {
}
func toDictionary() -> [String:Any] {
var dic:[String:Any] = [:]
dic["date"] = self.date.timeIntervalSince1970
dic["tag"] = self.tag
dic["message"] = self.message
dic["colour"] = self.colour.toHexString
return dic
}
}
//
// Extension.swift
// ARConsole
//
// Created by Alvaro Royo on 22/8/17.
// Copyright © 2017 Alvaro Royo. All rights reserved.
//
import UIKit
extension UIColor {
var toHexString: String {
var r: CGFloat = 0
var g: CGFloat = 0
var b: CGFloat = 0
var a: CGFloat = 0
self.getRed(&r, green: &g, blue: &b, alpha: &a)
return String(
format: "#%02X%02X%02X",
Int(r * 0xff),
Int(g * 0xff),
Int(b * 0xff)
)
}
convenience init(_ hexColor: String) {
let hex = hexColor.replacingOccurrences(of: "#", with: "")
let scanner = Scanner(string: hex)
scanner.scanLocation = 0
var rgbValue: UInt64 = 0
scanner.scanHexInt64(&rgbValue)
let r = (rgbValue & 0xff0000) >> 16
let g = (rgbValue & 0xff00) >> 8
let b = rgbValue & 0xff
self.init(
red: CGFloat(r) / 0xff,
green: CGFloat(g) / 0xff,
blue: CGFloat(b) / 0xff, alpha: 1
)
}
}
//Remove when AKModel was upload
class AKDiskManager {
class func writeFile(data:Data!, path:String!, fileName:String!){
AKDiskManager.removeFile(path + fileName)
do{
try FileManager.default.createDirectory(atPath: path, withIntermediateDirectories: true, attributes: nil)
try data.write(to: URL(fileURLWithPath: path + fileName))
} catch {
print("Error al escribir el archivo: %@",path + fileName);
}
}
class func readFile(_ path:String!) -> Data? {
var data:Data? = nil
if FileManager.default.fileExists(atPath: path) {
do{
data = try Data.init(contentsOf: URL(fileURLWithPath: path))
} catch {
print("Error al leer el fichero: %@", path)
}
}
return data
}
class func removeFile(_ path:String!){
let fileManager = FileManager.default
if fileManager.fileExists(atPath: path) {
do{
try fileManager.removeItem(atPath: path)
} catch {
print("Error al borrar el fichero: %@",path);
}
}
}
}
//
// ARConsoleTableViewCell.swift
// CapitalManagement
//
// Created by Alvaro on 21/8/17.
// Copyright © 2017 Alvaro Royo. All rights reserved.
//
import UIKit
class ARConsoleTableViewCell: UITableViewCell {
let tagLbl = UILabel()
let dateLbl = UILabel()
let messageLbl = UILabel()
var lbls: [UILabel] = []
override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
self.selectionStyle = .none
lbls = [self.tagLbl,self.dateLbl,self.messageLbl]
let contentHeader = UIView()
contentHeader.layer.cornerRadius = 5
contentHeader.layer.borderWidth = 1
contentHeader.layer.borderColor = UIColor.lightGray.cgColor
contentHeader.translatesAutoresizingMaskIntoConstraints = false
self.contentView.addSubview(contentHeader)
let textFont = UIFont(name: "Courier", size: 17)
self.tagLbl.font = textFont
self.tagLbl.translatesAutoresizingMaskIntoConstraints = false
contentHeader.addSubview(self.tagLbl)
self.dateLbl.frame = CGRect(x: self.tagLbl.frame.maxX, y: 0, width: self.tagLbl.bounds.width, height: contentHeader.bounds.height)
self.dateLbl.font = UIFont(name: "Courier", size: 11)
self.dateLbl.textAlignment = .right
self.dateLbl.translatesAutoresizingMaskIntoConstraints = false
contentHeader.addSubview(self.dateLbl)
let separator = UIView()
separator.backgroundColor = UIColor.lightGray
separator.translatesAutoresizingMaskIntoConstraints = false
self.contentView.addSubview(separator)
self.messageLbl.font = textFont
self.messageLbl.numberOfLines = 0
self.messageLbl.translatesAutoresizingMaskIntoConstraints = false
self.contentView.addSubview(self.messageLbl)
self.contentView.backgroundColor = UIColor.clear
self.backgroundColor = UIColor.clear
//CONSTRAINTS
let margins = self.contentView.layoutMarginsGuide
contentHeader.heightAnchor.constraint(equalToConstant: 30).isActive = true
contentHeader.leadingAnchor.constraint(equalTo: margins.leadingAnchor, constant: -8).isActive = true
contentHeader.topAnchor.constraint(equalTo: margins.topAnchor, constant: 0).isActive = true
contentHeader.trailingAnchor.constraint(equalTo: margins.trailingAnchor, constant: 8).isActive = true
self.messageLbl.topAnchor.constraint(equalTo: contentHeader.bottomAnchor, constant: 18).isActive = true
self.messageLbl.heightAnchor.constraint(greaterThanOrEqualToConstant: 21).isActive = true
self.messageLbl.leadingAnchor.constraint(equalTo: contentHeader.leadingAnchor).isActive = true
self.messageLbl.trailingAnchor.constraint(equalTo: contentHeader.trailingAnchor).isActive = true
self.messageLbl.bottomAnchor.constraint(equalTo: margins.bottomAnchor, constant: -10).isActive = true
separator.heightAnchor.constraint(equalToConstant: 1).isActive = true
separator.leadingAnchor.constraint(equalTo: margins.leadingAnchor, constant: -8).isActive = true
separator.trailingAnchor.constraint(equalTo: margins.trailingAnchor, constant: 8).isActive = true
separator.topAnchor.constraint(equalTo: margins.bottomAnchor, constant: 9).isActive = true
let contentMargins = contentHeader.layoutMarginsGuide
self.tagLbl.heightAnchor.constraint(equalTo: contentHeader.heightAnchor, constant: 0).isActive = true
self.tagLbl.widthAnchor.constraint(equalTo: contentHeader.widthAnchor, multiplier: 0.45, constant: 0).isActive = true
self.tagLbl.leadingAnchor.constraint(equalTo: contentMargins.leadingAnchor, constant: 0).isActive = true
self.tagLbl.topAnchor.constraint(equalTo: contentMargins.topAnchor, constant: -8).isActive = true
self.dateLbl.heightAnchor.constraint(equalTo: self.tagLbl.heightAnchor).isActive = true
self.dateLbl.widthAnchor.constraint(equalTo: self.tagLbl.widthAnchor).isActive = true
self.dateLbl.trailingAnchor.constraint(equalTo: contentMargins.trailingAnchor, constant: 0).isActive = true
self.dateLbl.topAnchor.constraint(equalTo: self.tagLbl.topAnchor).isActive = true
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func setView(with string:ARPrintString){
tagLbl.text = string.tag
dateLbl.text = string.getDateString()
messageLbl.text = string.message
lbls.forEach{ $0.textColor = string.colour }
}
override func prepareForReuse() {
lbls.forEach{ lbl in
lbl.text = ""
lbl.textColor = ARPrint.defaultColor
}
}
}
......@@ -12,25 +12,84 @@ class ARConsoleViewController: UIViewController,UITableViewDataSource,UITableVie
var consolePrints:[ARPrintString]!
@IBOutlet weak var tableView: UITableView!
@IBOutlet weak var startStop: UISwitch!
var tableView = UITableView()
var startStop = UISwitch()
override func loadView() {
super.loadView()
self.view.backgroundColor = UIColor.black
let screenSize = UIScreen.main.bounds.size
let headerView = UIView(frame: CGRect(x: 0, y: 0, width: screenSize.width, height: 60))
headerView.backgroundColor = UIColor.clear
self.view.addSubview(headerView)
let separatorView = UIView(frame: CGRect(x: 0, y: headerView.frame.maxY - 2, width: screenSize.width, height: 2))
separatorView.backgroundColor = UIColor.lightGray
headerView.addSubview(separatorView)
let headerWidths = screenSize.width / 3
let closeBtn = UIButton(type: .system)
closeBtn.frame = CGRect(x: 0, y: 0, width: headerWidths, height: headerView.bounds.height)
closeBtn.setTitle("CLOSE", for: .normal)
closeBtn.addTarget(self, action: #selector(closeAction), for: .touchUpInside)
headerView.addSubview(closeBtn)
let clearBtn = UIButton(type: .system)
clearBtn.frame = CGRect(x: headerView.frame.maxX - headerWidths, y: 0, width: headerWidths, height: headerView.bounds.height)
clearBtn.setTitle("CLEAR", for: .normal)
clearBtn.addTarget(self, action: #selector(clearAction), for: .touchUpInside)
headerView.addSubview(clearBtn)
let startStopView = UIView(frame: CGRect(x: closeBtn.frame.maxX, y: 0, width: headerWidths, height: headerView.bounds.height))
startStopView.backgroundColor = UIColor.clear
headerView.addSubview(startStopView)
let startStopLbl = UILabel(frame: CGRect(x: 0, y: 5, width: headerWidths, height: 15))
startStopLbl.text = "Start/Stop"
startStopLbl.textAlignment = .center
startStopLbl.textColor = UIColor.white
startStopLbl.font = UIFont.systemFont(ofSize: 15)
startStopView.addSubview(startStopLbl)
self.startStop.frame = CGRect(x: 0, y: startStopLbl.frame.maxY + 4.5, width: 51, height: 31)
self.startStop.addTarget(self, action: #selector(startStopAction(_:)), for: .valueChanged)
self.startStop.center = CGPoint(x: headerWidths / 2, y: self.startStop.center.y)
startStopView.addSubview(self.startStop)
self.tableView.frame = CGRect(x: 0, y: headerView.frame.maxY, width: screenSize.width, height: screenSize.height - headerView.bounds.height)
self.tableView.backgroundColor = UIColor.clear
self.view.addSubview(self.tableView)
}
override func viewDidLoad() {
super.viewDidLoad()
UIApplication.shared.isStatusBarHidden = true
self.tableView.delegate = self
self.tableView.dataSource = self
self.tableView.estimatedRowHeight = 75
self.tableView.separatorStyle = .none
self.tableView.rowHeight = UITableViewAutomaticDimension
self.tableView.register(UINib.init(nibName: "ARConsoleTableViewCell", bundle: nil), forCellReuseIdentifier: "ARConsoleTableViewCell")
// self.tableView.register(UINib.init(nibName: "ARConsoleTableViewCell", bundle: nil), forCellReuseIdentifier: "ARConsoleTableViewCell")
startStop.isOn = ARPrint.sharedInstance.isRecording
startStop.isOn = ARPrint.sharedInstance().isRecording
NotificationCenter.default.addObserver(self, selector: #selector(reload), name: NSNotification.Name(ARPrint.NC_ARCONSOLE_CHANGED), object: nil)
}
override var prefersStatusBarHidden: Bool {
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
UIApplication.shared.isStatusBarHidden = false
}
override public var prefersStatusBarHidden: Bool {
return true
}
......@@ -41,7 +100,7 @@ class ARConsoleViewController: UIViewController,UITableViewDataSource,UITableVie
func reload() {
DispatchQueue.main.async {
self.consolePrints = ARPrint.sharedInstance.getStrings()
self.consolePrints = ARPrint.sharedInstance().getStrings()
self.tableView.reloadData()
if self.consolePrints.count > 0 {
self.tableView.scrollToRow(at: IndexPath.init(row: self.consolePrints.count - 1, section: 0), at: .bottom, animated: false)
......@@ -49,16 +108,16 @@ class ARConsoleViewController: UIViewController,UITableViewDataSource,UITableVie
}
}
@IBAction func startStop(_ sender: UISwitch) {
ARPrint.sharedInstance.isRecording = sender.isOn
func startStopAction(_ sender: UISwitch) {
ARPrint.sharedInstance().isRecording = sender.isOn
}
@IBAction func closeAction() {
func closeAction() {
self.dismiss(animated: true, completion: nil)
}
@IBAction func clearAction() {
ARPrint.sharedInstance.clearData()
func clearAction() {
ARPrint.sharedInstance().clearData()
}
// MARK: - Table view data source
......@@ -68,7 +127,13 @@ class ARConsoleViewController: UIViewController,UITableViewDataSource,UITableVie
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "ARConsoleTableViewCell", for: indexPath) as! ARConsoleTableViewCell
var _cell = tableView.dequeueReusableCell(withIdentifier: "ARConsoleTableViewCell") as? ARConsoleTableViewCell