This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
struct SmapleView: View { | |
let font = Font.custom("HiraginoSans-W3", size: 50) | |
let borderColor = Color(.systemBlue) | |
var body: some View { | |
VStack(spacing: 10) { | |
Text("Copy") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension CKRecord { | |
public subscript<Root, Value: CKRecordValueProtocol>(keyPath keyPath: WritableKeyPath<Root, Value>) -> Value? { | |
get { | |
let key = NSExpression(forKeyPath: keyPath).keyPath | |
return self[key] | |
} | |
set { | |
let key = NSExpression(forKeyPath: keyPath).keyPath | |
self[key] = newValue | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension CKRecord { | |
subscript<Root, Value: CKRecordValueProtocol>(dynamicMember keyPath: WritableKeyPath<Root, Value>) -> Value? { | |
get { | |
let key = NSExpression(forKeyPath: keyPath).keyPath | |
return self[key] | |
} | |
set { | |
let key = NSExpression(forKeyPath: keyPath).keyPath | |
// Fatal error: Could not extract a String from KeyPath Swift.ReferenceWritableKeyPath | |
self[key] = newValue |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension CKRecord { | |
public subscript<Root, Value: CKRecordValueProtocol>(keyPath keyPath: WritableKeyPath<Root, Value>) -> Value? { | |
get { | |
let key = NSExpression(forKeyPath: keyPath).keyPath | |
return self[key] | |
} | |
set { | |
let key = NSExpression(forKeyPath: keyPath).keyPath | |
self[key] = newValue | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension CKRecord { | |
subscript<T: RawRepresentable>(key: T) -> CKRecordValueProtocol? where T.RawValue == CKRecord.FieldKey { | |
get { | |
return self[key.rawValue] | |
} | |
set { | |
self[key.rawValue] = newValue | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// TableViewCell.swift | |
// iOS12App | |
// | |
// Created by Kazuma Koze on 2020/03/05. | |
// Copyright © 2020 Climb App. All rights reserved. | |
// | |
import UIKit | |
import SwiftUI |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// TableViewCell.swift | |
// iOS12App | |
// | |
// Created by Kazuma Koze on 2020/03/05. | |
// Copyright © 2020 Climb App. All rights reserved. | |
// | |
import UIKit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// TableViewCellPreview.swift | |
// iOS12App | |
// | |
// Created by Kazuma Koze on 2020/03/05. | |
// Copyright © 2020 Climb App. All rights reserved. | |
// | |
import SwiftUI |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension AVSpeechSynthesisVoice { | |
class func currentLanguageCodeWorkaround() -> String { | |
if #available(iOS 13, *) { | |
for preferredLanguage in Locale.preferredLanguages { | |
let locale = Locale(identifier: preferredLanguage) | |
if let languageCode = locale.languageCode { | |
var voiceLanguage = languageCode | |
if let regionCode = locale.regionCode { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension AVSpeechSynthesisVoice { | |
private static let availableLanguages: Set<String> = Set(AVSpeechSynthesisVoice.speechVoices().map{ $0.language }) | |
class func currentLanguageCodeWorkaround() -> String { | |
if #available(iOS 13, *) { | |
if let preferredLanguage = Locale.preferredLanguages.first { | |
let locale = Locale(identifier: preferredLanguage) | |
if let languageCode = locale.languageCode, |