-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[pigeon] added macos swift support (#2587)
- Loading branch information
Showing
10 changed files
with
135 additions
and
4 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
## 4.0.3 | ||
|
||
* [swift] Makes swift output work on macOS. | ||
|
||
## 4.0.2 | ||
|
||
* Fixes lint warnings. | ||
|
This file contains 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
This file contains 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
19 changes: 19 additions & 0 deletions
19
...igeon/platform_tests/macos_swift_unit_tests/macos/Classes/MacosSwiftUnitTestsPlugin.swift
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Copyright 2013 The Flutter Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
import Cocoa | ||
import FlutterMacOS | ||
|
||
public class MyApi: Api { | ||
public init() {} | ||
func getPlatform() -> String { | ||
return "macOS " + ProcessInfo.processInfo.operatingSystemVersionString | ||
} | ||
} | ||
|
||
public class MacosSwiftUnitTestsPlugin: NSObject, FlutterPlugin { | ||
public static func register(with registrar: FlutterPluginRegistrar) { | ||
ApiSetup.setUp(binaryMessenger: registrar.messenger, api: MyApi()) | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
packages/pigeon/platform_tests/macos_swift_unit_tests/macos/Tests/MessagesTest.swift
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// Copyright 2013 The Flutter Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
import XCTest | ||
import macos_swift_unit_tests | ||
|
||
class MessagesTest: XCTestCase { | ||
func testMakeApi() { | ||
let api = MyApi() | ||
XCTAssertNotNil(api) | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
packages/pigeon/platform_tests/macos_swift_unit_tests/macos/macos_swift_unit_tests.podspec
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# | ||
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html. | ||
# Run `pod lib lint macos_swift_unit_tests.podspec` to validate before publishing. | ||
# | ||
Pod::Spec.new do |s| | ||
s.name = 'macos_swift_unit_tests' | ||
s.version = '0.0.1' | ||
s.summary = 'Fake library that uses pigeon for macos for testing.' | ||
s.description = <<-DESC | ||
Fake library that uses pigeon for macos for testing. | ||
Use `pod lib lint` to run the tests. | ||
DESC | ||
s.homepage = 'http://example.com' | ||
s.license = { :type => 'Flutter', :file => '../../../LICENSE' } | ||
s.author = { 'Your Company' => 'email@example.com' } | ||
|
||
s.source = { :http => 'https://github.com/flutter/packages' } | ||
s.source_files = 'Classes/**/*' | ||
s.dependency 'FlutterMacOS' | ||
|
||
s.platform = :osx, '10.11' | ||
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' } | ||
s.swift_version = '5.0' | ||
|
||
s.test_spec 'Tests' do |test_spec| | ||
test_spec.source_files = 'Tests/*.{swift}' | ||
end | ||
end |
10 changes: 10 additions & 0 deletions
10
packages/pigeon/platform_tests/macos_swift_unit_tests/pigeons/messages.dart
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// Copyright 2013 The Flutter Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
import 'package:pigeon/pigeon.dart'; | ||
|
||
@HostApi() | ||
abstract class Api { | ||
String getPlatform(); | ||
} |
This file contains 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
This file contains 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
This file contains 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