Added TSMarkdownParser to show acknowlegements in app in markdown format

This commit is contained in:
Raimund Wege
2016-01-22 17:16:22 +01:00
parent 403c6b2e65
commit a732ea654f
27 changed files with 1299 additions and 423 deletions
+2
View File
@@ -3,9 +3,11 @@ platform :ios, '7.1'
link_with ['SAPTracker', 'SAPTrackerTests']
pod 'AFNetworking', '2.5.0'
pod 'AFNetworkActivityLogger', '2.0.3', :configurations => ['Debug']
pod 'TSMarkdownParser'
# Update acknowledgements in build settings
post_install do | installer |
require 'fileutils'
FileUtils.cp_r('Pods/Target Support Files/Pods/Pods-Acknowledgements.plist', 'SAPTracker/Settings.bundle/Acknowledgements.plist', :remove_destination => true)
FileUtils.cp_r('Pods/Target Support Files/Pods/Pods-Acknowledgements.markdown', 'SAPTracker/Acknowledgements.markdown', :remove_destination => true)
end
+3
View File
@@ -23,13 +23,16 @@ PODS:
- AFNetworking/UIKit (2.5.0):
- AFNetworking/NSURLConnection
- AFNetworking/NSURLSession
- TSMarkdownParser (1.0.19)
DEPENDENCIES:
- AFNetworkActivityLogger (= 2.0.3)
- AFNetworking (= 2.5.0)
- TSMarkdownParser
SPEC CHECKSUMS:
AFNetworkActivityLogger: e82c9ba285b37042d86729bff5b14036c4312cd7
AFNetworking: 96ac9bf3eda33582701cb1fcc5b896aa1e20311e
TSMarkdownParser: 0341662db14b17a13a79f3ddcb08ab7a4b6ed834
COCOAPODS: 0.38.2
@@ -0,0 +1 @@
../../../TSMarkdownParser/TSMarkdownParser/TSMarkdownParser.h
@@ -0,0 +1 @@
../../../TSMarkdownParser/TSMarkdownParser/TSMarkdownParser.h
+3
View File
@@ -23,13 +23,16 @@ PODS:
- AFNetworking/UIKit (2.5.0):
- AFNetworking/NSURLConnection
- AFNetworking/NSURLSession
- TSMarkdownParser (1.0.19)
DEPENDENCIES:
- AFNetworkActivityLogger (= 2.0.3)
- AFNetworking (= 2.5.0)
- TSMarkdownParser
SPEC CHECKSUMS:
AFNetworkActivityLogger: e82c9ba285b37042d86729bff5b14036c4312cd7
AFNetworking: 96ac9bf3eda33582701cb1fcc5b896aa1e20311e
TSMarkdownParser: 0341662db14b17a13a79f3ddcb08ab7a4b6ed834
COCOAPODS: 0.38.2
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2014 Tobias Sundstrand
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+84
View File
@@ -0,0 +1,84 @@
TSMarkdownParser
================
[![Build Status](https://travis-ci.org/laptobbe/TSMarkdownParser.svg)](https://travis-ci.org/laptobbe/TSMarkdownParser)
[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)
[![Version](https://img.shields.io/cocoapods/v/TSMarkdownParser.svg)](http://cocoadocs.org/docsets/TSMarkdownParser)
[![Platform](https://img.shields.io/cocoapods/p/TSMarkdownParser.svg)](http://cocoadocs.org/docsets/TSMarkdownParser)
[![Licence](https://img.shields.io/cocoapods/l/TSMarkdownParser.svg)](http://cocoadocs.org/docsets/TSMarkdownParser)
TSMarkdownParser is a markdown to NSAttributedString parser for iOS implemented using NSRegularExpressions. It supports many of the standard tags layed out by John Gruber on his site [Daring Fireball](http://daringfireball.net/projects/markdown/syntax). It is also very extendable via Regular Expressions making it easy to add your own custom tags or a totally different parsing syntax if you like.
#Supported tags
Below is a list of tags supported by the parser out of the box, to add your own tags see "Adding custom parsing"
````
Headings
# H1
## H2
### H3
#### H4
##### H5
###### H5
Lists
* item
+ item
- item
Images
![Alternative text](image.png)
URL
[Link text](https://www.example.net)
Emphasis
`code`
*Em*
_Em_
**Strong**
__Strong__
````
#Installation
TSMarkdownParser is distributed via CocoaPods
````
pod 'TSMarkdownParser'
````
alternativly you can clone the project and build the static library setup in the project, or drag the source files into you project.
#Usage
The standardParser class method provides a new instance of the parser configured to parse the tags listed above. You can also just create a new instance of TSMarkdownParser and add your own parsing. See "Adding custom parsing" for information on how to do this.
````
NSAttributedString *string = [[TSMarkdownParser standardParser] attributedStringFromMarkdown:markdown];
````
#Customizing appearance
You can configure how the markdown is to be displayed by changing the different properties on a TSMarkdownParser instance. Alternatively you could implement the parsing yourself and add custom attributes to the attributed string. You can also alter the attributed string returned from the parser.
#Adding custom parsing
Below is an example of how parsing of the bold tag is implemented. You can add your own parsing using the same addParsingRuleWithRegularExpression:withBlock: method. You can add a parsing rule to the standardParser or to your own instance of the parser. If you want to use any of the configuration properties within makesure you use a weak reference to the parser so you don't create a retain cycle.
````
NSRegularExpression *boldParsing = [NSRegularExpression regularExpressionWithPattern:@"(\\*|_){2}.*(\\*|_){2}" options:NSRegularExpressionCaseInsensitive error:nil];
__weak TSMarkdownParser *weakSelf = self;
[self addParsingRuleWithRegularExpression:boldParsing withBlock:^(NSTextCheckingResult *match, NSMutableAttributedString *attributedString) {
[attributedString addAttribute:NSFontAttributeName
value:weakSelf.strongFont
range:match.range];
[attributedString deleteCharactersInRange:NSMakeRange(match.range.location, 2)];
[attributedString deleteCharactersInRange:NSMakeRange(match.range.location+match.range.length-4, 2)];
}];
````
#License
TSMarkdownParser is distributed under a MIT licence, see the licence file for more info.
@@ -0,0 +1,62 @@
//
// TSMarkdownParser.h
// TSMarkdownParser
//
// Created by Tobias Sundstrand on 14-08-30.
// Copyright (c) 2014 Computertalk Sweden. All rights reserved.
//
#import <Foundation/Foundation.h>
typedef void (^TSMarkdownParserMatchBlock)(NSTextCheckingResult *match, NSMutableAttributedString *attributedString);
typedef void (^TSMarkdownParserFormattingBlock)(NSMutableAttributedString *attributedString, NSRange range);
@interface TSMarkdownParser : NSObject
@property (nonatomic, strong) UIFont *paragraphFont;
@property (nonatomic, strong) UIFont *strongFont;
@property (nonatomic, strong) UIFont *emphasisFont;
@property (nonatomic, strong) UIFont *h1Font;
@property (nonatomic, strong) UIFont *h2Font;
@property (nonatomic, strong) UIFont *h3Font;
@property (nonatomic, strong) UIFont *h4Font;
@property (nonatomic, strong) UIFont *h5Font;
@property (nonatomic, strong) UIFont *h6Font;
@property (nonatomic, strong) UIFont *monospaceFont;
@property (nonatomic, strong) UIColor *monospaceTextColor;
@property (nonatomic, strong) UIColor *linkColor;
@property (nonatomic, copy) NSNumber *linkUnderlineStyle;
+ (instancetype)standardParser;
- (NSAttributedString *)attributedStringFromMarkdown:(NSString *)markdown;
- (NSAttributedString *)attributedStringFromMarkdown:(NSString *)markdown attributes:(NSDictionary *)attributes;
- (NSAttributedString *)attributedStringFromAttributedMarkdownString:(NSAttributedString *)attributedString;
- (void)addParsingRuleWithRegularExpression:(NSRegularExpression *)regularExpression withBlock:(TSMarkdownParserMatchBlock)block;
- (void)addParagraphParsingWithFormattingBlock:(TSMarkdownParserFormattingBlock)formattingBlock;
/* block parsing */
- (void)addHeaderParsingWithLevel:(int)header formattingBlock:(TSMarkdownParserFormattingBlock)formattingBlock;
- (void)addListParsingWithFormattingBlock:(TSMarkdownParserFormattingBlock)formattingBlock;
/* bracket parsing */
- (void)addImageParsingWithImageFormattingBlock:(TSMarkdownParserFormattingBlock)formattingBlock alternativeTextFormattingBlock:(TSMarkdownParserFormattingBlock)alternativeFormattingBlock;
- (void)addLinkParsingWithFormattingBlock:(TSMarkdownParserFormattingBlock)formattingBlock;
/* inline parsing */
- (void)addMonospacedParsingWithFormattingBlock:(TSMarkdownParserFormattingBlock)formattingBlock;
- (void)addStrongParsingWithFormattingBlock:(TSMarkdownParserFormattingBlock)formattingBlock;
- (void)addEmphasisParsingWithFormattingBlock:(TSMarkdownParserFormattingBlock)formattingBlock;
@end
@@ -0,0 +1,326 @@
//
// TSMarkdownParser.m
// TSMarkdownParser
//
// Created by Tobias Sundstrand on 14-08-30.
// Copyright (c) 2014 Computertalk Sweden. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "TSMarkdownParser.h"
@interface TSExpressionBlockPair : NSObject
@property (nonatomic, strong) NSRegularExpression *regularExpression;
@property (nonatomic, strong) TSMarkdownParserMatchBlock block;
+ (TSExpressionBlockPair *)pairWithRegularExpression:(NSRegularExpression *)regularExpression block:(TSMarkdownParserMatchBlock)block;
@end
@implementation TSExpressionBlockPair
+ (TSExpressionBlockPair *)pairWithRegularExpression:(NSRegularExpression *)regularExpression block:(TSMarkdownParserMatchBlock)block {
TSExpressionBlockPair *pair = [TSExpressionBlockPair new];
pair.regularExpression = regularExpression;
pair.block = block;
return pair;
}
@end
@interface TSMarkdownParser ()
@property (nonatomic, strong) NSMutableArray *parsingPairs;
@property (nonatomic, copy) void (^paragraphParsingBlock)(NSMutableAttributedString *attributedString);
@end
@implementation TSMarkdownParser
- (instancetype)init {
self = [super init];
if(self) {
_parsingPairs = [NSMutableArray array];
_paragraphFont = [UIFont systemFontOfSize:12];
_strongFont = [UIFont boldSystemFontOfSize:12];
_emphasisFont = [UIFont italicSystemFontOfSize:12];
_h1Font = [UIFont boldSystemFontOfSize:23];
_h2Font = [UIFont boldSystemFontOfSize:21];
_h3Font = [UIFont boldSystemFontOfSize:19];
_h4Font = [UIFont boldSystemFontOfSize:17];
_h5Font = [UIFont boldSystemFontOfSize:15];
_h6Font = [UIFont boldSystemFontOfSize:13];
_linkColor = [UIColor blueColor];
_linkUnderlineStyle = @(NSUnderlineStyleSingle);
_monospaceFont = [UIFont fontWithName:@"Menlo" size:12];
_monospaceTextColor = [UIColor colorWithRed:0.95 green:0.54 blue:0.55 alpha:1];
}
return self;
}
+ (instancetype)standardParser {
TSMarkdownParser *defaultParser = [TSMarkdownParser new];
__weak TSMarkdownParser *weakParser = defaultParser;
[defaultParser addParagraphParsingWithFormattingBlock:^(NSMutableAttributedString *attributedString, NSRange range) {
[attributedString addAttribute:NSFontAttributeName
value:weakParser.paragraphFont
range:range];
}];
/* block parsing */
[defaultParser addHeaderParsingWithLevel:1 formattingBlock:^(NSMutableAttributedString *attributedString, NSRange range) {
[attributedString addAttribute:NSFontAttributeName
value:weakParser.h1Font
range:range];
}];
[defaultParser addHeaderParsingWithLevel:2 formattingBlock:^(NSMutableAttributedString *attributedString, NSRange range) {
[attributedString addAttribute:NSFontAttributeName
value:weakParser.h2Font
range:range];
}];
[defaultParser addHeaderParsingWithLevel:3 formattingBlock:^(NSMutableAttributedString *attributedString, NSRange range) {
[attributedString addAttribute:NSFontAttributeName
value:weakParser.h3Font
range:range];
}];
[defaultParser addHeaderParsingWithLevel:4 formattingBlock:^(NSMutableAttributedString *attributedString, NSRange range) {
[attributedString addAttribute:NSFontAttributeName
value:weakParser.h4Font
range:range];
}];
[defaultParser addHeaderParsingWithLevel:5 formattingBlock:^(NSMutableAttributedString *attributedString, NSRange range) {
[attributedString addAttribute:NSFontAttributeName
value:weakParser.h5Font
range:range];
}];
[defaultParser addHeaderParsingWithLevel:6 formattingBlock:^(NSMutableAttributedString *attributedString, NSRange range) {
[attributedString addAttribute:NSFontAttributeName
value:weakParser.h6Font
range:range];
}];
[defaultParser addListParsingWithFormattingBlock:^(NSMutableAttributedString *attributedString, NSRange range) {
[attributedString replaceCharactersInRange:range withString:@"\t"];
}];
/* bracket parsing */
[defaultParser addImageParsingWithImageFormattingBlock:^(NSMutableAttributedString *attributedString, NSRange range) {
// no additional formatting
} alternativeTextFormattingBlock:^(NSMutableAttributedString *attributedString, NSRange range) {
// no additional formatting
}];
[defaultParser addLinkParsingWithFormattingBlock:^(NSMutableAttributedString *attributedString, NSRange range) {
[attributedString addAttribute:NSUnderlineStyleAttributeName
value:weakParser.linkUnderlineStyle
range:range];
[attributedString addAttribute:NSForegroundColorAttributeName
value:weakParser.linkColor
range:range];
}];
/* inline parsing */
[defaultParser addMonospacedParsingWithFormattingBlock:^(NSMutableAttributedString *attributedString, NSRange range) {
[attributedString addAttribute:NSFontAttributeName
value:weakParser.monospaceFont
range:range];
[attributedString addAttribute:NSForegroundColorAttributeName
value:weakParser.monospaceTextColor
range:range];
}];
[defaultParser addStrongParsingWithFormattingBlock:^(NSMutableAttributedString *attributedString, NSRange range) {
[attributedString addAttribute:NSFontAttributeName
value:weakParser.strongFont
range:range];
}];
[defaultParser addEmphasisParsingWithFormattingBlock:^(NSMutableAttributedString *attributedString, NSRange range) {
[attributedString addAttribute:NSFontAttributeName
value:weakParser.emphasisFont
range:range];
}];
return defaultParser;
}
// block regex
static NSString *const TSMarkdownHeaderRegex = @"^(#{%i}\\s{1})(?!#).*$";
static NSString *const TSMarkdownListRegex = @"^(\\*|\\+|\\-)[^\\*].+$";
// bracket regex
static NSString *const TSMarkdownImageRegex = @"\\!\\[.*?\\]\\(\\S*\\)";
static NSString *const TSMarkdownLinkRegex = @"(?<!\\!)\\[.*?\\]\\([^\\)]*\\)";
// inline regex
static NSString *const TSMarkdownMonospaceRegex = @"(`+)\\s*([\\s\\S]*?[^`])\\s*\\1(?!`)";
static NSString *const TSMarkdownStrongRegex = @"([\\*|_]{2}).+?\\1";
static NSString *const TSMarkdownEmRegex = @"([\\*|_]{1}).+?\\1";
- (void)addParagraphParsingWithFormattingBlock:(void(^)(NSMutableAttributedString *attributedString, NSRange range))formattingBlock {
self.paragraphParsingBlock = ^(NSMutableAttributedString *attributedString) {
formattingBlock(attributedString, NSMakeRange(0, attributedString.length));
};
}
#pragma mark block parsing
- (void)addHeaderParsingWithLevel:(int)header formattingBlock:(TSMarkdownParserFormattingBlock)formattingBlock {
NSString *headerRegex = [NSString stringWithFormat:TSMarkdownHeaderRegex, header];
NSRegularExpression *headerExpression = [NSRegularExpression regularExpressionWithPattern:headerRegex options:0 | NSRegularExpressionAnchorsMatchLines error:nil];
[self addParsingRuleWithRegularExpression:headerExpression withBlock:^(NSTextCheckingResult *match, NSMutableAttributedString *attributedString) {
formattingBlock(attributedString, match.range);
[attributedString deleteCharactersInRange:[match rangeAtIndex:1]];
}];
}
- (void)addListParsingWithFormattingBlock:(TSMarkdownParserFormattingBlock)formattingBlock {
NSRegularExpression *listParsing = [NSRegularExpression regularExpressionWithPattern:TSMarkdownListRegex options:0|NSRegularExpressionAnchorsMatchLines error:nil];
[self addParsingRuleWithRegularExpression:listParsing withBlock:^(NSTextCheckingResult *match, NSMutableAttributedString *attributedString) {
formattingBlock(attributedString, NSMakeRange(match.range.location, 1));
}];
}
#pragma mark bracket parsing
- (void)addImageParsingWithImageFormattingBlock:(TSMarkdownParserFormattingBlock)formattingBlock alternativeTextFormattingBlock:(TSMarkdownParserFormattingBlock)alternativeFormattingBlock {
NSRegularExpression *headerExpression = [NSRegularExpression regularExpressionWithPattern:TSMarkdownImageRegex options:0 error:nil];
[self addParsingRuleWithRegularExpression:headerExpression withBlock:^(NSTextCheckingResult *match, NSMutableAttributedString *attributedString) {
NSUInteger imagePathStart = [attributedString.string rangeOfString:@"(" options:0 range:match.range].location;
NSRange linkRange = NSMakeRange(imagePathStart, match.range.length+match.range.location- imagePathStart -1);
NSString *imagePath = [attributedString.string substringWithRange:NSMakeRange(linkRange.location+1, linkRange.length-1)];
UIImage *image = [UIImage imageNamed:imagePath];
if(image){
[attributedString deleteCharactersInRange:match.range];
NSTextAttachment *imageAttachment = [NSTextAttachment new];
imageAttachment.image = image;
imageAttachment.bounds = CGRectMake(0, -5, image.size.width, image.size.height);
NSAttributedString *imgStr = [NSAttributedString attributedStringWithAttachment:imageAttachment];
NSRange imageRange = NSMakeRange(match.range.location, 1);
[attributedString insertAttributedString:imgStr atIndex:match.range.location];
if(formattingBlock) {
formattingBlock(attributedString, imageRange);
}
} else {
NSUInteger linkTextEndLocation = [attributedString.string rangeOfString:@"]" options:0 range:match.range].location;
NSRange linkTextRange = NSMakeRange(match.range.location+2, linkTextEndLocation-match.range.location-2);
NSString *alternativeText = [attributedString.string substringWithRange:linkTextRange];
if(alternativeFormattingBlock) {
alternativeFormattingBlock(attributedString, match.range);
}
[attributedString replaceCharactersInRange:match.range withString:alternativeText];
}
}];
}
- (void)addLinkParsingWithFormattingBlock:(TSMarkdownParserFormattingBlock)formattingBlock {
NSRegularExpression *linkParsing = [NSRegularExpression regularExpressionWithPattern:TSMarkdownLinkRegex options:0 error:nil];
[self addParsingRuleWithRegularExpression:linkParsing withBlock:^(NSTextCheckingResult *match, NSMutableAttributedString *attributedString) {
NSUInteger linkStartInResult = [attributedString.string rangeOfString:@"(" options:NSBackwardsSearch range:match.range].location;
NSRange linkRange = NSMakeRange(linkStartInResult, match.range.length+match.range.location-linkStartInResult-1);
NSString *linkURLString = [attributedString.string substringWithRange:NSMakeRange(linkRange.location+1, linkRange.length-1)];
NSURL *url = [NSURL URLWithString:linkURLString] ?: [NSURL URLWithString:
[linkURLString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
NSUInteger linkTextEndLocation = [attributedString.string rangeOfString:@"]" options:0 range:match.range].location;
NSRange linkTextRange = NSMakeRange(match.range.location, linkTextEndLocation-match.range.location-1);
[attributedString deleteCharactersInRange:NSMakeRange(match.range.location, 1)];
[attributedString deleteCharactersInRange:NSMakeRange(linkRange.location-2, linkRange.length+2)];
if (url) {
[attributedString addAttribute:NSLinkAttributeName
value:url
range:linkTextRange];
}
formattingBlock(attributedString, linkTextRange);
}];
}
#pragma mark inline parsing
- (void)addMonospacedParsingWithFormattingBlock:(TSMarkdownParserFormattingBlock)formattingBlock {
NSRegularExpression *monoParsing = [NSRegularExpression regularExpressionWithPattern:TSMarkdownMonospaceRegex options:0 error:nil];
[self addParsingRuleWithRegularExpression:monoParsing withBlock:^(NSTextCheckingResult *match, NSMutableAttributedString *attributedString) {
formattingBlock(attributedString, match.range);
[attributedString deleteCharactersInRange:NSMakeRange(match.range.location, 1)];
[attributedString deleteCharactersInRange:NSMakeRange((match.range.location + match.range.length - 2), 1)];
}];
}
- (void)addStrongParsingWithFormattingBlock:(void(^)(NSMutableAttributedString *attributedString, NSRange range))formattingBlock {
NSRegularExpression *boldParsing = [NSRegularExpression regularExpressionWithPattern:TSMarkdownStrongRegex options:0 error:nil];
[self addParsingRuleWithRegularExpression:boldParsing withBlock:^(NSTextCheckingResult *match, NSMutableAttributedString *attributedString) {
formattingBlock(attributedString, match.range);
[attributedString deleteCharactersInRange:NSMakeRange(match.range.location, 2)];
[attributedString deleteCharactersInRange:NSMakeRange(match.range.location+match.range.length-4, 2)];
}];
}
- (void)addEmphasisParsingWithFormattingBlock:(TSMarkdownParserFormattingBlock)formattingBlock {
NSRegularExpression *emphasisParsing = [NSRegularExpression regularExpressionWithPattern:TSMarkdownEmRegex options:0 error:nil];
[self addParsingRuleWithRegularExpression:emphasisParsing withBlock:^(NSTextCheckingResult *match, NSMutableAttributedString *attributedString) {
formattingBlock(attributedString, match.range);
[attributedString deleteCharactersInRange:NSMakeRange(match.range.location, 1)];
[attributedString deleteCharactersInRange:NSMakeRange(match.range.location+match.range.length-2, 1)];
}];
}
#pragma mark -
- (void)addParsingRuleWithRegularExpression:(NSRegularExpression *)regularExpression withBlock:(TSMarkdownParserMatchBlock)block {
@synchronized (self) {
[self.parsingPairs addObject:[TSExpressionBlockPair pairWithRegularExpression:regularExpression block:block]];
}
}
- (NSAttributedString *)attributedStringFromMarkdown:(NSString *)markdown attributes:(NSDictionary *)attributes {
NSAttributedString *attributedString = nil;
if (! attributes) {
attributedString = [[NSAttributedString alloc] initWithString:markdown];
} else {
attributedString = [[NSAttributedString alloc] initWithString:markdown attributes:attributes];
}
return [self attributedStringFromAttributedMarkdownString:attributedString];
}
- (NSAttributedString *)attributedStringFromMarkdown:(NSString *)markdown {
return [self attributedStringFromMarkdown:markdown attributes:nil];
}
- (NSAttributedString *)attributedStringFromAttributedMarkdownString:(NSAttributedString *)attributedString {
NSMutableAttributedString *mutableAttributedString = [[NSMutableAttributedString alloc] initWithAttributedString:attributedString];
if (self.paragraphParsingBlock) {
self.paragraphParsingBlock(mutableAttributedString);
}
@synchronized (self) {
for (TSExpressionBlockPair *expressionBlockPair in self.parsingPairs) {
NSTextCheckingResult *match;
while((match = [expressionBlockPair.regularExpression firstMatchInString:mutableAttributedString.string options:0 range:NSMakeRange(0, mutableAttributedString.string.length)])){
expressionBlockPair.block(match, mutableAttributedString);
}
}
}
return mutableAttributedString;
}
@end
@@ -1,5 +1,5 @@
#include "AFNetworkActivityLogger.xcconfig"
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/AFNetworkActivityLogger" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/AFNetworkActivityLogger" "${PODS_ROOT}/Headers/Public/AFNetworking"
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/AFNetworkActivityLogger" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/AFNetworkActivityLogger" "${PODS_ROOT}/Headers/Public/AFNetworking" "${PODS_ROOT}/Headers/Public/TSMarkdownParser"
PODS_ROOT = ${SRCROOT}
SKIP_INSTALL = YES
@@ -1,6 +1,6 @@
#include "AFNetworking.xcconfig"
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/AFNetworking" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/AFNetworkActivityLogger" "${PODS_ROOT}/Headers/Public/AFNetworking"
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/AFNetworking" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/AFNetworkActivityLogger" "${PODS_ROOT}/Headers/Public/AFNetworking" "${PODS_ROOT}/Headers/Public/TSMarkdownParser"
OTHER_LDFLAGS = ${AFNETWORKING_OTHER_LDFLAGS}
PODS_ROOT = ${SRCROOT}
SKIP_INSTALL = YES
@@ -46,4 +46,28 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
## TSMarkdownParser
The MIT License (MIT)
Copyright (c) 2014 Tobias Sundstrand
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Generated by CocoaPods - http://cocoapods.org
@@ -66,6 +66,34 @@ THE SOFTWARE.
<key>Type</key>
<string>PSGroupSpecifier</string>
</dict>
<dict>
<key>FooterText</key>
<string>The MIT License (MIT)
Copyright (c) 2014 Tobias Sundstrand
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.</string>
<key>Title</key>
<string>TSMarkdownParser</string>
<key>Type</key>
<string>PSGroupSpecifier</string>
</dict>
<dict>
<key>FooterText</key>
<string>Generated by CocoaPods - http://cocoapods.org</string>
@@ -1,5 +1,5 @@
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/AFNetworkActivityLogger" "${PODS_ROOT}/Headers/Public/AFNetworking"
OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/AFNetworkActivityLogger" -isystem "${PODS_ROOT}/Headers/Public/AFNetworking"
OTHER_LDFLAGS = $(inherited) -ObjC -l"AFNetworkActivityLogger" -l"AFNetworking" -framework "CoreGraphics" -framework "MobileCoreServices" -framework "Security" -framework "SystemConfiguration"
HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/AFNetworkActivityLogger" "${PODS_ROOT}/Headers/Public/AFNetworking" "${PODS_ROOT}/Headers/Public/TSMarkdownParser"
OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/AFNetworkActivityLogger" -isystem "${PODS_ROOT}/Headers/Public/AFNetworking" -isystem "${PODS_ROOT}/Headers/Public/TSMarkdownParser"
OTHER_LDFLAGS = $(inherited) -ObjC -l"AFNetworkActivityLogger" -l"AFNetworking" -l"TSMarkdownParser" -framework "CoreGraphics" -framework "MobileCoreServices" -framework "Security" -framework "SystemConfiguration" -framework "UIKit"
PODS_ROOT = ${SRCROOT}/Pods
@@ -1,5 +1,5 @@
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/AFNetworkActivityLogger" "${PODS_ROOT}/Headers/Public/AFNetworking"
OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/AFNetworkActivityLogger" -isystem "${PODS_ROOT}/Headers/Public/AFNetworking"
OTHER_LDFLAGS = $(inherited) -ObjC -l"AFNetworking" -framework "CoreGraphics" -framework "MobileCoreServices" -framework "Security" -framework "SystemConfiguration"
HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/AFNetworkActivityLogger" "${PODS_ROOT}/Headers/Public/AFNetworking" "${PODS_ROOT}/Headers/Public/TSMarkdownParser"
OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/AFNetworkActivityLogger" -isystem "${PODS_ROOT}/Headers/Public/AFNetworking" -isystem "${PODS_ROOT}/Headers/Public/TSMarkdownParser"
OTHER_LDFLAGS = $(inherited) -ObjC -l"AFNetworking" -l"TSMarkdownParser" -framework "CoreGraphics" -framework "MobileCoreServices" -framework "Security" -framework "SystemConfiguration" -framework "UIKit"
PODS_ROOT = ${SRCROOT}/Pods
@@ -0,0 +1,6 @@
#include "TSMarkdownParser.xcconfig"
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/TSMarkdownParser" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/AFNetworkActivityLogger" "${PODS_ROOT}/Headers/Public/AFNetworking" "${PODS_ROOT}/Headers/Public/TSMarkdownParser"
OTHER_LDFLAGS = ${TSMARKDOWNPARSER_OTHER_LDFLAGS}
PODS_ROOT = ${SRCROOT}
SKIP_INSTALL = YES
@@ -0,0 +1,5 @@
#import <Foundation/Foundation.h>
@interface PodsDummy_TSMarkdownParser : NSObject
@end
@implementation PodsDummy_TSMarkdownParser
@end
@@ -0,0 +1,4 @@
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#endif
@@ -0,0 +1 @@
TSMARKDOWNPARSER_OTHER_LDFLAGS = -framework "UIKit"
@@ -317,6 +317,8 @@
7FED45C81A25F5900022505F /* competitor1.json in Resources */ = {isa = PBXBuildFile; fileRef = 7FED45C21A25F5900022505F /* competitor1.json */; };
7FED45CA1A25F5910022505F /* event1.json in Resources */ = {isa = PBXBuildFile; fileRef = 7FED45C41A25F5900022505F /* event1.json */; };
7FED45CC1A25F5910022505F /* leaderboard1.json in Resources */ = {isa = PBXBuildFile; fileRef = 7FED45C61A25F5900022505F /* leaderboard1.json */; };
C8603D4A1C528832002B2F28 /* Acknowledgements.markdown in Sources */ = {isa = PBXBuildFile; fileRef = C8603D491C528832002B2F28 /* Acknowledgements.markdown */; };
C8603D511C52892A002B2F28 /* Acknowledgements.markdown in Resources */ = {isa = PBXBuildFile; fileRef = C8603D491C528832002B2F28 /* Acknowledgements.markdown */; };
C8A4400B1C18153600DF70A0 /* Settings.bundle in Resources */ = {isa = PBXBuildFile; fileRef = C8A4400A1C18153600DF70A0 /* Settings.bundle */; };
C8BBAC791C52649E004CA551 /* LicenseViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8BBAC781C52649E004CA551 /* LicenseViewController.swift */; };
/* End PBXBuildFile section */
@@ -329,6 +331,13 @@
remoteGlobalIDString = 7F83F14F19F154F000C53328;
remoteInfo = SAPTracker;
};
C8603D4E1C528832002B2F28 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = C8B31F771B68DAD400C8A809 /* Pods.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 8FC739D532E373E38AFCF317DFA76500;
remoteInfo = TSMarkdownParser;
};
C89A171B1B6A27CF00CE6814 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = C8B31F771B68DAD400C8A809 /* Pods.xcodeproj */;
@@ -354,7 +363,7 @@
isa = PBXContainerItemProxy;
containerPortal = C8B31F771B68DAD400C8A809 /* Pods.xcodeproj */;
proxyType = 1;
remoteGlobalIDString = A6D0CE1BA9EEBE59D9198973ED1466CE;
remoteGlobalIDString = 467DF12115DC5581D85E26096CC7D16D;
remoteInfo = Pods;
};
/* End PBXContainerItemProxy section */
@@ -677,6 +686,7 @@
7FED45C21A25F5900022505F /* competitor1.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = competitor1.json; sourceTree = "<group>"; };
7FED45C41A25F5900022505F /* event1.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = event1.json; sourceTree = "<group>"; };
7FED45C61A25F5900022505F /* leaderboard1.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = leaderboard1.json; sourceTree = "<group>"; };
C8603D491C528832002B2F28 /* Acknowledgements.markdown */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = Acknowledgements.markdown; sourceTree = "<group>"; };
C8A4400A1C18153600DF70A0 /* Settings.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = Settings.bundle; sourceTree = "<group>"; };
C8B31F771B68DAD400C8A809 /* Pods.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = Pods.xcodeproj; path = Pods/Pods.xcodeproj; sourceTree = "<group>"; };
C8BBAC781C52649E004CA551 /* LicenseViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LicenseViewController.swift; sourceTree = "<group>"; };
@@ -1111,6 +1121,7 @@
7F83F15319F154F000C53328 /* Supporting Files */ = {
isa = PBXGroup;
children = (
C8603D491C528832002B2F28 /* Acknowledgements.markdown */,
7F83F15419F154F000C53328 /* Info.plist */,
7F03FD3F19FA4D7400FA1327 /* bridge.h */,
C8A4400A1C18153600DF70A0 /* Settings.bundle */,
@@ -1152,6 +1163,7 @@
C89A171C1B6A27CF00CE6814 /* libAFNetworkActivityLogger.a */,
C89A171E1B6A27CF00CE6814 /* libAFNetworking.a */,
C8B31F7E1B68DAD500C8A809 /* libPods.a */,
C8603D4F1C528832002B2F28 /* libTSMarkdownParser.a */,
);
name = Products;
sourceTree = "<group>";
@@ -1241,6 +1253,13 @@
/* End PBXProject section */
/* Begin PBXReferenceProxy section */
C8603D4F1C528832002B2F28 /* libTSMarkdownParser.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libTSMarkdownParser.a;
remoteRef = C8603D4E1C528832002B2F28 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
C89A171C1B6A27CF00CE6814 /* libAFNetworkActivityLogger.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
@@ -1269,6 +1288,7 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
C8603D511C52892A002B2F28 /* Acknowledgements.markdown in Resources */,
7F14A1EC1A13B9A6001C1ECB /* SZ.png in Resources */,
7F14A1C91A13B9A6001C1ECB /* PE.png in Resources */,
7F14A1881A13B9A6001C1ECB /* IT.png in Resources */,
@@ -1598,6 +1618,7 @@
7FCDB6641A1636610075D7D9 /* LeaderBoard.swift in Sources */,
7F509AC01A69549D0043EC69 /* AcceptTermsViewController.swift in Sources */,
7F72C73A1A2DC51900F48EE8 /* SplashScreenDummy.swift in Sources */,
C8603D4A1C528832002B2F28 /* Acknowledgements.markdown in Sources */,
7F8B8D411A373B0200C34B88 /* SpeedViewController.swift in Sources */,
7FD9D3031A1236080058FEAD /* Extensions.swift in Sources */,
7F0658FD19F7D6700077FF95 /* ScanViewController.swift in Sources */,
@@ -23,10 +23,6 @@ class AboutViewController: UIViewController {
presentingViewController!.dismissViewControllerAnimated(true, completion: nil)
}
@IBAction func openLicenses(sender: AnyObject) {
}
@IBAction func openEULA(sender: AnyObject) {
let url = NSURL(string: "http://www.sap.com")!
UIApplication.sharedApplication().openURL(url)
@@ -0,0 +1,73 @@
# Acknowledgements
This application makes use of the following third party libraries:
## AFNetworkActivityLogger
Copyright (c) 2013 AFNetworking (http://afnetworking.com/)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
## AFNetworking
Copyright (c) 2013-2014 AFNetworking (http://afnetworking.com/)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
## TSMarkdownParser
The MIT License (MIT)
Copyright (c) 2014 Tobias Sundstrand
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Generated by CocoaPods - http://cocoapods.org
@@ -1014,7 +1014,7 @@
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
</userDefinedRuntimeAttributes>
<connections>
<action selector="openLicenses:" destination="WMr-pC-C12" eventType="touchUpInside" id="FXR-m9-IRA"/>
<segue destination="awJ-L8-hjX" kind="show" id="0cD-Vt-sEk"/>
</connections>
</button>
</subviews>
@@ -1070,6 +1070,41 @@
</objects>
<point key="canvasLocation" x="1582" y="1320"/>
</scene>
<!--License View Controller-->
<scene sceneID="MBL-hy-9wn">
<objects>
<viewController id="awJ-L8-hjX" customClass="LicenseViewController" customModule="SAPTracker" customModuleProvider="target" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="fPl-15-sxR"/>
<viewControllerLayoutGuide type="bottom" id="Pqy-JO-DGY"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="2bf-uW-10v">
<rect key="frame" x="0.0" y="64" width="600" height="536"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" editable="NO" textAlignment="natural" translatesAutoresizingMaskIntoConstraints="NO" id="4xj-vs-c49">
<rect key="frame" x="0.0" y="0.0" width="600" height="536"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
</textView>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="Pqy-JO-DGY" firstAttribute="top" secondItem="4xj-vs-c49" secondAttribute="bottom" id="2nr-GJ-3GD"/>
<constraint firstItem="4xj-vs-c49" firstAttribute="leading" secondItem="2bf-uW-10v" secondAttribute="leading" id="Gdw-ER-0IJ"/>
<constraint firstAttribute="trailing" secondItem="4xj-vs-c49" secondAttribute="trailing" id="k9H-pu-VSe"/>
<constraint firstItem="4xj-vs-c49" firstAttribute="top" secondItem="fPl-15-sxR" secondAttribute="bottom" id="sD8-Uf-YVw"/>
</constraints>
</view>
<connections>
<outlet property="licenseTextView" destination="4xj-vs-c49" id="a5c-f2-Ipi"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="vvK-XG-FQT" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1582" y="2046"/>
</scene>
<!--Settings-->
<scene sceneID="yOw-OU-u8M">
<objects>
@@ -10,4 +10,18 @@ import UIKit
class LicenseViewController: UIViewController {
@IBOutlet weak var licenseTextView: UITextView!
override func viewDidLoad() {
super.viewDidLoad()
if let file = NSBundle.mainBundle().pathForResource("Acknowledgements", ofType: "markdown") {
let license = try? NSString(contentsOfFile: file, encoding: NSUTF8StringEncoding)
if (license != nil) {
licenseTextView.attributedText = TSMarkdownParser.standardParser().attributedStringFromMarkdown(license! as String)
licenseTextView.layoutIfNeeded()
licenseTextView.setContentOffset(CGPoint.zero, animated: false)
}
}
}
}
@@ -66,6 +66,34 @@ THE SOFTWARE.
<key>Type</key>
<string>PSGroupSpecifier</string>
</dict>
<dict>
<key>FooterText</key>
<string>The MIT License (MIT)
Copyright (c) 2014 Tobias Sundstrand
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.</string>
<key>Title</key>
<string>TSMarkdownParser</string>
<key>Type</key>
<string>PSGroupSpecifier</string>
</dict>
<dict>
<key>FooterText</key>
<string>Generated by CocoaPods - http://cocoapods.org</string>
@@ -10,6 +10,7 @@
#define SAPTracker_bridge_h
#import <AFNetworking/AFNetworking.h>
#import <TSMarkdownParser/TSMarkdownParser.h>
#import "UIImageView+AFNetworking.h"
#import "Appearance.h"