Skip to content

Commit

Permalink
Add iOS boilerplate to keep pub publish happy
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
pmundt committed Jul 3, 2020
1 parent 6b9cbfb commit 2e00642
Show file tree
Hide file tree
Showing 6 changed files with 93 additions and 0 deletions.
37 changes: 37 additions & 0 deletions ios/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
.idea/
.vagrant/
.sconsign.dblite
.svn/

.DS_Store
*.swp
profile

DerivedData/
build/
GeneratedPluginRegistrant.h
GeneratedPluginRegistrant.m

.generated/

*.pbxuser
*.mode1v3
*.mode2v3
*.perspectivev3

!default.pbxuser
!default.mode1v3
!default.mode2v3
!default.perspectivev3

xcuserdata

*.moved-aside

*.pyc
*sync/
Icon?
.tags*

/Flutter/Generated.xcconfig
/Flutter/flutter_export_environment.sh
Empty file added ios/Assets/.gitkeep
Empty file.
4 changes: 4 additions & 0 deletions ios/Classes/FlutterWindowmanagerPlugin.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#import <Flutter/Flutter.h>

@interface FlutterWindowmanagerPlugin : NSObject<FlutterPlugin>
@end
15 changes: 15 additions & 0 deletions ios/Classes/FlutterWindowmanagerPlugin.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#import "FlutterWindowmanagerPlugin.h"
#if __has_include(<flutter_windowmanager/flutter_windowmanager-Swift.h>)
#import <flutter_windowmanager/flutter_windowmanager-Swift.h>
#else
// Support project import fallback if the generated compatibility header
// is not copied when this plugin is created as a library.
// https://forums.swift.org/t/swift-static-libraries-dont-copy-generated-objective-c-header/19816
#import "flutter_windowmanager-Swift.h"
#endif

@implementation FlutterWindowmanagerPlugin
+ (void)registerWithRegistrar:(NSObject<FlutterPluginRegistrar>*)registrar {
[SwiftFlutterWindowmanagerPlugin registerWithRegistrar:registrar];
}
@end
14 changes: 14 additions & 0 deletions ios/Classes/SwiftFlutterWindowmanagerPlugin.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import Flutter
import UIKit

public class SwiftFlutterWindowmanagerPlugin: NSObject, FlutterPlugin {
public static func register(with registrar: FlutterPluginRegistrar) {
let channel = FlutterMethodChannel(name: "flutter_windowmanager", binaryMessenger: registrar.messenger())
let instance = SwiftFlutterWindowmanagerPlugin()
registrar.addMethodCallDelegate(instance, channel: channel)
}

public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) {
result("iOS " + UIDevice.current.systemVersion)
}
}
23 changes: 23 additions & 0 deletions ios/flutter_windowmanager.podspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html.
# Run `pod lib lint flutter_windowmanager.podspec' to validate before publishing.
#
Pod::Spec.new do |s|
s.name = 'flutter_windowmanager'
s.version = '0.0.1'
s.summary = 'A new flutter plugin project.'
s.description = <<-DESC
A new flutter plugin project.
DESC
s.homepage = 'http://example.com'
s.license = { :file => '../LICENSE' }
s.author = { 'Your Company' => '[email protected]' }
s.source = { :path => '.' }
s.source_files = 'Classes/**/*'
s.dependency 'Flutter'
s.platform = :ios, '8.0'

# Flutter.framework does not contain a i386 slice. Only x86_64 simulators are supported.
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'VALID_ARCHS[sdk=iphonesimulator*]' => 'x86_64' }
s.swift_version = '5.0'
end

0 comments on commit 2e00642

Please sign in to comment.