Files
MonsterCards/iOS/MonsterCards/Helpers/HTMLHelper.m
Tom Hicks caa1be50cf Cleans up code that generates HTML labels.
Adds Label for speed.
Makes the Monster Card refresh the monster from CoreData when the view is shown.
2020-09-26 15:09:46 -07:00

25 lines
792 B
Objective-C

//
// HtmlHelper.m
// MonsterCards
//
// Created by Tom Hicks on 9/12/20.
// Copyright © 2020 Tom Hicks. All rights reserved.
//
#import "HTMLHelper.h"
@import UIKit;
@implementation HTMLHelper
+ (NSAttributedString*)attributedStringFromHTML:(NSString *)htmlString {
NSData *data = [htmlString dataUsingEncoding:NSUTF8StringEncoding allowLossyConversion:YES];
NSDictionary *options = @{NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType,
NSCharacterEncodingDocumentAttribute: @(NSUTF8StringEncoding)};
return [[NSAttributedString alloc] initWithData:data
options:options
documentAttributes:nil
error:nil];
}
@end