<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Vikash Hart on Medium]]></title>
        <description><![CDATA[Stories by Vikash Hart on Medium]]></description>
        <link>https://medium.com/@vikashhart?source=rss-6e0507a4ad13------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*CN3lfYmKBXkp4uG8mlIPug.jpeg</url>
            <title>Stories by Vikash Hart on Medium</title>
            <link>https://medium.com/@vikashhart?source=rss-6e0507a4ad13------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 18:29:55 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@vikashhart/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How to create a Green Screen App using the Chroma Key Effect in the CoreImage framework]]></title>
            <link>https://medium.com/@vikashhart/how-to-create-a-green-screen-app-using-the-chroma-key-effect-in-the-coreimage-framework-c23918e5e92f?source=rss-6e0507a4ad13------2</link>
            <guid isPermaLink="false">https://medium.com/p/c23918e5e92f</guid>
            <category><![CDATA[core-image]]></category>
            <category><![CDATA[chroma-key]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[green-screen]]></category>
            <category><![CDATA[ios]]></category>
            <dc:creator><![CDATA[Vikash Hart]]></dc:creator>
            <pubDate>Fri, 19 Apr 2019 01:59:51 GMT</pubDate>
            <atom:updated>2019-04-21T04:07:34.656Z</atom:updated>
            <content:encoded><![CDATA[<h3>Creating a Green Screen App using the Chroma Key Effect in the CoreImage iOS framework</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*X_2yVjCqEXtlqGw4" /><figcaption>Photo by <a href="https://unsplash.com/@danesager?utm_source=medium&amp;utm_medium=referral">Dane Kelly</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>I recently found out about the ability to create a “green screen” using the iOS CoreImage framework. Now for those of you that don’t know, a “green screen effect” or “green screening” is when a foreground image is captured in front of a green or blue background and the background color is replaced with a background image and you end up with a totally new image with the two combined. Pretty cool huh?</p><p>Naturally I took to the apple documentation, and what I found were the functions necessary to make it work but not how to implement it. So… I turned to google and medium, and unfortunately that was a bust. It seemed like either not many people used this functionality or they just didn’t know about it. After a lot of trial and error I managed to get it working and the result was pretty cool. I know how frustrating it can be to not have examples to reference when learning something new so I’ll be explaining how to get it going in this article.</p><p>To start we’ll need the ChromaKey class that has all of the functionality for this green screen. For the purposes of this sample app I’ve split up the code so we can see how each part works, but don’t worry the full code for processing the effect in one shot is also included in the ChromaKey class which can be viewed on the GitHub repo.</p><p>Also it’s important to note that although this functionality comes from the CoreImage framework, you don’t need to import CoreImage, UIKit works just fine.</p><p>Next we’ll get our image assets ready.</p><p>These are my foreground and background images.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*RHoyw0Xzc1HlIRhNN-YAUQ.jpeg" /><figcaption>green screen foreground image</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*G0yG0qidee55qntHBZx0TQ.jpeg" /><figcaption>background image</figcaption></figure><p><strong>It is extremely important to note that the images that you use be EXACTLY THE SAME SIZE! If your images are not the same size the processing of your final composite image won’t work properly and the resulting image will come out looking really janky! I went ahead and resized my own images for this example but you might want to use an image resizing dependency like Toucan to manage the resizing of your images to make sure they’re the same size every time.</strong></p><p><strong>Another important thing to note is that when you’re using this functionality the images must be converted to </strong><strong>CIImage types and then converted back to </strong><strong>UIImage types when you want to use them in your image views.</strong></p><p>The first step of the process is taking an image and removing the “green screen” from the background. What the filtering process does is it creates what’s called a cube map or a look-up table and filters each pixel in an image to remove only the set hue from the input image by changing the alpha values of those matching pixels to be 0 or transparent. To do this we need to generate a CIFilter to use in the filtering function. The hue is determined by setting a from and to value based on the ranges in a 360° color wheel and dividing them by 360 to get the input values. For the purposes of this tutorial we’ll be using a set range for green hues normally found in green screen backgrounds. Below is how the calculations are done with an example from the apple documentation (also listed below).</p><p>&quot;The value for green in the source image falls within the slice beginning at 108° (108/360 = 0.3) and ending at 144° (144/360 = 0.4). You will set transparency to 0 for this range in the color cube.&quot;</p><p><a href="https://developer.apple.com/documentation/coreimage/applying_a_chroma_key_effect#2951414">Applying a Chroma Key Effect</a></p><p>This is the code we use for getting the hue and creating a CIFilter.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4b715d98c73d44d7286624841fcb89ad/href">https://medium.com/media/4b715d98c73d44d7286624841fcb89ad/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/be940d68bdf616e06d5c60ec802779be/href">https://medium.com/media/be940d68bdf616e06d5c60ec802779be/href</a></iframe><p>Once we create our filter we can use it in our filtering function to remove the specified hue from our input image. (Shown below)</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/cfd67c40a2900eb460803409d842bcc3/href">https://medium.com/media/cfd67c40a2900eb460803409d842bcc3/href</a></iframe><p>The resulting filtered image looks like this. The red color is just a background color I set on the image so you can see that the green has been successfully removed.</p><p>So we go from this</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/200/1*feCk2gN2QLdKm-AExzp1wg.png" /><figcaption>before filtering</figcaption></figure><p>To this</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/200/1*OhiYH1O_01NKvaPmn-Gx_Q.png" /><figcaption>after filtering</figcaption></figure><p>The next and final step is creating the composite image using the filtered foreground image and the background image. Remember when I said that the filtering changes the green pixels alpha values to be 0 or transparent? Well this is where the magic happens. What this means is that in this step of the process, when creating a composite image, the background image is visible because it is showing through the now transparent pixels and that’s how you are able to see the two images when they are composited into a single new image.</p><p>Here is the code for creating a composite image.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d10157cf077a874baad625e669a3b6e6/href">https://medium.com/media/d10157cf077a874baad625e669a3b6e6/href</a></iframe><p>This is what the resulting image looks like. Awesome right?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*zZtYW6CgvjVxmNeA359ELQ.png" /><figcaption>composited image</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/200/1*5IDbu3BemiMD4S2maB0pHA.png" /><figcaption>after compositing</figcaption></figure><p>Just to reiterate, the new composite image must be converted from CIImage types to UIImage types when you want to use them in your image views.</p><p>And there you have it folks, we’ve successfully created a green screen app using the CoreImage frameworks Chroma Key Effect!</p><p>Thanks for reading.</p><p>For those of you who want to see the app in action or just want to see the code in full, the link to the GitHub repo is included below.</p><p><a href="https://github.com/VikashHart/ChromaKeyEffect/tree/master/ChromaKeyEffect">VikashHart/ChromaKeyEffect</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c23918e5e92f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to create programmatic UIScrollViews]]></title>
            <link>https://medium.com/@vikashhart/how-to-create-programmatic-uiscrollviews-6ae1f976c8f7?source=rss-6e0507a4ad13------2</link>
            <guid isPermaLink="false">https://medium.com/p/6ae1f976c8f7</guid>
            <category><![CDATA[scrollview]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[tutorial]]></category>
            <category><![CDATA[swift-4]]></category>
            <category><![CDATA[programmatic]]></category>
            <dc:creator><![CDATA[Vikash Hart]]></dc:creator>
            <pubDate>Mon, 21 May 2018 21:36:06 GMT</pubDate>
            <atom:updated>2018-05-29T03:45:20.085Z</atom:updated>
            <content:encoded><![CDATA[<p>Note: This tutorial is done using Swift 4 &amp; is for vertically scrolling scrollViews.</p><p>For those of you who want to learn to create or just troubleshoot a UIScrollView, look no further. ScrollViews are great to use when you want the functionality of scrollability but don’t want to create a tableView or collectionView to use it (sidenote: tableViews &amp; collectionViews are technically built upon scrollViews). In this article I will explain the do’s and dont’s of ScrollViews.</p><p>The method that I use to create a ScrollView uses a ScrollView and a “container”. First you create a scrollView object and make sure you don’t forget to add the translatesAutoresizingMaskIntoConstraints = false line for ALL! objects that you create, otherwise your constraints will NOT! work.</p><p>Next you need to create a container that will be a UIView object. This container will hold the objects that you want to include in the ScrollView.</p><p>***Important***: This method allows you to use to intrinsic heights of your objects to determine the content size of the ScrollView so you don’t need a hard coded value.</p><p>After that, you create all the objects that you want to include in the ScrollView: imageViews, labels, textfields, etc.</p><p>Now it’s time to create your constraints. When constraining a ScrollView, you want to add its subview to the main view that you will be working with. For example: addSubview(scrollView).</p><p>For the container you want to add its subview to the ScrollView. For example: scrollView.addSubview(containerView). Now it is important to note that when adding constraints, it is ok to add a centerXAnchor, however you DO NOT want to add a centerYAnchor because you will end up pinning the container to the center of the ScrollView and the ScrollView will NOT scroll. It is also important to note that when creating constraints for the container and its objects, you do not want to use “safeAreaLayoutGuide” because it refers to the main view, which those objects do not touch.</p><p>Next you want to create the constraints for the objects in the container. To do this you must add the objects respective subviews to the container: containerView.addSubview(swiftImageView).</p><p>Now that you have created your ScrollView you want to instantiate the class in the view controller and add its subview in the viewDidLoad: view.addSubview(scrollViewView).</p><p>There you have it, you created a ScrollView!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/216/1*Gl0xQ4ew2EDYW_8udLWmFA.gif" /></figure><p>Thanks for reading!</p><p>For the actual code follow the link below and check out the ScrollViewView and the ViewController.</p><p><a href="https://github.com/VikashHart/ProgrammaticScrollView">VikashHart/ProgrammaticScrollView</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6ae1f976c8f7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My Journey to Becoming “Kash” the iOS Dev.]]></title>
            <link>https://medium.com/@vikashhart/my-journey-to-becoming-kash-the-ios-dev-de0d7a939c49?source=rss-6e0507a4ad13------2</link>
            <guid isPermaLink="false">https://medium.com/p/de0d7a939c49</guid>
            <category><![CDATA[developer]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[codingbootcamp]]></category>
            <dc:creator><![CDATA[Vikash Hart]]></dc:creator>
            <pubDate>Wed, 16 May 2018 19:02:34 GMT</pubDate>
            <atom:updated>2019-04-25T19:18:32.088Z</atom:updated>
            <content:encoded><![CDATA[<p>Hey everyone, if you’re like me then you’re pretty new to the coding world. For those of you who aren’t so new, maybe this story will stir up some nostalgic memories.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/0*QToYrlIKbY5kiegq.png" /><figcaption>C4Q logo.</figcaption></figure><p>Last September (2017) I started the access code fellowship at an organization called Coalition for Queens otherwise known to its students as C4Q, now known as Pursuit. Prior to that I had just graduated from college and didn’t really know where I was headed career-wise. I had heard about C4Q from my brother and decided to give it a look. On the surface their mission looked really good and inspiring so I decided to sign up and give it a shot. I went through a pretty rigorous process that included on site technical and behavioral interviews as well as javascript workshops that culminated in a “final exam” to see how well we were able to pick up the code.</p><p>I’m not going to lie, for a while I was pretty worried that I wasn’t going to make it in. Not because I didn’t think I could cut it, but rather just because I really wanted to get into the program. Every day I would anxiously check my email for a response, and after a few agonizingly nerve-wracking weeks I finally got a response back from them. I had been accepted into their iOS development program!!! This was such a big victory for me, but I knew that this was only the beginning of a very long road.</p><p>Now let me preface this by saying that my class was very blessed, we had a fantastic instructor and ta’s that were just as great. Not to mention my cohort, we all came in as a group of strangers but quickly became a fairly tight knit and very supportive family. Speaking of family, my brother, who is in the same industry, was super supportive the whole way through. Tough love and everything, haha!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*2G_GGWlrzR4zggvI.png" /></figure><p>The program started with us learning the fundamentals of Swift: let, var, strings, ints, arrays, the works! I’ll admit that this was pretty daunting considering that I had never really written code before outside of our javascript workshop. Every day was a battle to learn and understand the code that was put in front of me. After a couple of weeks we took what we knew about the fundamentals and started on logic, this was one of the hardest units I had done. Just wrapping my head around how to build and organize the logic code was difficult but at the same time pretty rewarding when I got it working.</p><p>Skip forward a few weeks and we were about to graduate from Swift playgrounds to actual XCode projects! This was it, we were about to get our first taste of storyboards and making apps, albeit fairly simple ones, but apps nonetheless. I was super excited and anxious, but I had come this far, and I wasn’t about to stop now.</p><p>I dove in headfirst and embraced this process through all the successes and failures, and believe me there were A LOT of failures. Part of learning to be a developer is learning how to deal with setbacks and failures. Every setback and failure is a learning opportunity, and if you don’t learn to see them this way, learning will inevitably and always does become an uphill battle.</p><p>Fast forward a bit more and our cohort got another instructor who was super talented. It was about this time that I started working on group projects with my classmates. Let me tell you, if you think that learning to code and coding on your own is hard, working on a team of devs is a new type of challenge with problems and rewards all its own. I had to learn very quickly how to humble myself and not be possessive of the code that I wrote. Something that one of my instructors said that will always stick with me is that “when you work in a group and contribute code to the group, the code belongs to the group, thats what it means to work with a group”.</p><p>I eventually made it to what is simply called at C4Q, “hackathon”. We all proposed app ideas and people voted for the apps that they wanted to work on. This took place over 3 days and our groups had to build from the ground up an entire original app from scratch. If I thought working on a regular assigned group project was hard, this was a mountain of a challenge. Up until that point I didn’t realized how much my git skills truly needed work. I also worked with a team that turned out to be highly dysfunctional to say the least, but in the end we all made it work. At the end of hackathon we all demoed our app to a panel of judges from the actual developer world. This was my first real taste at speaking in public to people other than our classmates about an app that we built, it’s features, and answering tough questions by more experienced developers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/299/1*BWJF_3cDwr970FWf3Jfiuw.png" /><figcaption>Phase app logo.</figcaption></figure><p>Now lets skip ahead about a week or so and it was finally time for our capstone projects. Pretty much the same concept as hackathon except on a much larger scale. We were able to pick who we ideally wanted to work with and by now we all had a good idea of who we all worked well with, and I was fortunate enough to be in a group that didn’t have a bunch of big egos in it. As a group, we tossed around some app ideas and names until we all agreed on the app “Phase” (logo shown here). Phase was a social app that let users create albums known as “Journeys” and each post was called a “Phase”. It created focus on the whole process of individual Journeys from start to finish. Also users weren’t forced to see all of a person’s content on their feed unless they wanted to follow it all and allowed for better organization of image content than other competitors.</p><p>Four weeks later, almost 140 files and almost 70,000 lines of code in, we were about to present our app in front of an even bigger panel of judges and an even bigger crowd (more than 100 people), at PayPal/Venmo headquarters right here in Manhattan!!! Talk about a tall order. We had rehearsed our demo dozens of times and double checked that the app was working about every twenty minutes. Overkill I know, but we were just being super cautious so that the only thing that we needed to worry about was showing up to the party. Our team was ready though, oh, and did I mention that they chose our team/app to close out the night! No pressure right. Needless to say we KILLED IT!, our demo was on point and our app worked!, we answered all of the judges questions with relative ease, and I’d even venture as far as to say that we probably had the most ambitious app there (in my oh so humble opinion, haha).</p><p>At the time of writing this it’s now nine months later since the program began and currently we’re winding down a bit. We’re working on passion projects, learning new architecture types, languages, and most importantly applying to jobs. I myself am trying my hand at learning some MVVM, RxSwift, and just overall working on improving my Swift and git skills. If I can leave you all with a nugget of wisdom, it’s to utilize all of your resources. The people around you, and most of all GOOGLE, STACKOVERFLOW, and MEDIUM!</p><p>Now I haven’t included every minute detail about my time at C4Q and I can’t guarantee that everyone will have a similar experience, but I think that this is more than sufficient to convey the journey I took to begin my career as a developer. More than that, I hope that this story, even if in some small way, inspires anyone on the fence or even those of you who didn’t realize that you needed code in your life (haha) to pick up a language, any language, and start your journey to begin a developer career of your own (I believe in you!).</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=de0d7a939c49" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>