diff --git a/HeatMapApp/BeaconsHeatmap.xcodeproj/project.pbxproj b/HeatMapApp/BeaconsHeatmap.xcodeproj/project.pbxproj index d4a61a2..cef3695 100644 --- a/HeatMapApp/BeaconsHeatmap.xcodeproj/project.pbxproj +++ b/HeatMapApp/BeaconsHeatmap.xcodeproj/project.pbxproj @@ -153,6 +153,20 @@ /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ + 146292D21BE6731000084733 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = E29DD3001B2B525C00179474 /* Charts.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = A52C5C371BAC5CA400594CDD; + remoteInfo = "Charts-TV"; + }; + 146292D41BE6731000084733 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = E29DD3001B2B525C00179474 /* Charts.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 06AEE7A21BDC3F8B009875AE; + remoteInfo = ChartsTests; + }; E21616121B2B534B0071908E /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = E29DD3001B2B525C00179474 /* Charts.xcodeproj */; @@ -707,6 +721,8 @@ isa = PBXGroup; children = ( E29DD3051B2B525C00179474 /* Charts.framework */, + 146292D31BE6731000084733 /* Charts.framework */, + 146292D51BE6731000084733 /* ChartsTests.xctest */, ); name = Products; sourceTree = ""; @@ -1829,12 +1845,13 @@ FA75B5E71A718DE500CA6DA8 /* Project object */ = { isa = PBXProject; attributes = { + LastSwiftUpdateCheck = 0710; LastUpgradeCheck = 0610; ORGANIZATIONNAME = "Citrusbyte LLC"; TargetAttributes = { FA75B5EE1A718DE500CA6DA8 = { CreatedOnToolsVersion = 6.1.1; - DevelopmentTeam = VKR5MNDXK9; + DevelopmentTeam = 693TQM7ZPK; }; FA75B6071A718DE500CA6DA8 = { CreatedOnToolsVersion = 6.1.1; @@ -1868,6 +1885,20 @@ /* End PBXProject section */ /* Begin PBXReferenceProxy section */ + 146292D31BE6731000084733 /* Charts.framework */ = { + isa = PBXReferenceProxy; + fileType = wrapper.framework; + path = Charts.framework; + remoteRef = 146292D21BE6731000084733 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 146292D51BE6731000084733 /* ChartsTests.xctest */ = { + isa = PBXReferenceProxy; + fileType = wrapper.cfbundle; + path = ChartsTests.xctest; + remoteRef = 146292D41BE6731000084733 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; E29DD3051B2B525C00179474 /* Charts.framework */ = { isa = PBXReferenceProxy; fileType = wrapper.framework; @@ -2164,11 +2195,13 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_IDENTITY = "iPhone Developer"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; EMBEDDED_CONTENT_CONTAINS_SWIFT = YES; INFOPLIST_FILE = BeaconsHeatmap/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE = ""; SWIFT_OBJC_BRIDGING_HEADER = "BeaconsHeatmap/BeaconsHeatmap-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; }; @@ -2179,11 +2212,14 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; EMBEDDED_CONTENT_CONTAINS_SWIFT = YES; INFOPLIST_FILE = BeaconsHeatmap/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE = ""; SWIFT_OBJC_BRIDGING_HEADER = "BeaconsHeatmap/BeaconsHeatmap-Bridging-Header.h"; }; name = Release; diff --git a/HeatMapApp/BeaconsHeatmap.xcodeproj/project.xcworkspace/xcshareddata/BeaconsHeatmap.xcscmblueprint b/HeatMapApp/BeaconsHeatmap.xcodeproj/project.xcworkspace/xcshareddata/BeaconsHeatmap.xcscmblueprint new file mode 100644 index 0000000..4f0193f --- /dev/null +++ b/HeatMapApp/BeaconsHeatmap.xcodeproj/project.xcworkspace/xcshareddata/BeaconsHeatmap.xcscmblueprint @@ -0,0 +1,44 @@ +{ + "DVTSourceControlWorkspaceBlueprintPrimaryRemoteRepositoryKey" : "CADED171714B8A2E2C216718E291DF8139CF0186", + "DVTSourceControlWorkspaceBlueprintWorkingCopyRepositoryLocationsKey" : { + + }, + "DVTSourceControlWorkspaceBlueprintWorkingCopyStatesKey" : { + "CADED171714B8A2E2C216718E291DF8139CF0186" : 0, + "9025163822AAEA7A2D8AC9210D0874A56F62B462" : 0, + "0E77FB9618B0A7E05C2EE27348151B7941044E77" : 0, + "0D47F9118801513CFF1019D3260A8450871FFE19" : 0 + }, + "DVTSourceControlWorkspaceBlueprintIdentifierKey" : "D883B6B9-57A7-4F99-B339-AC27B803571F", + "DVTSourceControlWorkspaceBlueprintWorkingCopyPathsKey" : { + "CADED171714B8A2E2C216718E291DF8139CF0186" : "beacons-positioning\/", + "9025163822AAEA7A2D8AC9210D0874A56F62B462" : "beacons-positioning\/HeatMapApp\/libs\/ios-charts\/", + "0E77FB9618B0A7E05C2EE27348151B7941044E77" : "beacons-positioning\/HeatMapApp\/libs\/SIOSocket\/", + "0D47F9118801513CFF1019D3260A8450871FFE19" : "beacons-positioning\/HeatMapApp\/libs\/LFHeatMap\/" + }, + "DVTSourceControlWorkspaceBlueprintNameKey" : "BeaconsHeatmap", + "DVTSourceControlWorkspaceBlueprintVersion" : 204, + "DVTSourceControlWorkspaceBlueprintRelativePathToProjectKey" : "HeatMapApp\/BeaconsHeatmap.xcodeproj", + "DVTSourceControlWorkspaceBlueprintRemoteRepositoriesKey" : [ + { + "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/gpolak\/LFHeatMap.git", + "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git", + "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "0D47F9118801513CFF1019D3260A8450871FFE19" + }, + { + "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "github.com:MegaBits\/SIOSocket.git", + "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git", + "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "0E77FB9618B0A7E05C2EE27348151B7941044E77" + }, + { + "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "github.com:danielgindi\/ios-charts.git", + "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git", + "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "9025163822AAEA7A2D8AC9210D0874A56F62B462" + }, + { + "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/NourDT\/beacons-positioning.git", + "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git", + "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "CADED171714B8A2E2C216718E291DF8139CF0186" + } + ] +} \ No newline at end of file diff --git a/HeatMapApp/BeaconsHeatmap/Base.lproj/LaunchScreen.xib b/HeatMapApp/BeaconsHeatmap/Base.lproj/LaunchScreen.xib index 9f2fef0..fca7207 100644 --- a/HeatMapApp/BeaconsHeatmap/Base.lproj/LaunchScreen.xib +++ b/HeatMapApp/BeaconsHeatmap/Base.lproj/LaunchScreen.xib @@ -1,7 +1,8 @@ - + - + + @@ -13,17 +14,20 @@ + diff --git a/HeatMapApp/BeaconsHeatmap/Base.lproj/Main.storyboard b/HeatMapApp/BeaconsHeatmap/Base.lproj/Main.storyboard index 1239327..407f87e 100644 --- a/HeatMapApp/BeaconsHeatmap/Base.lproj/Main.storyboard +++ b/HeatMapApp/BeaconsHeatmap/Base.lproj/Main.storyboard @@ -1,7 +1,8 @@ - + - + + @@ -19,13 +20,16 @@ + + + @@ -50,6 +54,7 @@ + @@ -83,23 +88,28 @@ + + + - + @@ -114,20 +125,25 @@ + + + - + @@ -142,25 +159,31 @@ + + + + @@ -168,28 +191,34 @@ + + + - + @@ -197,33 +226,40 @@ + + + - + @@ -233,20 +269,25 @@ + + + + @@ -254,6 +295,7 @@ + @@ -261,20 +303,25 @@ + + + - + @@ -289,14 +337,18 @@ + + + + + @@ -351,37 +405,50 @@ + + + + + + + + + @@ -404,51 +471,70 @@ + + + + + + + + + + + + + @@ -472,6 +558,7 @@ + @@ -488,21 +575,28 @@ + + + + + @@ -544,9 +638,11 @@ + + @@ -571,6 +667,7 @@ + diff --git a/HeatMapApp/BeaconsHeatmap/UIColorExtension.swift b/HeatMapApp/BeaconsHeatmap/UIColorExtension.swift index f077032..652a2b5 100644 --- a/HeatMapApp/BeaconsHeatmap/UIColorExtension.swift +++ b/HeatMapApp/BeaconsHeatmap/UIColorExtension.swift @@ -8,47 +8,115 @@ import UIKit +public enum UIColorInputError : ErrorType { + case MissingHashMarkAsPrefix, + UnableToScanHexValue, + MismatchedHexStringLength +} + extension UIColor { - convenience init(rgba: String) { - var red: CGFloat = 0.0 - var green: CGFloat = 0.0 - var blue: CGFloat = 0.0 - var alpha: CGFloat = 1.0 + /** + The shorthand three-digit hexadecimal representation of color. + #RGB defines to the color #RRGGBB. + + - parameter hex3: Three-digit hexadecimal value. + - parameter alpha: 0.0 - 1.0. The default is 1.0. + */ + public convenience init(hex3: UInt16, alpha: CGFloat = 1) { + let divisor = CGFloat(15) + let red = CGFloat((hex3 & 0xF00) >> 8) / divisor + let green = CGFloat((hex3 & 0x0F0) >> 4) / divisor + let blue = CGFloat( hex3 & 0x00F ) / divisor + self.init(red: red, green: green, blue: blue, alpha: alpha) + } + + /** + The shorthand four-digit hexadecimal representation of color with alpha. + #RGBA defines to the color #RRGGBBAA. + + - parameter hex4: Four-digit hexadecimal value. + */ + public convenience init(hex4: UInt16) { + let divisor = CGFloat(15) + let red = CGFloat((hex4 & 0xF000) >> 12) / divisor + let green = CGFloat((hex4 & 0x0F00) >> 8) / divisor + let blue = CGFloat((hex4 & 0x00F0) >> 4) / divisor + let alpha = CGFloat( hex4 & 0x000F ) / divisor + self.init(red: red, green: green, blue: blue, alpha: alpha) + } + + /** + The six-digit hexadecimal representation of color of the form #RRGGBB. + + - parameter hex6: Six-digit hexadecimal value. + */ + public convenience init(hex6: UInt32, alpha: CGFloat = 1) { + let divisor = CGFloat(255) + let red = CGFloat((hex6 & 0xFF0000) >> 16) / divisor + let green = CGFloat((hex6 & 0x00FF00) >> 8) / divisor + let blue = CGFloat( hex6 & 0x0000FF ) / divisor + self.init(red: red, green: green, blue: blue, alpha: alpha) + } + + /** + The six-digit hexadecimal representation of color with alpha of the form #RRGGBBAA. + + - parameter hex8: Eight-digit hexadecimal value. + */ + public convenience init(hex8: UInt32) { + let divisor = CGFloat(255) + let red = CGFloat((hex8 & 0xFF000000) >> 24) / divisor + let green = CGFloat((hex8 & 0x00FF0000) >> 16) / divisor + let blue = CGFloat((hex8 & 0x0000FF00) >> 8) / divisor + let alpha = CGFloat( hex8 & 0x000000FF ) / divisor + self.init(red: red, green: green, blue: blue, alpha: alpha) + } + + /** + The rgba string representation of color with alpha of the form #RRGGBBAA/#RRGGBB, throws error. + + - parameter rgba: String value. + */ + public convenience init(rgba_throws rgba: String) throws { + guard rgba.hasPrefix("#") else { + throw UIColorInputError.MissingHashMarkAsPrefix + } - if rgba.hasPrefix("#") { - let index = advance(rgba.startIndex, 1) - let hex = rgba.substringFromIndex(index) - let scanner = NSScanner(string: hex) - var hexValue: CUnsignedLongLong = 0 - if scanner.scanHexLongLong(&hexValue) { - switch (count(hex)) { - case 3: - red = CGFloat((hexValue & 0xF00) >> 8) / 15.0 - green = CGFloat((hexValue & 0x0F0) >> 4) / 15.0 - blue = CGFloat(hexValue & 0x00F) / 15.0 - case 4: - red = CGFloat((hexValue & 0xF000) >> 12) / 15.0 - green = CGFloat((hexValue & 0x0F00) >> 8) / 15.0 - blue = CGFloat((hexValue & 0x00F0) >> 4) / 15.0 - alpha = CGFloat(hexValue & 0x000F) / 15.0 - case 6: - red = CGFloat((hexValue & 0xFF0000) >> 16) / 255.0 - green = CGFloat((hexValue & 0x00FF00) >> 8) / 255.0 - blue = CGFloat(hexValue & 0x0000FF) / 255.0 - case 8: - red = CGFloat((hexValue & 0xFF000000) >> 24) / 255.0 - green = CGFloat((hexValue & 0x00FF0000) >> 16) / 255.0 - blue = CGFloat((hexValue & 0x0000FF00) >> 8) / 255.0 - alpha = CGFloat(hexValue & 0x000000FF) / 255.0 - default: - print("Invalid RGB string, number of characters after '#' should be either 3, 4, 6 or 8") - } - } else { - println("Scan hex error") - } - } else { - print("Invalid RGB string, missing '#' as prefix") + guard let hexString: String = rgba.substringFromIndex(rgba.startIndex.advancedBy(1)), + var hexValue: UInt32 = 0 + where NSScanner(string: hexString).scanHexInt(&hexValue) else { + throw UIColorInputError.UnableToScanHexValue + } + + guard hexString.characters.count == 3 + || hexString.characters.count == 4 + || hexString.characters.count == 6 + || hexString.characters.count == 8 else { + throw UIColorInputError.MismatchedHexStringLength + } + + switch (hexString.characters.count) { + case 3: + self.init(hex3: UInt16(hexValue)) + case 4: + self.init(hex4: UInt16(hexValue)) + case 6: + self.init(hex6: hexValue) + default: + self.init(hex8: hexValue) + } + } + + /** + The rgba string representation of color with alpha of the form #RRGGBBAA/#RRGGBB, fails to default color. + + - parameter rgba: String value. + */ + public convenience init(rgba: String, defaultColor: UIColor = UIColor.clearColor()) { + guard let color = try? UIColor(rgba_throws: rgba) else { + self.init(CGColor: defaultColor.CGColor) + return } - self.init(red:red, green:green, blue:blue, alpha:alpha) + self.init(CGColor: color.CGColor) } } \ No newline at end of file diff --git a/README.md b/README.md index 269d062..bbb2430 100644 --- a/README.md +++ b/README.md @@ -30,22 +30,12 @@ Since the real position of the device in a room is quite hard to figure out due In the Server/ directory you can find an old piece that was used as a receptor that received beacons signals and transmit them through an Socket.IO API. The server can run on a computer that has Bluetooth LE. -### Attributions - -Written by [Luis Floreani](https://github.com/lucholaf), sponsored by [Citrusbyte](https://citrusbyte.com/) -## About Citrusbyte +### Attributions +Written by [Luis Floreani](https://github.com/lucholaf), sponsored by [Citrusbyte](https://citrusbyte.com/). curr ![Citrusbyte](http://i.imgur.com/W6eISI3.png) - This software is lovingly maintained and funded by Citrusbyte. -At Citrusbyte, we specialize in solving difficult computer science problems for startups and the enterprise. -At Citrusbyte we believe in and support open source software. -* Check out more of our open source software at Citrusbyte Labs. -* Learn more about [our work](https://citrusbyte.com/portfolio). -* [Hire us](https://citrusbyte.com/contact) to work on your project. -* [Want to join the team?](http://careers.citrusbyte.com) -*Citrusbyte and the Citrusbyte logo are trademarks or registered trademarks of Citrusbyte, LLC.*