èè ã«çºèšæš©ãäžããŸãã
1.ç°å¢ã®ã»ããã¢ãã
Xamarin.Formséçºè ãæåã«çŽé¢ããã®ã¯ãå¿«é©ãªã¬ãã«ãããã¯ããã«é·ããããžã§ã¯ãã®é·ããã«ãã§ãã ããã¯ãã¢ã»ã³ããªäžã«å€æ°ã®ãã¡ã€ã«ãäœæããã³æŽæ°ãããããã§ãã
ã¢ã»ã³ããªãé«éåããã«ã¯ããœãŒã¹ãã©ã«ããRAMãã£ã¹ã¯ã«è»¢éããã ãã§ãã ããã¯ãRAMã®äžéšãMacãã¡ã€ã«ã·ã¹ãã ã®ããŒã«ã«ãã£ã¹ã¯ãŸãã¯ãã©ã«ããŒãšããŠäœ¿çšãããå Žåã§ãã äœã倱ãããªãããã«ãRAMãã£ã¹ã¯ã®ããŒã¿ã¯ã¿ã€ããŒã§SSDã«ä¿åãããŸãã ãŸã éåžžã®ããŒããã£ã¹ã¯ãã©ã€ãïŒHDDïŒãããå Žåã¯ãééããªãSSDã«ã¢ããã°ã¬ãŒãããå¿ èŠããããŸãã 4GB RAM +åªããSSDã¯ããã«ããèããé«éåããŸãã çŽ1æ¡ã
ãããã¯ãŒã¯äžã«ã¯ãRAMãã£ã¹ã¯ãæäœããããã®ããŸããŸãªãŠãŒãã£ãªãã£ãšãããããæäœããããã®æé ããããŸãã
2. Xamarinã®ããã«ããã¯
ä»ã®ããŒã«ãšåæ§ã«ãã¢ããªã±ãŒã·ã§ã³ãäœæãããšãã¯ãXamarin.Formsã®æ©èœãç解ããå¿ èŠããããŸãã ã¢ããªã±ãŒã·ã§ã³ã®ã¿ã¹ã¯ããå€æ°ã®ã¢ãã¡ãŒã·ã§ã³ãšéæšæºã€ã³ã¿ãŒãã§ãŒã¹ã§ãŠãŒã¶ãŒãé©ãããããšã§ããå Žåãã¯ãã¹ãã©ãããã©ãŒã ãã¬ãŒã ã¯ãŒã¯ã¯æè¯ã®éžæã§ã¯ãããŸããã ããããæ¯èŒçéçãªããžãã¹ã¢ããªã±ãŒã·ã§ã³ã®å Žåã¯ãã¯ããã«åªããŠããŸãã
Xamarin.Formsã¯åŸæ¥ã®Xamarin.iOSããã³Xamarin.Androidã®ã¢ããªã³ã§ããããããããã®ããã«ããã¯ãç解ããå¿ èŠããããŸãã 以äžã¯ãXamarin.iOSããã³Xamarin.Androidäžã®ã¢ããªã±ãŒã·ã§ã³ã®ã¢ãŒããã¯ãã£ã§ãã
Xamarin-applicationã¯ããã€ãã£ããšã¯ãã¹ãã©ãããã©ãŒã ïŒMonoç°å¢ïŒã®2ã€ã®éšåã§æ§æãããŠããŸãã ãããã®éšåã¯ãç¹å¥ãªããªããžãä»ããŠäºãã«éä¿¡ããŸãã Monoç°å¢ã®ã©ãããŒã¯ãåãã€ãã£ãã¯ã©ã¹ãšã¿ã€ãã®åšãã«äœæãããŸãã ããã€ãã£ãããããã¯ãã¹ãã©ãããã©ãŒã ããžã®ç§»è¡ã§ããŒã¿ã転éããŠã¡ãœãããåŒã³åºããšãããã©ãŒãã³ã¹ããããã«äœäžããããããããå¿ ãèæ ®ããå¿ èŠããããŸãã
ããšãã°ãããŒã¿ãèšç®ããŠæäœãããšãã¯ããã€ãã£ãç°å¢ïŒnfloatïŒã§ã¯ãªããMonoç°å¢ïŒCïŒ/ãNETïŒã®åãšã¯ã©ã¹ã䜿çšããŸãã ãŸããCïŒã³ãŒãããã®UIã®å¶åŸ¡ãæå°éã«æããå¿ èŠããããŸãã ããšãã°ãã¢ãã¡ãŒã·ã§ã³ãå®è¡ããããã¯ãã¹ãã©ãããã©ãŒã ããŒãããã«ãŒãã§UIãéäžçã«æŽæ°ãããããªãã§ãã ããã ãã¬ãŒããããã£ãŠããããã§ã¯ãããŸããããUIã®å€§èŠæš¡ãªèšç®ãšå€§èŠæš¡ãªå¶åŸ¡ïŒéåæã§åä¿¡ããããŒã¿ãšããŸããŸãªã¢ãã¡ãŒã·ã§ã³ãå«ãå€æ°ã®èŠçŽ ïŒã䜿çšãããšããŠãŒã¶ãŒã«é¡èãªäžèŠãªé 延ãçºçããå¯èœæ§ããããŸãã
ããã¯Xamarin.Formsã«å®å šã«é©çšãããiOSãAndroidïŒããã³Windows UWPãmac OSãGTKïŒãTizenã®ããŒããžã®ãŠãŒã¶ãŒã€ã³ã¿ãŒãã§ã€ã¹ãšãã©ãããã©ãŒã æ©èœãåããæè»ã§é«æ§èœãªäœæ¥å±€ã®äž¡æ¹ãæäŸãããšããå°é£ãªã¿ã¹ã¯ã解決ããŸãããèæ ®ããªãã§ãã ããïŒã ãããŠããå°å ãçŸæ£ã®ã»ãšãã©ã¯ãã§ã«å æãããŠãããšããäºå®ã«ãããããããããã«ããã¯ã¯äŸç¶ãšããŠæ®ã£ãŠããŸããããã¯ãéçºæã«èæ ®ãããã¹ãã§ãã
3. XAML
Xamarin.Formsã®åæããŒãžã§ã³ã«ã¯ãXAMLããŒãžã«é¢ããæãããªããã©ãŒãã³ã¹ã®åé¡ããããŸããã åããŠãŒã¶ãŒã€ã³ã¿ãŒãã§ã€ã¹ãCïŒã³ãŒãã§èšè¿°ããããšãã§ããŸãããããã«ãããäžæ§èœã®ããã€ã¹ã§ããŒãžãŸãã¯ãã¥ãŒã®äœææéïŒã³ã³ã¹ãã©ã¯ã¿ãŒåŒã³åºãïŒïŒã300ããªç§ä»¥äžççž®ãããŸããã è€éãªã³ã³ããŒãã³ãã®å Žåããã®æéã¯ããã«é·ããªããŸããã App.xamlã¯ãã¢ããªã±ãŒã·ã§ã³ã®ã³ãŒã«ãã¹ã¿ãŒãæéã®å¢å ã«è²¢ç®ããŸããã ã¹ã¿ã€ã«ããã®ä»ã®ãªãœãŒã¹ãããããããå Žåãã¢ããªã±ãŒã·ã§ã³ã®èµ·åã¯ç®ç«ã£ãŠå¢å ããå¯èœæ§ããããŸãã åã³ãŒãããã ãã®åé¡ã¯ç¹ã«Androidã«é¢é£ããŠãããCïŒã³ãŒããåªå ããŠApp.xamlããã³èµ·åããŒãžïŒããšãã°ãMainPage.xamlããã³MenuPage.xamlïŒã䜿çšããããšãç°¡åã«åé¿ãããšãã¢ããªã±ãŒã·ã§ã³ã®èµ·åæéãååã«ççž®ãããå ŽåããããŸããã
ä»åã¯ãXAMLã³ã³ãã€ã«ãè¿œå ãããšå€§å¹ ã«åæžãããŸããã Xamarin.Forms 2.5.0ã§ã¯ ãHello WorldããŒãžã«å¯ŸããŠæ¬¡ã®ã¡ããªãã¯ãçæãããŸããã
- ã³ã³ãã€ã«ãªãã®XAML 441ããªç§
- 188ããªç§ã®ã³ã³ãã€ã«ã䜿çšããXAML
- CïŒã³ãŒã182ããªç§ã
ã芧ã®ãšããããŸããªã±ãŒã¹ã§ã¯ãããšãã°ãæ倧ã®ããã©ãŒãã³ã¹ãéèŠãªListViewã»ã«ã®å ŽåãCïŒã§ã€ã³ã¿ãŒãã§ã€ã¹ã®èª¬æã䜿çšã§ããŸãã ä»ã®ãã¹ãŠã®ã·ããªãªã§ã¯ã [assembly: XamlCompilation(XamlCompilationOptions.Compile)]
ããããžã§ã¯ãã³ãŒãã«è¿œå ããããšã«ãããUIã倧å¹
ã«é«éåã§ããŸãã
ãŸããè€éãªã¬ã€ã¢ãŠããšå€æ°ã®èŠçŽ ãåããåã蟌ã¿XAMLïŒXAMLããŒãžã¯å€éšãã¥ãŒã䜿çšããXAMLã«ã€ããŠã説æããŸãïŒã®å ŽåãåæåæéãHello Worldã®äŸãããé·ããªãããšãæ€èšãã䟡å€ããããŸãã XAMLãã³ã³ãã€ã«ãããšãããŒãžãšãã¥ãŒã®äœæãå€§å¹ ã«ã¹ããŒãã¢ããããŸãã次ã®ãã€ã³ãã«é²ã¿ãŸãã
4.ã¬ã€ã¢ãŠã
iOSãAndroidïŒããã³ãã®ä»ã®ãã©ãããã©ãŒã ïŒã®ãŠãŒã¶ãŒã€ã³ã¿ãŒãã§ã€ã¹ã®ã¯ãã¹ãã©ãããã©ãŒã ã¬ã€ã¢ãŠããæäŸããããã«ãXamarin.Formsã¯ã€ã³ã¿ãŒãã§ã€ã¹èŠçŽ ã®ç¬èªã®ã¬ã€ã¢ãŠãã¡ã«ããºã ãå®è£ ããŠããŸãã ãã€ãã£ãiOSããã³Androidã«ã¯ç¬èªã®ã¬ã€ã¢ãŠãã¡ã«ããºã ããããŸããããã©ãããã©ãŒã ããšã«ç¹å®ã®ããžãã¯ããããããã¯ãã¹ãã©ãããã©ãŒã ã¢ããªã±ãŒã·ã§ã³ã«ã¯çŽæ¥é©ããŠããŸããã
ããŒãžãæ£ããé
眮ããããã«ããã¬ãŒã ã¯ãŒã¯ã¯ããŒãžã«ãã¹ããããèŠçŽ ã®ãµã€ãºãç¥ãå¿
èŠããããããã«ããåã³ã³ãããŒã«ã®ããªãŒå
šäœã®ã¯ããŒã«ãéå§ãããŸãã Xamarin.Formsã®å°æ¥ã®ãªãªãŒã¹ã§ã¯ãã¬ã€ã¢ãŠãã¡ã«ããºã ãå«ãå€ãã®æé©åãçŽæãããŠããŸãã ãã ããçŸæç¹ã§ã¯ãåçŽãªã«ãŒã«ãèŠããŠãã䟡å€ããããŸããUIèŠçŽ ã®æ°åãããæ£ç¢ºã«ç€ºããããã¹ãã®ã¬ãã«ãäœãã»ã©ãã¬ã€ã¢ãŠããéããªããŸãã ããšãã°ãUIèŠçŽ ã®ããããã£ã§AbsoluteLayout.LayoutBounds="0.1,0.1,0.3,0.3" WidthRequest=â300â
ãæå®ã§ããŸãã
ãŸããã¬ã€ã¢ãŠããå®è£ ããå¿ èŠãããå ŽåããããŸãã ãããã§ã¯ãããšãã°ã芪ãã¥ãŒã®å¯žæ³ãåºæºã«ããŠãåUIèŠçŽ ã®æ£ç¢ºãªå¯žæ³ãèšç®ã§ããŸãã ããã«ããã座æšã®é·ãåèšç®ãäžèŠã«ãªãããªã¹ããã¥ãŒã®éãã»ã«ã®é床ãäžãããŸãã
ã¬ã€ã¢ãŠãæé©åã®è©³çŽ°
ã¬ã€ã¢ãŠãã®äœæã®è©³çŽ°ãèªã
5. UIããã³æ£ããViewModelã®æŽæ°
Xamarin.Formsãå«ããã¹ãŠã®UIãµãã·ã¹ãã ã®ãã1ã€ã®åé¡ã¯ãããŒã¿ãæŽæ°ããéã®ãµã€ãºã®åèšç®ã§ãã ããã¯ãããžã¥ã¢ã«ãªããžã§ã¯ãã®ããªãŒãæŽæ°ããããšã§æåãªåé¡ã§ãReactJSã®é¡äŒŒç©ãWebéçºã§ç»å ŽããŸããã ã¢ãã€ã«ã§ã¯ããã®åé¡ã¯æ·±å»ã§ã¯ãããŸãããæ·±å»ã§ãã
Xamarin.Formsã¯MVVMã¢ãŒããã¯ãã£ã䜿çšããŸããViewModelããããã£ãæŽæ°ããããšãPropertyChangedã€ãã³ããçºçããæ°ããããŒã¿ãUIã«å°çããViewã¯ããŒãžå šäœã®ãµã€ãºãšåº§æšã®åèšç®ãèŠæ±ã§ããŸãã
10ã®ç°ãªããã£ãŒã«ããæŽæ°ãããšãããŒãžäžã®èŠçŽ ã®ããªãŒå šäœã§10ã®ã¬ã€ã¢ãŠããµã€ã¯ã«ãçºçããŸãããããã¯ãŠãŒã¶ãŒã®ç®ã«ã¯10ãµã€ã¯ã«ã§ãã 10ãµã€ã¯ã«ã§ã¯ãªã1ãµã€ã¯ã«ãå®è¡ããã«ã¯ãå¿ èŠãª10ãã£ãŒã«ããæã€1ã€ã®ã¢ãã«ã䜿çšããå¿ èŠããããŸãã ããã§ãã¢ãã«ãšãã¥ãŒãå šäœãšããŠæŽæ°ãããŸã-10ã§ã¯ãªã1ã€ã®PropertyChangedã€ãã³ãã
ãã®ãããæ¬æ¥ã®èšäºã§ã¯ãXamarin.Formsã®äž»ãªããã«ããã¯ãšããã®å¹æãã¬ãã«åããã¢ãããŒãã«æ³šç®ããŸããã ãããŠãä»æ¥ã ãã§ã¯ãããŸããïŒ
Xamarin Dayãžã®æåŸ
Xamarinã«ã€ããŠè³ªåããããã¯ãã¹ãã©ãããã©ãŒã ã¢ããªã±ãŒã·ã§ã³ã®éçºã«èå³ãããå Žåã¯ã 1æ31æ¥ã«ã¢ã¹ã¯ã¯ã§éå¬ãããXamarin Dayã«ã€ããŠãç¥ããããŸãã ãã®äžã§ããã¹ããã©ã¯ãã£ã¹ã«ã€ããŠåŠã¶ã ãã§ãªããã³ãŒãã«é¢ããã©ã€ãã¢ããã€ã¹ãåããããšãã§ããŸã ã 質åã®ããã³ãŒãïŒåé¡ããã°ãã¢ãŒããã¯ãã£ãããã©ãŒãã³ã¹ã®äœäžãªã©ïŒã衚瀺ãããã®å Žã§å°é家ã®ã¢ããã€ã¹ãç¡æã§å ¥æã§ããŸãã ãããžã§ã¯ãã«é¢ããåå¥çžè«ãç³ã蟌ãã«ã¯ã events-techdays @ microsoft.comã§ãããžã§ã¯ããšåé¡ã«é¢ããç°¡åãªæ å ±ãæžããŠãã ããã
ã€ãã³ãã®è©³çŽ°ã«ã€ããŠã¯ã ãã¡ããã芧ãã ãã ã
Telegramã®å± å¿å°ã®è¯ãXamarinéçºè ãã£ããã«åå ããŠãã ããã
é£çµ¡ãåãåãã å¿ ãXamarin Dayã«æ¥ãŠãã ããïŒ
èè ã«ã€ããŠ
Vyacheslav Chernikov㯠ã Binwell ãMicrosoft MVPãããã³Xamarinèªå®éçºè ã®éçºè²¬ä»»è ã§ãã éå»ã«ã¯ãNokia Championããã³Qtèªå®ã¹ãã·ã£ãªã¹ãã®1人ã§ãããçŸåšã¯Xamarinããã³Azureãã©ãããã©ãŒã ã®ã¹ãã·ã£ãªã¹ãã§ãã 圌ã¯2005幎ã«ã¢ãã€ã«åéã«åå ¥ãã2008幎ããã¢ãã€ã«ã¢ããªã±ãŒã·ã§ã³ãéçºããŠããŸããSymbianãMaemoãMeegoãWindows Mobileããå§ãããã®åŸiOSãAndroidãWindows Phoneã«åãæ¿ããŸããã Mediumããã°ã§ Vyacheslavã®èšäºãèªãããšãã§ããŸãã
èè ã«ããä»ã®èšäºã¯ã ïŒxamarincolumnã³ã©ã ã«ãããŸãã