Blog

How to hyperlink part of a text in a UITextView – Swift

Unless a url is spelled out in a UITextView, there isn’t a simple way to make it linkable in Interface Builder. So if you want to make some text hyperlinked like that, you’ll need to do a few maneuvers in code. The simplest way I found so far is this one, which I’ve adopted and updated for swift 4 and UITextView in particular. You can extend NSMutableAttributedString to find and hyperlink part of the text. Add this in a dedicated Extensions swift file in your project: extension NSMutableAttributedString { public func setAsLink(textToFind:String, linkURL:String) -> Bool { let foundRange = self.mutableString.range(of: textToFind) if foundRange.location != NSNotFound { self.addAttribute(.link, value: linkURL, range: foundRange) return true } return false } } Then where you have your textView defined, you copy the text to a NSMutableAttributedString, use the setAsLink method on it, which returns true if successful, and use that to copy the linked text back to the textView: let linkedText = NSMutableAttributedString(attributedString: myTextView.attributedText) let hyperlinked = linkedText.setAsLink(textToFind: "this part of the text will be hyperlinked", linkURL: "https://www.website.com/") if hyperlinked { myTextView.attributedText = NSAttributedString(attributedString: linkedText) }

The Apple Feedback Loop

Complaints about what Apple is doing wrong, not doing sufficiently well, or not doing at all is nothing new. But it seems that over the past few years the complaints, specifically from Apple enthusiasts, developers and advocates has been increasing in frequency and volume.

Apple developers as well as the commentators have legitimate reasons to complain. Apple, for all its meticulousness, attention to detail and strive for perfection, is not perfect. With both the size of the company and their scope of interests, Apple has its hands full and deals with an ever more complex operation in which every product integration contains more moving parts. What once was a collection of a few mostly standalone, self contained products is now an array of interconnected hardware, software and web services ecosystem. And the expectation of Apple to do more beyond its current scope as well as within its existing product line is not slowing down. Apple has set the bar high and we all got a taste of how good it can be.

Most of the complaints seem to boil down to one of two general themes:

Apple is not adding X feature we want or updating product X fast enough.
Apple is falling behind or not improving its weak area X fast enough.

At any given point in time X is something else, it’s the next thing on the list that has not been addressed yet now that the previous thing has been fixed or taken care of. But that’s just it, as far as I can tell nearly every complaint is sooner or later addressed. Not always to everyone’s satisfaction perhaps, as you simply can’t please everyone, but none are actually left ignored. Some gripes are answered fairly quickly and some bigger concerns can take almost 10 years to be addressed, but nearly without fail they all do.

Nowhere is this more evident than with wish lists of app developers. I’m only a relatively recent addition to the Apple developer community but I’ve been observing this for years now. Even things developers thought they’ll never get from Apple eventually shows up like the toy you thought Santa will never get you. The best example of this was WWDC 2014.

Brent Simmons, during WWDC 2014, emphasis mine:

“One of the jokes this week is that suddenly we developers have nothing left to complain about. It was all taken care of on one Monday in June 2014.

But we’ll find things, of course.

It was like this, though — we kept hearing about things, even relatively small things, that all by themselves would have made for a great week. It was like the greatest Christmas ever — and then Santa Claus hung out so you could take selfies with him. “

Some years WWDC stands for World Wide Developer Christmas. However, this occurrence is not really unique to 2014 or to WWDC. This happens regularly, yet the issue isn’t that we all have short memories. Like Brent said, “…we’ll find things, of course.“ We indeed found things, of course, and we always will. I’m not actually proposing that we shouldn’t complain. Quite the opposite, this is a crucial part of the Apple feedback loop. But I am proposing that we recognize an important attribute of this feedback loop which we are a part of.

Apple product releases and software updates have never strictly been a decree that comes down from behind the walled garden, as much as it might feel that way at times, it has actually always been some mixture of strong internal opinions of “we know best” and an attention to how customers react, and what developers and commentators say. But it appears to us this way because of an important element that differentiates Apple from most companies. Their commitment to secrecy. Apple does not wear their intentions on their sleeve and in most cases would rather keep everything they’re up to quite until the very last moment when they present it to the public.

In rare cases we get to learn, backwards in time, when Apple started working on something. Like with Swift, Apple’s new programming language, which turned out to be more than 4 years in the making before it was eventually revealed for the first time, even to many who actually work at the company. But in most cases we don’t find out where on the timeline Apple decided to start working on a product, feature, or service. But it is pretty clear that many of these come as a reaction to market demands or in addressing complaints of vocal users and developers. Apple does not make decisions in a vacuum.

Their mode of operation, their secrecy and grand unveilings, is a big part of what many of us love about Apple, and it is one of the ways in which they do what appears to be a core part of their mission statement, to delight customers. But this causes a delay in the feedback loop. An example of this most people would be familiar with is a shower in which the water temperature takes time to adjust once you turned the faucet. If you don’t realize there’s a delay, you’ll keep turning it up thinking you haven’t turned the hot water far enough, and a few seconds later you almost burn yourself when it ends up too hot and you adjust it back.

So despite knowing that we don’t know what Apple is working on, and despite seeing more and more examples of our concerns being eventually addressed, we keep turning the faucet up as if we forget that the temperature takes time but does eventually adjust, even if we can’t see the hot water coming down the pipeline.

I think the good news is that Apple seems to be aware of this and has been working to reduce the delay in the feedback loop. I don’t think we’ll ever get a level of transparency that other companies have, and I’m not sure we’d really want it if we got it, it might take some of the magic away. But Apple is trying to mitigate the frustration by addressing concerns more quickly, or at least hinting at what’s coming in more obvious ways. Whether through what might be controlled media leaks or top executives giving interviews of the sort they’ve never given in the past, saying we’re aware of the issues, we heard you, we’re working on it.

I think the upcoming WWDC will remind us once again that Apple is indeed listening, which means our feedback is an important part of the loop, but perhaps it will also remind us that we need not get so frustrated, we just need to give it a minute and let the temperature adjust.

Cinematic Suicide

I love movies. My favorite way to watch them is still in a big, dark movie theater. I don’t think I’m a dying breed but I don’t know the statistics. I don’t mean the statistics of how many people go to theaters, I mean the statistics of how many people would prefer to go to theaters to watch a movie.

I keep reading about how ticket sales are down and people don’t go to the movies as much anymore, blaming everything from bigger TVs and home theaters, to streaming services and iPads. If theater attendance is indeed declining, what’s causing it?

No media format stays the same for long and that’s fine. Silent films get sound, black & white is replaced with color and movies shot on physical film are now being replaced by digital cameras (and some might add that 2D is moving to 3D, but i’ll get to that). You don’t need me to give you the history of storytelling to know by now that radio didn’t kill books, TV didn’t kill radio, smartphones and tablets didn’t kill TV, and virtual reality… we’ll will see what that does.

I watched 44 films in a movie theater in 2014 and I’m on track to surpass that this year. I’ve seen at least one movie in every big theater chain in Los Angeles as well as small theaters. That’s AMC, Cinemark/Century/Rave, Arclight, Landmark, Laemmle’s, etc’. My first impression is that theaters are still packed. This doesn’t give me actual numbers but I still find I have to avoid opening weekends or get reserved seats in advance to get a decent seat (or a seat at all). But this could still be a confirmation bias on my part. However, going to so many theaters so often has started making it pretty obvious to me that if anything is killing theaters, or will in the future, it is the theaters’ seeming attempts to prevent exactly that. Perhaps in the panic and fear of dying, theaters seem to be scrambling to save themselves and in the process shooting themselves in the foot. There’s an Oedipus reference here dying to come out but my love of metaphors is proportionally related to my lack of skill in forming them.

I’m not saying that big TVs and easy streaming don’t have any effect on theater attendance but the fact is that still nothing parallels the experience of watching a movie in theaters, so what’s the problem?

I don’t have insights into the entire complex system of who and what effects theater chains behavior, but one thing is clear, with perhaps a single exception, movie theaters are making the movie going experience worse in multitude of ways while still not fixing many of the existing issues that are easy to fix or improve.

Barco-DemoThe embodiment of this is Cinemark. It feels like every time I walk into the building there is a new “attraction” demo attempting to incite people to try their latest invention, which always seem to belong more in a universal studios theme park rather than a movie theater. “4D” movies with chairs that rock and shake and probably splash water in your face when a character sneezes, or a movie screen with side extensions being projected with fake imagery to “enhance” the film in the Barco Escape experience. I’ve accidentally bought tickets to Barco Escape not realizing what it is at the time, and I would say this, at least they nailed the name because all I wanted to do was escape. After expressing my frustration on twitter, the fine folks at Barco reached out and asked for my feedback and seemed to genuinely want to know what I thought was wrong with it. Until that point I thought the only reason for these gimmicks is as an opportunity to charge more for a special type of experience, but after an email exchange with Barco I’ve concluded, at least in this case, that their intentions might actually be good, and that perhaps our desire for a good movie going experience is aligned.

If this indeed is not just a poor attempt at simply trying to squeeze more money out of moviegoers, and the main idea is to give people more reasons to leave the house to watch a movie, then we want the same thing here. Which leads me to one conclusion, most of the people involved (or perhaps simply the decision makers) do not understand what makes for a good experience of watching a film in theaters. That thing is immersion.

If what the CEO of Barco Escape told me is indeed true, and what they want is to create a more immersive experience, the biggest mistake they are making in these attempts is thinking that being immersed in the film is feeling like you are in it. I believe film immersion is actually on the other end of the spectrum, being truly immersed in a film is not feeling like you exist in it, it is forgetting you exist at all. In fact, it is forgetting that anything else exists. There is a reason why the screen is big and the room is dark. Everything that reminds you that you are sitting in a chair in a movie theater takes you out of the film. That can be someone’s phone glowing or worse, ringing; people talking or a crying baby (why, WHY are you bringing your 3 months old baby to a movie??). Let alone a chair that moves and shakes trying to make you think you are taking part in a car chase. When IMAX wanted to create a more immersive experience they made the screen big enough to cover your field of vision and graded the rows of seats more steeply, so you’ll see nothing but the content of the film. They sure didn’t extend the screen only on the sides, at a hard angle no less where you have to turn your head to look at, and projected extremely fake looking footage that wasn’t actually filmed with the rest of the movie to “extend” the film’s background, basically overriding the work of the filmmakers in framing shots just right.

IMAX is without a doubt the most immersive movie watching experience I’ve seen. They took the aspects that make the a theater the best setting to watch a film and cranked it up to 11. But IMAX is now committing an even worse theatrical crime than regular theaters are. Which brings me to 3D. If it is not obvious why this is a less immersive experience, just check what the effects are on your sense of self. The projection results in a reduction of the amount of light or brightness of the film and if I am not mistaken, a reduction of color range, making the quality of the image worse. It also requires glasses on which you can see light reflecting off your cheeks obscuring the image on the lenses creating another distraction(unless those are designed more like cyclists glasses that are contoured to your face, which few are), and most people who are not used to wearing glasses really feel those on their face reminding them constantly that they are uncomfortable, and those who do wear glasses now have to wear 2 sets at once. And of course, with few recent exceptions (Gravity comes to mind) the 3D effects are not subtle and are often so gimmicky that objects in the film are flying at your face causing you to move and react (we are back at universal studios), taking you out of the trance of the story being told and back into the theater seat. I also have a theory that some people’s brain or perceptual system (perhaps color blindness?) are less or more favorable for 3D, causing some people anywhere from “visual discomfort” to outright headaches.

So what does 3D have to do with IMAX shooting themselves in the foot (or the head)? When a movie comes out it might have been filmed for IMAX or in some cases formatted to be IMAXish, and you can watch the film on a regular screen or an IMAX screen, your choice. When a movie was shoot in 3D or converted to 3D you also get to choose which version to watch, either the 3D or regular 2D version (thank god). BUT, if a movie comes out that has both IMAX and 3D there is never a version on IMAX without the 3D. So if an IMAX movie was made to be also watched in 3D, you can watch it in 2D, or 3D without IMAX or 3D + IMAX but never 2D + IMAX. This has reduced your options of how you want to watch your film and basically removed the most immersive version from the menu completely.

This might not be IMAX the company’s choice, and I know IMAX screens are few in numbers and there is usually only one of them in each multiplex, if it even has one. But if the whole idea of an IMAX theater was to create the ultimate, most immersive experience, then you have just missed your mission statement, and for what, selling a ticket for a higher price? IMAX is already a higher than normal ticket price item and IMAX 3D is priced even higher. If anything, it is the rising expense of going to a theater that is keeping folks at home. But again, I would still pay a high price for the ultimate immersive experience, and I believe many others will, so not even offering that experience on most films (about 75 percent of IMAX releases are in 3D) is problematic to say the least. I will not watch a movie on an IMAX screen if it is in 3D, and I will definitely not pay extra for an inferior experience. I don’t know if 3D movies will last or die eventually (again), but I fear they might take IMAX down with them.

The one thing that has the potential to be more immersive than IMAX for watching a movie is Virtual Reality. VR still has a while to go but it will develop quickly. The entire idea behind VR is immersion, and while often enough it is about making you feel like you are there, it has the right setup to envelope you in an experience and make you forget yourself, perhaps once the headset is light and comfortable enough to forget it’s on. VR could eventually allow for simulating a bigger and better than IMAX screen with zero light and sound distractions like those that still exist in a theater. And although it is a less social experience, people are making efforts to incorporate that aspect as well (I happen to think those are not great so far, but time will tell).

So while theaters spend a stupendous amount of time and money on making a film less immersive and more annoying to watch while at the same time more expensive, they make little to no effort to do simple things that could make the decision to go out the a movie, let alone taking the actions to do so, much simpler and smoother.

Buying a ticket is still an overly complex and unpleasant experience. Most theaters charge a “convenience” fee (Per ticket! What, do your servers work harder the more tickets I buy?) for buying tickets online and in advance. In reality this is even more convenient for them, reducing the need for staff at the box office, reducing lines and delays at the theater, and saving them money. So they are charging you extra for something that actually saves them money to begin with. Online purchases are also the equivalent of pre-orders, allowing them to basically make an advanced sale as well as gauge demand for a film earlier (I’d bet I’m not even aware of some other benefits of pre-orders for a business). At Cinemark if you want the fee waived you can pay with a gift card, which means you now go through 2 checkout processes and have to buy a gift card and then buy the tickets with that, and you will soon discover that buying a gift card for some reason takes time to process so even though you’ll see credit available on the gift card, you can’t use it for about 24 hours, god knows why, and so if you planned on using it immediately in order to purchase tickets for a movie that same evening, you’d have to still purchase tickets separately or change your plans.

For me buying a ticket in advance is not only a way to secure a ticket for a particular showing but even more so a way to secure a good seat using revered seating, as seating at the very side edge, let alone in one of the front rows is not a great way to watch a movie in most theaters. Few are designed in such a way that the side seats or the front rows are decent. And yet reserved seating is still far from ubiquitous, and even in theaters that offer them, they often offer them only for some screenings, instead of all of them. I have no clue why. Efficiency and convenience be damned.

These and many more small but significant aspects of buying a movie ticket and going to the theater can be easily improved and refined and yet they seem like the last priorities of theater chains. Those are not even new ideas, they are simply not implemented. They will spend a lot of money to retrofit a theater for some gimmicky screening but no money on improving their online or mobile purchasing process.

I don’t mean to harp on Cinemark, they are simply my most recent in my movie misadventures (and are the 3rd largest chain in the US), but all chains have these and/or other such issues. The single exception to all of this is Arclight theaters, which actually gives you a discount for purchasing a ticket online instead of charging you a fee, which is simply honesty about the fact that it does indeed save them money. They seem to care about everything from noise during the film to the quality of the seats. And of course all screenings have reserved seating. Their only downside as far as I can tell is that only one Arclight has an IMAX theater, I’m not sure why this is the case.

If it’s not clear, I complain because I care. I want theaters to survive, succeed and thrive. I want them to continue to exist because I’m selfish and I want to be able to continue to go watch a film in the most glorious and immersive of environments. So, theater chains, we want the same thing, but you seem to have forgotten what it is about your service that makes it so great. All you need to do is minimize distractions and impediments to forgetting myself in your theaters, and reduce the friction for me to buy a ticket. That’s it.

You don’t need to reinvent the reel.

Speaking at Consciousness Hacking meetups Dec 3rd & 8th

I am going to be a part of 2 upcoming events, in the Consciousness Hacking meetups in Los Angeles on Dec 3rd and Palo Alto Dec 8th.

I am giving a presentation about The Future of Lucid Dreaming at the LA CH meetup on Dec 3rd in Pasadena. Info and registration here: http://www.meetup.com/Consciousness-Hacking-Los-Angeles/events/227044639/

I am also doing a panel on Dreams, Lucid Dreams and Technology for Dreaming at the CH Palo Alto meetup on Dec 8th together with Jennifer Dumpert and Kelly Bulkeley, Ph.D.: https://www.eventbrite.com/e/dream-tech-new-tools-to-awaken-your-dreams-tickets-16777495942

How to Create an eBook with iBooks Author

There is a fantastic and free application for Mac that allows you to create & publish an eBook to the iBooks Store with ease and simplicity of a drag and drop interface as elegant as only Apple knows how. This application is called iBooks Author, and I’ve create a beginners course with step by step instructions on how to create, layout, format, preview and publish your book to the iBooks Store.

Check out and preview the course here.