UISearchController and Delphi

  

Delphi 10.2.1 + D.P.F Delphi iOS Native Components 9.6.1

Need help: trying to present a search controller over a navigation bar (video of effect) but can’t convert it correctly from Swift (source) to Delphi.

My try (just for example):

unit Unit1;

interface

uses
System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, iOSapi.UIKit,
DPF.iOS.UIButton, DPF.iOS.UITableView, DPF.iOS.BaseControl, DPF.iOS.UIView;

type
TForm1 = class(TForm)
DPFUIView1: TDPFUIView;
DPFUITableView1: TDPFUITableView;
DPFButton1: TDPFButton;
procedure DPFButton1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.fmx}

procedure TForm1.DPFButton1Click(Sender: TObject);
var
searchController: UISearchController;
searchResultsController: UISearchController;
storyboard: UIStoryboard;
begin
searchResultsController := UISearchController(nil);
searchController := UISearchController(searchResultsController);
searchController.setSearchResultsUpdater(searchResultsController);
searchController.setHidesNavigationBarDuringPresentation(False);
searchController.presentViewController(searchController, True, nil);
end;

end.

Is it possible at all?

p.s.
How to convert from

let searchResultsController = storyboard!.instantiateViewController(withIdentifier: SearchResultsViewController.StoryboardConstants.identifier) as! SearchResultsViewController

to Delphi? My variant is:

searchResultsController := storyboard.instantiateViewControllerWithIdentifier(StrToNSStr(”));

..but now I get an error:

[DCC Error] Unit1.pas(38): E2010 Incompatible types: ‘UIViewController’ and ‘Pointer’

Ok, in iOSapi.UIKit.pas I found:

function instantiateViewControllerWithIdentifier(identifier: NSString): Pointer; cdecl;

..but can’t find what’s the Pointer do I need to set up?

Comments are closed.