Skip to content

Commit 2e00642

Browse files
committed
Add iOS boilerplate to keep pub publish happy
Despite being an Android-only plugin, pub publish has taken it upon itself to reject any apps that do not include boilerplate iOS scaffolding, regardless of whether iOS is supported or not. This is supposed to be 'fixed' in the upcoming 1.20.0 release, but it makes little sense to constrain the plugin to a release that hasn't even happened yet. Rip this back out once Flutter behaves the way it should have from the beginning.
1 parent 6b9cbfb commit 2e00642

File tree

6 files changed

+93
-0
lines changed

6 files changed

+93
-0
lines changed

ios/.gitignore

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
.idea/
2+
.vagrant/
3+
.sconsign.dblite
4+
.svn/
5+
6+
.DS_Store
7+
*.swp
8+
profile
9+
10+
DerivedData/
11+
build/
12+
GeneratedPluginRegistrant.h
13+
GeneratedPluginRegistrant.m
14+
15+
.generated/
16+
17+
*.pbxuser
18+
*.mode1v3
19+
*.mode2v3
20+
*.perspectivev3
21+
22+
!default.pbxuser
23+
!default.mode1v3
24+
!default.mode2v3
25+
!default.perspectivev3
26+
27+
xcuserdata
28+
29+
*.moved-aside
30+
31+
*.pyc
32+
*sync/
33+
Icon?
34+
.tags*
35+
36+
/Flutter/Generated.xcconfig
37+
/Flutter/flutter_export_environment.sh

ios/Assets/.gitkeep

Whitespace-only changes.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#import <Flutter/Flutter.h>
2+
3+
@interface FlutterWindowmanagerPlugin : NSObject<FlutterPlugin>
4+
@end
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#import "FlutterWindowmanagerPlugin.h"
2+
#if __has_include(<flutter_windowmanager/flutter_windowmanager-Swift.h>)
3+
#import <flutter_windowmanager/flutter_windowmanager-Swift.h>
4+
#else
5+
// Support project import fallback if the generated compatibility header
6+
// is not copied when this plugin is created as a library.
7+
// https://forums.swift.org/t/swift-static-libraries-dont-copy-generated-objective-c-header/19816
8+
#import "flutter_windowmanager-Swift.h"
9+
#endif
10+
11+
@implementation FlutterWindowmanagerPlugin
12+
+ (void)registerWithRegistrar:(NSObject<FlutterPluginRegistrar>*)registrar {
13+
[SwiftFlutterWindowmanagerPlugin registerWithRegistrar:registrar];
14+
}
15+
@end
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import Flutter
2+
import UIKit
3+
4+
public class SwiftFlutterWindowmanagerPlugin: NSObject, FlutterPlugin {
5+
public static func register(with registrar: FlutterPluginRegistrar) {
6+
let channel = FlutterMethodChannel(name: "flutter_windowmanager", binaryMessenger: registrar.messenger())
7+
let instance = SwiftFlutterWindowmanagerPlugin()
8+
registrar.addMethodCallDelegate(instance, channel: channel)
9+
}
10+
11+
public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) {
12+
result("iOS " + UIDevice.current.systemVersion)
13+
}
14+
}

ios/flutter_windowmanager.podspec

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#
2+
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html.
3+
# Run `pod lib lint flutter_windowmanager.podspec' to validate before publishing.
4+
#
5+
Pod::Spec.new do |s|
6+
s.name = 'flutter_windowmanager'
7+
s.version = '0.0.1'
8+
s.summary = 'A new flutter plugin project.'
9+
s.description = <<-DESC
10+
A new flutter plugin project.
11+
DESC
12+
s.homepage = 'http://example.com'
13+
s.license = { :file => '../LICENSE' }
14+
s.author = { 'Your Company' => '[email protected]' }
15+
s.source = { :path => '.' }
16+
s.source_files = 'Classes/**/*'
17+
s.dependency 'Flutter'
18+
s.platform = :ios, '8.0'
19+
20+
# Flutter.framework does not contain a i386 slice. Only x86_64 simulators are supported.
21+
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'VALID_ARCHS[sdk=iphonesimulator*]' => 'x86_64' }
22+
s.swift_version = '5.0'
23+
end

0 commit comments

Comments
 (0)