Skip to content

Instantly share code, notes, and snippets.

@ikesyo
ikesyo / Header.swift
Last active September 15, 2023 17:58
Header
// https://twitter.com/Kyomesuke/status/1702700847183151125
import SwiftUI
struct BiggerWidthPreferenceKey: PreferenceKey {
static var defaultValue: CGFloat { .zero }
static func reduce(value: inout CGFloat, nextValue: () -> CGFloat) {
value = max(value, nextValue())
}
@ikesyo
ikesyo / ScreenState.swift
Created September 3, 2023 16:13
ScreenState.swift
public enum ScreenState<Value, Error: Swift.Error> {
case loading
case failed(Error)
case empty
case loaded(Value)
public var isLoading: Bool {
if case .loading = self { return true }
return false
}
@ikesyo
ikesyo / arm64-apple-macos.swiftinterface
Created December 6, 2022 01:01
XcodeProjectPlugin.swiftmodule/arm64-apple-macos.swiftinterface
// swift-interface-format-version: 1.0
// swift-compiler-version: Apple Swift version 5.7.1 (swiftlang-5.7.1.135.3 clang-1400.0.29.51)
// swift-module-flags: -target arm64-apple-macos11.0 -enable-objc-interop -enable-library-evolution -swift-version 5 -enforce-exclusivity=checked -O -package-description-version 999.0 -module-link-name XcodeProjectPlugin -module-name XcodeProjectPlugin
// swift-module-flags-ignorable: -enable-bare-slash-regex -user-module-version 21508
import PackagePlugin
import Swift
public struct XcodeProject {
public let id: XcodeProjectPlugin.XcodeProject.ID
public typealias ID = Swift.String
public let displayName: Swift.String
@ikesyo
ikesyo / xcode11-xcodebuild-list.md
Last active June 4, 2019 06:50
`xcodebuild -list` using Xcode 11 with a Swift Package
$ xcodebuild -list
Resolve Package Graph

Resolved source packages:
  MyLibrary: /Users/ikesyo/Desktop/MyLibrary

Information about workspace "MyLibrary":
    Schemes:
 MyLibrary
@ikesyo
ikesyo / Kansaikt-#4.md
Last active August 9, 2020 01:19
Type aliasesによる互換性確保 #Kansaikt
@ikesyo
ikesyo / KMB24.md
Created August 29, 2017 10:18
Swift 4を見て触って気になっているところ #関モバ
#!/usr/bin/env bash
# Automatically installs swiftenv and run's swiftenv install.
# This script was designed for usage in CI systems.
git clone -b support-installing-previews --depth 1 https://github.com/ikesyo/swiftenv.git ~/.swiftenv
export SWIFTENV_ROOT="$HOME/.swiftenv"
export PATH="$SWIFTENV_ROOT/bin:$SWIFTENV_ROOT/shims:$PATH"
if [ -f ".swift-version" ] || [ -n "$SWIFT_VERSION" ]; then
swiftenv install -s
@ikesyo
ikesyo / JSONStringTransformer.swift
Last active March 14, 2016 04:43
Convert a JSON string into a valid JSON object
// https://twitter.com/watura/status/708164552882425856
import Himotoki
struct Foo: Decodable {
let JSON: [String: AnyJSON]
static func decode(e: Extractor) throws -> Foo {
let dictFromJSONStringTransformer = Transformer<String, [String: AnyJSON]> { string in
guard let data = string.dataUsingEncoding(NSUTF8StringEncoding) else {
diff --git a/Source/CarthageKit/Errors.swift b/Source/CarthageKit/Errors.swift
index f15cc3b..07ac87f 100644
--- a/Source/CarthageKit/Errors.swift
+++ b/Source/CarthageKit/Errors.swift
@@ -28,6 +28,9 @@ public enum CarthageError: ErrorType, Equatable {
/// a dependency.
case RequiredVersionNotFound(ProjectIdentifier, VersionSpecifier)
+ /// A git submodule didn't exist which is listed in `.gitmodules` entries.
+ case SubmoduleNotFound(String)
diff --git a/Source/CarthageKit/Resolver.swift b/Source/CarthageKit/Resolver.swift
index 884880b..4f20925 100644
--- a/Source/CarthageKit/Resolver.swift
+++ b/Source/CarthageKit/Resolver.swift
@@ -117,13 +117,13 @@ public struct Resolver {
private func resolveDependenciesFromNodePermutations(permutationsProducer: SignalProducer<[DependencyNode], CarthageError>) -> SignalProducer<DependencyGraph, CarthageError> {
return permutationsProducer
- .flatMap(.Concat) { rootNodes -> SignalProducer<Event<DependencyGraph, CarthageError>, CarthageError> in
+ .flatMap(.Concat) { rootNodes -> SignalProducer<DependencyGraph, CarthageError> in