-swift-version 4を渡すと4.1.50になります。
func load3DModel(from url: URL) -> SCNNode? { guard let scene = try? SCNScene(url: url, options: nil) else { なので、普通に SceneKit で読み込めそうですfunc receive(completion: @escaping (Data?, NWConnection.ContentContext?, Bool, NWError?) -> Void)ObjectMapperのエラー踏んだw https://github.com/Hearst-DD/ObjectMapper/issues/975Do Not Disturb を無視して通知する Critical Alertとか、お試し通知のAutomatic trialとか通知もオプションが増えて効果的な使い方が模索されそうimport turicreate as tc # Load the data data = tc.SFrame('cats-dogs.sframe') # Make a train-test split train_data, test_data = data.random_split(0.8) # Create the model model = tc.image_classifier.create(train_data, target='label') # Save predictions to an SArray predictions = model.predict(test_data) # Evaluate the model and save the results into a dictionary metrics = model.evaluate(test_data) print(metrics['accuracy']) # Save the model for later use in Turi Create model.save('mymodel.model') # Export for use in Core ML model.export_coreml('MyCustomImageClassifier.mlmodel')
https://apple.github.io/turicreate/docs/userguide/image_classifier/# Create the model model = tc.image_classifier.create(train_data, target='label')omochimetaru - Yesterday at 3:47 PM そのアプローチうまくいくのかな・・・ 理屈はわかるけど、共有部分のモデルをより賢いバージョンにアップデートしたい場合とかt.ae - Yesterday at 3:45 PM > Only available on macOS 10.14 and higher. This model is included in the operating system, so the exported model size is very small. convenience init() { let bundle = Bundle(for: ImageClassifier.self) let assetPath = bundle.url(forResource: "ImageClassifier", withExtension:"mlmodelc") try! self.init(contentsOf: assetPath!) } クラッシュするのは生成されたImageClassifier.swiftのコードがtry!だから・・・if #available で iOS 12 以降とそれ未満で分岐すればいいんじゃないかな。! つかうのはいいけど、自動生成も相まって、よくわからない ! になってしまっている。init(contentsOf:) がthrowsなんなら、 Bundleから読み込む init() のときだけLogic failureなのは辻褄あってない気がしますが。foo() throws を用いる関数 bar() が foo() throws がエラーを throw するようなケースを Logic failure とする事前条件を持つことはありえると思います。
(edited)init(contentsOf:) がthrowするのが、ファイルが存在しないときのみ、とかなら、Bundleに存在しないのはLogic Failureでいいと思うのですが、init() でもthrowしてほしいです。let assetPath = bundle.url(forResource: "ImageClassifier", withExtension:"mlmodelc") のファイルは OS にバンドルされてて、 iOS 12 以降だと必ず存在するという理解です。init(contentsOf:) がthrowするのが、ファイルが存在しないときのみ」なんですね。少なくとも外から観測される限りは。それならまあLogic failureにすることについては納得できます。./wwdc2018.swift --pdf-only してBooksアプリに突っ込んだ✅ https://t.co/m4pLXhK772let trainDir = URL.init(fileURLWithPath: "/Users/hiragram/Development/Fruits/Train/") let trainDataSource = MLImageClassifier.DataSource.labeledDirectories(at: trainDir)public struct MLImageClassifier { public init(trainingData: [String : [URL]], parameters: CreateML.MLImageClassifier.ModelParameters = default) throws こっち使うと動いたTuriCoreswift package init --type executable とか? (edited)xcode-selectでXcode 10 beta 1が選択されてるのにxcrun --show-sdk-pathが/Library/Developer/CommandLineTools/SDKs/MacOSX10.13.sdkを返す様になってしまってハマった。/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdkを返す様になった。[omochi@omochi-iMac-PC43 ~]$ sudo xcode-select -s /Applications/Xcode-beta.app/Contents/Developer [omochi@omochi-iMac-PC43 ~]$ xcrun --show-sdk-path /Library/Developer/CommandLineTools/SDKs/MacOSX10.13.sdk/usr/includeとかが存在しなくて、Homebrewとかでローカルビルドが走るパッケージとかのインストールに失敗した様な記憶がある。/Library/Developer/CommandLineToolsを削除してもbrew doctorは文句を言いませんね。Homebrewが変わったのかも。/usr/includeとかが存在しなくて /usr/includeが存在しないことを確認した。
~/Downloadsへ展開されるので、xipを書き込み可能なボリュームへコピーする必要はないみたい。12.0 (16A5308e)ですし…iOS 12がインストールされていません というエラーがでるのみ…xcodebuildで-parallel-testing-enabled YESの時って、テストからの標準出力とか全部出なくなる?arm64_32とarm64eっていうCPU Architectureが追加されてて、arm64_32はApple Watch Series 4みたいだけどarm64eが不明。Test target SourceKittenFrameworkTests encountered an error (Early unexpected exit, operation never finished bootstrapping - no restart will be attempted)
xcodebuildからのテストは問題なく動く…$ swift -v Apple Swift version 4.1.2 (swiftlang-902.0.54 clang-902.0.39.2) Target: x86_64-apple-darwin18.0.0 /Users/norio/Applications/Xcode.app/Contents/Developer/usr/bin/lldb "--repl=-enable-objc-interop -sdk /Users/norio/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk -color-diagnostics" error: failed to launch REPL process: process exited with status -1 (unable to attach) (edited)func testFirstNameNotEmpty() throws { let forenames: [String] = customer.forenames let firstName = try XCTUnwrap(forenames.first) XCTAssertFalse(firstName.isEmpty) }
XCTUnwrap便利 (edited) window.rootViewController = UIHostingController(rootView: LandmarkList())@EnvironmentObject var userData: UserData マジw仮想view.environmentObject(hogehoge) で渡せるみたいですね。どこまで手動で書かなきゃいけないかは不明My Mac (64-bit (x86_64h))ってなんぞ。Demand.unlimited ならいくらでもOK.xcworkspaceを.swiftpmに作るらしい。 $ tree .swiftpm .swiftpm └── xcode ├── package.xcworkspace │ ├── contents.xcworkspacedata │ ├── xcshareddata │ │ └── IDEWorkspaceChecks.plist │ └── xcuserdata │ └── norio.xcuserdatad │ └── UserInterfaceState.xcuserstate └── xcuserdata └── norio.xcuserdatad └── xcschemes └── xcschememanagement.plist 8 directories, 4 files.swiftpmって今もありましたっけ?.swiftpmの中にxcodeディレクトリを作ってるだけでlibSwiftPMを使ってるらしいです。xcodebuild -listなんかもPackageをちゃんと見てる風なメッセージでした $ xcodebuild -list Resolve Package Graph Resolved source packages: MyLibrary: /Users/ikesyo/Desktop/MyLibrary Information about workspace "MyLibrary": Schemes: MyLibrary (edited).swiftpm/xcode以下をリポジトリへ含めるかどうかは、今までのworkspaceに準ずれば良さそう。/tmpをカレントディレクトリとしてxctestを起動するため、カレントディレクトリがSRCROOTな前提でリソースを相対パスで取得していたりするテストが失敗する。RunLoop.mainを渡してるのを見た記憶が (edited)$userData.showFavoritesOnly これすごいややこしいことになってる@propertyDelegate @dynamicMemberLookup public struct EnvironmentObject<BindableObjectType> : DynamicViewProperty where BindableObjectType : BindableObject { public var delegateValue: ObjectBinding<BindableObjectType>.Wrapper { get } } (edited)@propertyDelegate public struct ObjectBinding<BindableObjectType> : DynamicViewProperty where BindableObjectType : BindableObject { /// A wrapper of the underlying `BindableObject` that can create `Binding`s to its properties /// using dynamic member lookup. @dynamicMemberLookup public struct Wrapper { /// Creates a `Binding` to a value semantic property of a reference type. /// /// If `Value` is not value semantic, the updating behavior for any views /// that make use of the resulting `Binding` is unspecified. public subscript<Subject>(dynamicMember keyPath: ReferenceWritableKeyPath<BindableObjectType, Subject>) -> Binding<Subject> { get } }xcodebuild -create-xcframework -framework path/to/Foo.framework -output path/to/Foo.xcframework... /* End XCConfigurationList section */ /* Begin XCRemoteSwiftPackageReference section */ 145C3D4E22A6EADA00EEAC8D /* XCRemoteSwiftPackageReference "KeychainAccess" */ = { isa = XCRemoteSwiftPackageReference; repositoryURL = "https://github.com/kishikawakatsumi/KeychainAccess"; requirement = { kind = upToNextMajorVersion; minimumVersion = 3.2.0; }; }; /* End XCRemoteSwiftPackageReference section */ /* Begin XCSwiftPackageProductDependency section */ 145C3D4F22A6EADA00EEAC8D /* KeychainAccess */ = { isa = XCSwiftPackageProductDependency; package = 145C3D4E22A6EADA00EEAC8D /* XCRemoteSwiftPackageReference "KeychainAccess" */; productName = KeychainAccess; }; /* End XCSwiftPackageProductDependency section */ }; rootObject = 145C3D2F22A6EA9C00EEAC8D /* Project object */; }xcodebuild -create-xcframework -help で使い方見れます$ xcodebuild -create-xcframework -help OVERVIEW: Utility for packaging multiple build configurations of a given library or framework into a single xcframework. USAGE: xcodebuild -create-xcframework -framework <path> [-framework <path>...] -output <path> xcodebuild -create-xcframework -library <path> [-headers <path>] [-library <path> [-headers <path>]...] -output <path> OPTIONS: -framework <path> Adds a framework from the given <path>. -library <path> Adds a static or dynamic library from the given <path>. -headers <path> Adds the headers from the given <path>. Only applicable with -library. -output <path> The <path> to write the xcframework to. -help Show this help content.$ tree Himotoki.xcframework Himotoki.xcframework ├── Info.plist ├── ios-armv7_arm64 │ └── Himotoki.framework │ ├── Headers │ │ ├── Himotoki-Swift.h │ │ └── Himotoki.h │ ├── Himotoki │ ├── Info.plist │ └── Modules │ ├── Himotoki.swiftmodule │ │ ├── arm.swiftdoc │ │ ├── arm.swiftmodule │ │ ├── arm64-apple-ios.swiftdoc │ │ ├── arm64-apple-ios.swiftmodule │ │ ├── arm64.swiftdoc │ │ ├── arm64.swiftmodule │ │ ├── armv7-apple-ios.swiftdoc │ │ ├── armv7-apple-ios.swiftmodule │ │ ├── armv7.swiftdoc │ │ └── armv7.swiftmodule │ └── module.modulemap └── ios-x86_64-simulator └── Himotoki.framework ├── Headers │ ├── Himotoki-Swift.h │ └── Himotoki.h ├── Himotoki ├── Info.plist ├── Modules │ ├── Himotoki.swiftmodule │ │ ├── x86_64-apple-ios-simulator.swiftdoc │ │ ├── x86_64-apple-ios-simulator.swiftmodule │ │ ├── x86_64.swiftdoc │ │ └── x86_64.swiftmodule │ └── module.modulemap └── _CodeSignature └── CodeResources こんな感じでした<?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"> <dict> <key>AvailableLibraries</key> <array> <dict> <key>LibraryIdentifier</key> <string>ios-x86_64-simulator</string> <key>LibraryPath</key> <string>Himotoki.framework</string> <key>SupportedArchitectures</key> <array> <string>x86_64</string> </array> <key>SupportedPlatform</key> <string>ios</string> <key>SupportedPlatformVariant</key> <string>simulator</string> </dict> <dict> <key>LibraryIdentifier</key> <string>ios-armv7_arm64</string> <key>LibraryPath</key> <string>Himotoki.framework</string> <key>SupportedArchitectures</key> <array> <string>armv7</string> <string>arm64</string> </array> <key>SupportedPlatform</key> <string>ios</string> </dict> </array> <key>CFBundlePackageType</key> <string>XFWK</string> <key>XCFrameworkFormatVersion</key> <string>1.0</string> </dict> </plist>│ ├── Himotoki.swiftmodule │ │ ├── arm.swiftdoc │ │ ├── arm.swiftmodule │ │ ├── arm64-apple-ios.swiftdoc │ │ ├── arm64-apple-ios.swiftmodule │ │ ├── arm64.swiftdoc │ │ ├── arm64.swiftmodule │ │ ├── armv7-apple-ios.swiftdoc │ │ ├── armv7-apple-ios.swiftmodule │ │ ├── armv7.swiftdoc │ │ └── armv7.swiftmodule#if archのバリエーションごとに swiftmodule が生成されてるんかな#if のプリプロセス分岐構造を保持できない?#is os が対応できないから、それはないかif MemoryLayout<Int>.size == 4 { print("32bit") } else if MemoryLayout<Int>.size == 8 { print("64bit") }xcodebuildならばiPhone 5 Simulatorでテスト走らせられるけど、GUIだとdestinationにiPhone 5 Simulatorが出てこないな。Package.swiftに platforms: [ .macOS("10.9"), .iOS(.v8), .tvOS(.v9), .watchOS(.v2) ], とか追加しても出てこない。シミュレーター用とデバイス用のframeworkは先にビルドした上で、xcframeworkの生成は次のコマンドで行えます: に書かれたコマンドから、-create-xcframeworkが抜けている様です。xedはPackage.swiftも開いてくれる様になったのね。 https://twitter.com/olebegemann/status/1136239375904333824Publisherという名前からも、Reactive Streamsに寄せている感じがある ForumでTony Parkerが "Combine is indeed based on the Reactive Streams spec, with a few small modifications that we felt were important." と書いてますね。 https://forums.swift.org/t/will-swiftnio-adapt-to-the-new-combine-framework/25166/11.xcodeprojがなくてもxcodebuild -scheme プロダクト名でPackage.swiftをビルド出来るのね。 $ la total 72 -rw-r--r--@ 1 norio staff 8.0K 6 9 14:07 .DS_Store drwxr-xr-x 5 norio staff 160B 6 9 14:08 .build/ drwxr-xr-x 3 norio staff 96B 4 1 19:54 .circleci/ drwxr-xr-x 17 norio staff 544B 6 9 14:17 .git/ drwxr-xr-x 3 norio staff 96B 12 25 20:56 .github/ -rw-r--r-- 1 norio staff 41B 4 29 2018 .gitignore -rw-r--r-- 1 norio staff 32B 11 14 2018 .swiftlint.yml drwxr-xr-x 3 norio staff 96B 6 9 14:12 .swiftpm/ -rw-r--r-- 1 norio staff 1.1K 5 2 2018 LICENSE -rw-r--r-- 1 norio staff 616B 6 9 14:12 Package.resolved -rw-r--r-- 1 norio staff 834B 4 1 19:54 Package.swift -rw-r--r-- 1 norio staff 1.5K 5 2 2018 README.md drwxr-xr-x 6 norio staff 192B 6 13 2018 Sources/ drwxr-xr-x 4 norio staff 128B 5 2 2018 Tests/ $ beta-xcodebuild -scheme SwiftBacktrace test 2>/dev/null|xcpretty ▸ Compiling Clibunwind.cpp ▸ Compiling CSwiftBacktrace.cpp ▸ Compiling c-atomics.c ▸ Linking Clibunwind.o ▸ Linking CSwiftBacktrace.o ▸ Linking CNIOAtomics.o ▸ Compiling atomics.swift ▸ Compiling lock.swift ▸ Linking NIOConcurrencyHelpers.o ▸ Compiling BacktraceFormatter.swift ▸ Compiling Demangle.swift ▸ Compiling DynamicLinkLibrary.swift ▸ Compiling String+extension.swift ▸ Compiling SwiftBacktrace.swift ▸ Compiling Unwind.swift ▸ Compiling shim.swift ▸ Compiling sigaction.swift ▸ Linking SwiftBacktrace.o ▸ Compiling SwiftBacktraceTests.swift ▸ Compiling XCTestManifests.swift ▸ Processing empty.plist ▸ Linking SwiftBacktraceTests ▸ Touching SwiftBacktraceTests.xctest (in target: SwiftBacktraceTests) All tests Test Suite SwiftBacktraceTests.xctest started SwiftBacktraceTests ✓ test_backtrace (0.234 seconds) ✓ test_cxxDemangle (0.002 seconds) ✓ test_setInterruptFunction (0.001 seconds) Executed 4 tests, with 0 failures (0 unexpected) in 0.241 (0.245) seconds ▸ Test Succeededxcodebuild -list using Xcode 11 with a Swift Package - xcode11-xcodebuild-list.md-destination使ってシミュレータでテスト走らせるのもいける。.xcodeprojが存在する場合にPackage.swiftを優先する方法はなさそう。rsync使ったら最大20MB毎秒くらい出た。 (edited)XCTMetric面白い。 class PerformanceTests: XCTestCase { override func measure(_ block: () -> Void) { if #available(macOS 10.15, iOS 13, tvOS 13, *) { let metrics: [XCTMetric] = [XCTClockMetric(), XCTCPUMetric(), XCTMemoryMetric(), XCTStorageMetric()] super.measure(metrics: metrics, block: block) } else { super.measure(block) } } …XCTMetricを使ったテスト結果を映してるWWDCのセッションあるかな?あるならスクショを堂々と表に出せるのだけど。 (edited)/Volumes/Macintosh HDとしてマウントされるMojaveのVolume中のファイルを使うと、普段使いのアプリ達がスペースを含むパスを正しく扱えるかどうかのテストも追加される事に。docker-machineは動かなかったけど、Docker for Mac 2.0.5.0が動くからなんとかなるかな。VMware Fusionを使ったdocker-machineも動く様になった。altoolの--apiKeyサポートはXcode 11からだった…~/Downloadsや~/Library/CloudStorage/iCloud DriveをNFSでexport出来ないポイ。 (edited)nfsdにフルディスクアクセスを許可してもダメだった。docker-machineでNFS使ってボリューム共有を高速化してて、共有するボリュームがそれらの配下にあって使えなかった。 (edited)altoolで使えるようになったApp Store Connect API Keyを使っているため、Apple IDのapp-specific passwordsとか不要になった。 https://github.com/norio-nomura/OctotreeForSafari/pull/9./private_keysに置けばaltoolが見つけてくれるとaltoolのコマンドラインヘルプに書かれてるが、見つけてくれない。FB6572761altoolを素で使うとJWTを標準出力に書き出してしまう(有効期限は30分だが、そのままApp Store Connect等へのBear認証が可能)為、OSSの公開CI等ではラッパーを利用する等してlog隠蔽が必要。altool --notarize-appのアップロードがめちゃめちゃ遅い。(このプロジェクトだとZIP圧縮470KBのアップロードに数分) まだドキュメントに無いオプションで調節できるらしいが未確認。https://twitter.com/rosyna/status/1146464491288219653mach-o/loader.hにMH_FILESET, LC_FILESET_ENTRY, fileset_entry_commandってのが追加されている事に気付いた。/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/mach-o/loader.hから引用 #define MH_FILESET 0xc /* a file composed of other Mach-Os to be run in the same userspace sharing a single linkedit. */ … #define LC_FILESET_ENTRY (0x35 | LC_REQ_DYLD) /* used with fileset_entry_command */ … /* * LC_FILESET_ENTRY commands describe constituent Mach-O files that are part * of a fileset. In one implementation, entries are dylibs with individual * mach headers and repositionable text and data segments. Each entry is * further described by its own mach header. */ struct fileset_entry_command { uint32_t cmd; /* LC_FILESET_ENTRY */ uint32_t cmdsize; /* includes entry_id string */ uint64_t vmaddr; /* memory address of the entry */ uint64_t fileoff; /* file offset of the entry */ union lc_str entry_id; /* contained entry id */ uint32_t reserved; /* reserved */ }; (edited)
6