<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: himaratsu</title>
    <description>The latest articles on DEV Community by himaratsu (@himaratsu).</description>
    <link>https://dev.to/himaratsu</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F57202%2Fbd349ba6-5a7f-466c-9375-99052fcc19d3.jpeg</url>
      <title>DEV Community: himaratsu</title>
      <link>https://dev.to/himaratsu</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/himaratsu"/>
    <language>en</language>
    <item>
      <title>How to use Siri Shortcuts in your app</title>
      <dc:creator>himaratsu</dc:creator>
      <pubDate>Fri, 05 Oct 2018 09:58:28 +0000</pubDate>
      <link>https://dev.to/himaratsu/how-to-use-siri-shortcuts-in-your-app-2bpi</link>
      <guid>https://dev.to/himaratsu/how-to-use-siri-shortcuts-in-your-app-2bpi</guid>
      <description>

&lt;h1&gt;Introduction&lt;/h1&gt;

&lt;p&gt;Siri shortcut is one of the biggest update in iOS 12.&lt;br&gt;
If you said to Siri about your task, Siri responds with your apps installed.&lt;br&gt;
SiriKit is published in iOS 12, which make developers enable to adapt Siri to their apps.&lt;/p&gt;

&lt;p&gt;Recently, my app had adaptive SiriKit. I introduce my code.&lt;/p&gt;

&lt;p&gt;For using Siri Shortcut, We have tw ways. NSUserActivity, or Intents. &lt;br&gt;
Today I introduce NSUserActivity because it is very simple.&lt;/p&gt;

&lt;h1&gt;How to use Siri Shortcuts&lt;/h1&gt;

&lt;h2&gt;1. Regist Siri Shortcut&lt;/h2&gt;

&lt;p&gt;My code:&lt;/p&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import UIKit
import Intents  // 1. import Intents framework

class CheckinViewController: UIViewController {

   override func viewDidAppear(_ animated: Bool) {
        super.viewDidAppear(animated)

        // 2. register Siri shortcut action when user did some of action
        userActivity = NSUserActivity.checkinActivity
    }
}


extension NSUserActivity {

    public static let checkinType = "com.example.checkin"

    public static var checkinActivity: NSUserActivity {
        let userActivity = NSUserActivity(activityType: checkinType)

        userActivity.isEligibleForSearch = true

        // 3. set `isEligibleForPrediction` true
        //    you should set recommend phrase to `suggestedInvocationPhrase`
        if #available(iOS 12.0, *) {
            userActivity.isEligibleForPrediction = true
            userActivity.suggestedInvocationPhrase = "Check in"
        }
        userActivity.title = "Check in to the nearest station"

        return userActivity
    }
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;This code is mostly same to Apple sample code.&lt;br&gt;
When user action something, you register it to iOS with NSUserActivity.&lt;/p&gt;

&lt;h2&gt;2. Use NSUserActivity&lt;/h2&gt;

&lt;p&gt;Once registering Siri, user can set up at Settings app &amp;gt; Siri shortcuts section.&lt;/p&gt;

&lt;p&gt;Handling user action by Siri, you implemented delegate method.&lt;/p&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight swift"&gt;&lt;code&gt;&lt;span class="kd"&gt;func&lt;/span&gt; &lt;span class="nf"&gt;application&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;_&lt;/span&gt; &lt;span class="nv"&gt;application&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;UIApplication&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;continue&lt;/span&gt; &lt;span class="nv"&gt;userActivity&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;NSUserActivity&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;restorationHandler&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kd"&gt;@escaping&lt;/span&gt; &lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="kt"&gt;Any&lt;/span&gt;&lt;span class="p"&gt;]?)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="kt"&gt;Void&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="kt"&gt;Bool&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;userActivity&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;activityType&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="kt"&gt;NSUserActivity&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;checkinType&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="c1"&gt;// Handle Siri Action Here&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;

        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;And write definition in your info.plist.&lt;/p&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;key&amp;gt;NSUserActivityTypes&amp;lt;/key&amp;gt;
&amp;lt;array&amp;gt;
    &amp;lt;string&amp;gt;com.example.checkin&amp;lt;/string&amp;gt;
&amp;lt;/array&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h1&gt;Recap&lt;/h1&gt;

&lt;p&gt;In this article, I wrote how to use Siri Shortcut in your app with my actual code.&lt;br&gt;
The way of using NSUserActivity is very simple and easy.&lt;/p&gt;

&lt;p&gt;Hope this article helps anyone!&lt;/p&gt;

&lt;p&gt;———&lt;/p&gt;


</description>
      <category>ios</category>
      <category>swift</category>
      <category>ios12</category>
      <category>sirishortcut</category>
    </item>
    <item>
      <title>Use Carthage effectively</title>
      <dc:creator>himaratsu</dc:creator>
      <pubDate>Wed, 26 Sep 2018 15:51:12 +0000</pubDate>
      <link>https://dev.to/himaratsu/use-carthage-effectively-4c02</link>
      <guid>https://dev.to/himaratsu/use-carthage-effectively-4c02</guid>
      <description>&lt;h1&gt;
  
  
  Carthage
&lt;/h1&gt;

&lt;p&gt;Carthage is one of the most popular dependency management tool for iOS.&lt;/p&gt;

&lt;p&gt;In my article, I introduce several convenient command to save your time.&lt;/p&gt;

&lt;h1&gt;
  
  
  Command
&lt;/h1&gt;

&lt;h2&gt;
  
  
  carthage update —platform ios
&lt;/h2&gt;

&lt;p&gt;When executing carthage update, carthage create Cartfile.resolved from Cartfile you prepared. Then,&lt;br&gt;
build frameworks.&lt;/p&gt;

&lt;p&gt;In this command, you should specify platform you want to use frameworks in.&lt;/p&gt;

&lt;p&gt;carthage update —platform ios&lt;/p&gt;

&lt;p&gt;Carthage usually create multiple platforms frameworks(iOS, watchOS, tvOS, and macOS), but maybe not use these all.&lt;/p&gt;

&lt;h2&gt;
  
  
  carthage bootstrap —platform ios —cache-builds
&lt;/h2&gt;

&lt;p&gt;When executing carthage bootstrap, carthage build frameworks from Cartfile.resolved file. Not from Cartfile.&lt;/p&gt;

&lt;p&gt;carthage bootstrap —-platform iOS —cache-builds&lt;/p&gt;

&lt;p&gt;—cache-builds means not rebuilding frameworks if you already had built frameworks in Carthage/Checkouts/&lt;br&gt;
.&lt;/p&gt;

&lt;p&gt;Fortunely, carthage automatically check if framework is built in same Swift version. If not, rebuild it.&lt;/p&gt;

&lt;h1&gt;
  
  
  Specify libraries
&lt;/h1&gt;

&lt;p&gt;Cartfile is share between multi platforms. For example, iOS and watchOS.&lt;/p&gt;

&lt;p&gt;Basically, command is here:&lt;br&gt;
carthage bootstrap —platform iOS,watchOS&lt;/p&gt;

&lt;p&gt;But it has problem. In many cases, watchOS doesn’t use all dependencies defined in Cartfile.&lt;/p&gt;

&lt;p&gt;So, my recommend is:&lt;/p&gt;

&lt;p&gt;carthage bootstrap —platform iOS&lt;br&gt;
carthage bootstrap —platform watchos SWXMLHash&lt;/p&gt;

&lt;p&gt;Separate command, and pass library name to build command for watchOS.&lt;/p&gt;

&lt;h1&gt;
  
  
  Use latest version of OSS
&lt;/h1&gt;

&lt;p&gt;To shorten build time, you can use framework binary. It’s provided by Library Author, so you can use implicitly.&lt;/p&gt;

&lt;p&gt;To use it, your project swift version needs to be same as swift version of that binary. If you use Swift 4.2, using library of version build in Swift 4.2.&lt;/p&gt;

&lt;p&gt;Carthage skip checkout and build steps, so it is very efficiently.&lt;/p&gt;

&lt;h1&gt;
  
  
  Recap
&lt;/h1&gt;

&lt;p&gt;Carthage is great tool, but build time is bottleneck. I introduce tips to resolve it.&lt;/p&gt;

&lt;p&gt;Make hope this article helps you!&lt;/p&gt;

&lt;p&gt;—-&lt;/p&gt;

&lt;p&gt;*I'm studying English. If you notice English mistake, please tell me in the comments.&lt;/p&gt;

</description>
      <category>ios</category>
      <category>carthage</category>
    </item>
    <item>
      <title>Self-Introduction</title>
      <dc:creator>himaratsu</dc:creator>
      <pubDate>Tue, 11 Sep 2018 08:25:23 +0000</pubDate>
      <link>https://dev.to/himaratsu/self-introduction-48h2</link>
      <guid>https://dev.to/himaratsu/self-introduction-48h2</guid>
      <description>&lt;p&gt;Hi, I'm mobile developer in Japan.&lt;/p&gt;

&lt;p&gt;I make iPhone/iPad apps as my office work and private work.&lt;/p&gt;

&lt;p&gt;My representative work is &lt;a href="https://itunes.apple.com/app/id934444072?mt=8"&gt;ALPACA&lt;/a&gt;, photo-related app.&lt;br&gt;
ALPACA is the app that helps you delete photos in iPhone/iPad quickly.&lt;br&gt;
This app group similar photos automatically. You can delete photo grouped except you picked as left.&lt;/p&gt;

&lt;p&gt;This app is loved by people that take many pictures of babies, pets, and selfies.&lt;/p&gt;

&lt;p&gt;I'd like to post iOS dev tips in English. (I'm studying English!)&lt;br&gt;
I'll write about UIKit, Swift, Layout System(Auto Layout&amp;amp;UIStackView), and etc.&lt;/p&gt;

&lt;p&gt;Please follow me if you have interested in iOS dev. Thank you!&lt;/p&gt;




&lt;p&gt;*I'm studying English. If you notice English mistake, please tell me in the comments.&lt;/p&gt;

</description>
    </item>
    <item>
      <title> TensorFlowを読んでいく Getting Started</title>
      <dc:creator>himaratsu</dc:creator>
      <pubDate>Sat, 10 Feb 2018 02:16:32 +0000</pubDate>
      <link>https://dev.to/himaratsu/-tensorflow-getting-started--1ljn</link>
      <guid>https://dev.to/himaratsu/-tensorflow-getting-started--1ljn</guid>
      <description>&lt;h1&gt;
  
  
  Getting Started
&lt;/h1&gt;

&lt;p&gt;TensorFlowは機械学習のためのツールです。幅広い機能が含まれていますが、主な機能はディープニューラルネットワークモデルのために用意されています。&lt;/p&gt;

&lt;p&gt;TensorFlowは多くのAPIを提供しています。このセクションではハイレベルなAPIを紹介します。TensorFlowの利用がはじめてなら、以下のドキュメントから読んでください。&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://www.tensorflow.org/versions/master/get_started/get_started_for_beginners"&gt;Getting Started for ML Beginners&lt;/a&gt;

&lt;ul&gt;
&lt;li&gt;機械学習がはじめての人向け&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.tensorflow.org/versions/master/get_started/premade_estimators"&gt;Getting Started with TensorFlow&lt;/a&gt;

&lt;ul&gt;
&lt;li&gt;機械学習やったことある人向け&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;次に、以下のドキュメントを読んで、ハイレベルAPIの特徴を理解しましょう。&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://www.tensorflow.org/versions/master/get_started/checkpoints"&gt;Checkpoints&lt;/a&gt;

&lt;ul&gt;
&lt;li&gt;学習の進捗を保存し、中断した場所から再開する方法の説明&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.tensorflow.org/versions/master/get_started/feature_columns"&gt;Feature Columns&lt;/a&gt;

&lt;ul&gt;
&lt;li&gt;Estimatorが、モデルを変更せずにさまざまな入力データ型を処理する方法の説明&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.tensorflow.org/versions/master/get_started/datasets_quickstart"&gt;Datasets Quick Start&lt;/a&gt;

&lt;ul&gt;
&lt;li&gt;TensorFlowの入力パイプラインの説明&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.tensorflow.org/versions/master/get_started/custom_estimators"&gt;Creating Custom Estimators&lt;/a&gt;

&lt;ul&gt;
&lt;li&gt;モデルを作り、学習させる方法を紹介&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;さらに詳しい情報は以下にあります。&lt;/p&gt;

&lt;p&gt;The Low Level Introduction demonstrates how to use TensorFlow outside of the Estimator framework, for debugging and experimentation.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://www.tensorflow.org/versions/master/programmers_guide/low_level_intro"&gt;Low Level Introduction&lt;/a&gt;では、デバッグや実験のために、Estimatorフレームワークの外側でTensorFlowを使う方法が書かれています(&lt;a href="https://www.tensorflow.org/versions/master/programmers_guide/low_level_intro"&gt;https://www.tensorflow.org/versions/master/programmers_guide/low_level_intro&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.tensorflow.org/versions/master/programmers_guide/index"&gt;Programmer's Guide&lt;/a&gt;には、主なTensolFlowのコンポーネントの機能の紹介が書かれています&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.tensorflow.org/versions/master/tutorials/index"&gt;Tutorials&lt;/a&gt;では、TensorFlowの様々なモデルを使ったウォークスルーを読むことができます。&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>gettingstarted</category>
    </item>
  </channel>
</rss>
