Instantly share code, notes, and snippets.

View gist:3e21bf923ada7fd778af9e3b47d2e6ec
Summary:
The Xcode Export Localisation tool fails to correctly escape quotation marks and new line sequences when exporting via "Editor -> Export For Localization..." or via the xcodebuild command line tool.
The behaviour changed in Xcode 9.3 and has been broken ever since. I've included the "_SampleExport" folder that shows the results of the export when I run it on my machine. Xcode 9.2 produces the results as expected.
The result of this corrupt export means that many third party translation tools retain the escapes in the translated xliff files but when importing them via the import tool, it will corrupt the .strings files as the escaping is wrong. I have not covered an example of it in this report as I believe it will be fixed once the export issue is fixed however it is still worth noting.
Steps to Reproduce:
1. Download the attached sample project
2. Open the project in Xcode 10 (Beta 2)
View GalleryItemCell.swift
//
// GalleryItemCell.swift
// BrunchApp
//
// Created by Liam Nichols on 30/04/2017.
// Copyright © 2017 Bottomless Brunches. All rights reserved.
//
import UIKit
View WebImageCache.swift
import UIKit
extension URLSessionTask: WebImageOperation { }
protocol WebImageOperation {
func cancel()
}
class WebImageManager {
struct Error: Swift.Error {
View Config.swift
import Foundation
import FirebaseRemoteConfig
final class Config {
/// The shared instance of config to use
static let shared: Config = Config()
/// The maximum number of items that are allowed in this mystery app
internal let maxItemCount: Int
View SmallCaps.swift
public extension UIFont {
/// Helper method to create a UIFont with updated attributes applied to the UIFontDescriptor
///
/// - parameter attributes: The new attributes to apply to the fontDescriptor
///
/// - returns: A UIFont object with the new attributes appended to the receivers fontDescriptor
func addingAttributes(_ attributes: [String : Any] = [:]) -> UIFont {
return UIFont(descriptor: fontDescriptor.addingAttributes(attributes), size: pointSize)
View Launcher 1.3.6 LSApplicationQueriesSchemes
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
<string>fb254145378030027</string>
<string>isupr8</string>
<string>fb176151905794941</string>
<string>recipeSearch-iPad</string>
<string>airfile</string>
<string>univision</string>
View gist:ca7f752166bdc20f10a8
Incident Identifier: 2986E199-B268-464A-883E-362B59A00AD0
CrashReporter Key: c68af6ee22388954851f65669288c7fb6e1c03dc
Hardware Model: iPad4,1
OS Version: iPhone OS 7.1.2 (11D257)
Kernel Version: Darwin Kernel Version 14.0.0: Thu May 15 23:17:54 PDT 2014; root:xnu-2423.10.71~1/RELEASE_ARM64_S5L8960X
Date: 2014-10-21 09:58:46 +0100
Time since snapshot: 218 ms
Free pages: 1951
Active pages: 133010
View gist:8918881
+ (UIImage *)installButtonBackground:(BOOL)fill
{
CGFloat borderWidth = 1.0;
CGFloat cornerRadius = 3.0;
CGSize size = CGSizeMake((cornerRadius * 2) + 1.0, (cornerRadius * 2) + 1.0);
UIColor *buttonColor = [UIColor installButtonColor];
UIGraphicsBeginImageContextWithOptions(size, NO, 0.0);
UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:CGRectMake((borderWidth / 2), (borderWidth / 2), size.width - borderWidth, size.height - borderWidth) byRoundingCorners:UIRectCornerAllCorners cornerRadii:CGSizeMake(cornerRadius, cornerRadius)];
View gist:8283963
NSMutableAttributedString *string = [[NSMutableAttributedString alloc] init];
//Total Part
[string appendAttributedString:[[NSAttributedString alloc] initWithString:@"Total: " attributes:[self standardAttributes]]];
//Main Price Part
[string appendAttributedString:[[NSAttributedString alloc] initWithString:@"£99.10" attributes:[self boldAttributes]]];
View gist:7942200
NSFetchRequest *search = [NSFetchRequest fetchRequestWithEntityName:@"<<ENTITY NAME>>"];
search.resultType = NSDictionaryResultType;
search.returnsDistinctResults = YES;
search.propertiesToFetch = @[ @"<<ID KEY>>" ];
NSArray *results = [managedObjectContext executeFetchRequest:search error:nil];
NSSet *allIDs = [NSSet setWithArray:[results valueForKeyPath:@"<<ID KEY>>"]];