The Passglas / Precision measure for drinking games

I never cease to be amazed at how frequently the interesting things I merely imagine turn out to be real. For instance, my relentless research in the field of goblets and challenges led me to wonder whether there might be some special type of goblet used in drinking games. I turned as usual to the sacred oracle, the source of all wisdom in the universe, for guidance. And what Google told me, after a fashion, was that such goblets do indeed exist. In fact, depending on one’s willingness to stretch the definition of goblet, which in my case is boundless, there may be several very different sorts of goblets that figure in drinking games.

For example, there’s a dice game played in Bolivia called Alalay. It’s quite similar to Yahtzee, in that it involves rolling five dice, with scoring based on the values of various number combinations. As in Yahtzee, the dice are placed in a small container and shaken before being thrown. In Alalay, this container, which is made of stiff leather, is called a goblet. Alalay is sometimes played as a drinking game, though the goblet itself is never used for alcohol; it wouldn’t do to get the dice wet.

I’ll Drink to That

But I found an even closer and more literal match for drinking-game-related goblets: something called a passglas (sometimes spelled pasglas)—a design that was popular in Germany, the Netherlands, Denmark, Finland, Estonia, and Sweden during the 16th through 18th centuries. A passglas is a tall glass—sometimes cylindrical but more often having six or eight sides—that looks suspiciously like a chemist’s graduated cylinder. It is tapered and stemless but, like all goblets, has a foot. And not unlike a graduated cylinder, it’s marked with glass rings or bands at regular intervals.

Etymologically sophisticated readers will guess, correctly, that passglas means “pass glass,” and the name accurately describes its use. The glass was filled with beer (or, depending on the locale and the desired depth of inebriation, schnapps). The first participant drank down to the first mark and passed it on, but if he—naturally, it would be a “he”—drank too much and the liquid level dropped below the line, he would be obligated to drink all the way to the next line, and so on. Presumably one’s precision decreased as the liquid drained, increasing the rate of consumption. Depending on the number of participants and the type of alcohol used, several refillings could be required in order for all parties to reach a suitable state of intoxication.

The Art of Drinking

Despite the apparent ubiquity and popularity of the passglas in its heyday, it’s rarely mentioned in literature or depicted in artwork—but there are some examples. Seventeenth-century Dutch artist Adriaen van Ostade specialized in paintings and sketches involving peasants, drinking, and drinking peasants. One of his more obscure paintings, called Het dansende paar (“The Dancing Couple”), painted some time between 1680 and 1685, shows a man drinking from a passglas while the next drinker eagerly waits his turn.

Nowadays passglases are sold as antiques or found in museums, and are little known outside the parts of Europe where they were once popular. This is too bad, because although modern drinking games may be more sophisticated in some ways, they rarely if ever involve a test of how skillfully one can actually drink. Precision drinking competitions could add an entirely new dimension to, say, New Year’s Eve celebrations—but a modern Pyrex measuring cup doesn’t match the simple elegance of the passglas. —Joe Kissell

Wine Color Taste Tests / Questioning common sense(s)

An article titled “Can You Tell Red From White?” in the online edition of Wine Spectator Magazine a couple of years ago began with this line:

The New Yorker threw down the gauntlet. Wine Spectator rose to the challenge.

Whatever else you may say about the two magazines in question or the qualifications of the authors they hire to write about wine, this much is clear: Wine Spectator missed a critical opportunity for an excellent pun. In fact, so blatant was their oversight that it casts grave doubts on the magazine’s editorial sensibilities.

The Red and White Blues

But linguistic flexibility is a much less serious matter than that which concerned humorist Calvin Trillin, who wrote an article titled “The Red and the White. Is it possible that wine connoisseurs can’t tell them apart?” in the August 19 & 26, 2002, edition of The New Yorker. Trillin claimed to have heard from multiple sources that wine experts—even those with degrees in enology from the University of California, Davis—routinely failed a blind taste test in which participants were asked simply to pick which wines (served at room temperature in black glasses) were red and which were white. If true, this suggests that the whole enterprise of tasting and judging wines rests on a shaky foundation at best.

In the course of Trillin’s research, he discovered that the test he had heard of was most likely an urban myth, or at least a significant embellishment of a test where wines are judged by smell rather than taste. Nevertheless, he himself couldn’t reliably tell the difference. In an effort to show just how ridiculous it should be even to ask such a question, an enology professor subjected Trillin to an impromptu experiment with a pair of wines—one white, one red—and he guessed wrong. Volunteers on the staff of Wine Spectator fared much better in their own version of the test, correctly guessing color 40 out of 42 times.

Fruity, with a Note of Imagination

But the fact that anyone could fail such a test suggests that wines’ aromas and flavors are not as distinctive as experts have led us to believe. It also reminds us that the experience of taste and smell—tightly connected as they are—may be quite subjective. Psychologists say that one’s perception of smell is strongly affected by one’s expectations—more often than not, we smell what we think we’re going to smell, or what someone tells us we’ll smell. So it’s entirely plausible that the smells and tastes we perceive in a glass of wine can be colored (so to speak) by the wine’s appearance. Meanwhile, experts ranging from Wine Spectator editors to UC Davis enologists admit that some wines have flavors that belie their colors—typically reds with an unusually low level of tannin or whites with an unusually high level. Without the standard cues of color and temperature, even a seasoned pro could plausibly suffer from a confused palate.

Although I’ve been to several wine tastings, I have not developed the sophisticated palate or vocabulary necessary for describing the taste of a wine meaningfully. But then, if even such a basic distinction as a wine’s being red or white can be missed, I don’t feel so bad for not being able to detect that hint of raspberry, that faint aroma of vanilla, or even those strong oak overtones the labels declare so boldly. My test is much simpler: what color are your cheeks after drinking the wine? Red: good. White: not so much. —Joe Kissell

Hymir’s Cauldron / Thor’s goblet-throwing prize

You’d be surprised how few literary examples of goblet-throwing there are. I mean, sure, this sort of thing shows up every now and then in your basic fantasy novel, but history isn’t exactly littered with the shards of goblets broken dramatically at the climax of some great epic tale. Except for one, of course: the Hymiskviða (The Lay of Hymir), a poem that tells the story of Thor’s heroic acquisition of Hymir’s Cauldron. This is the sort of story you read to your kids at bedtime—if you happen to live in Iceland in the year 1300 or thereabouts. For those not familiar with the story, here is an extremely abbreviated and very slightly accurate retelling.

Give Me a Cauldron Large Enough, and a Place to Stand…

The gods of Asgard were looking for an eternal source of mead, and they demanded that Ægir, god of the sea, provide it for them. Ægir, unhappy with the tone of their request, said he’d only do it if the gods could supply him with a cauldron large enough, such enormous vessels being rather scarce. Tyr, the god of war and justice, knew just where to obtain such an item: his father, the giant Hymir, had one that was “a league deep” (that would be about three and a half miles—certainly large enough to keep the gods drunk for a few millennia). But Tyr knew his father wouldn’t acquiesce easily, so he enlisted the aid of Thor, the god of thunder, to trick Hymir into parting with the giant cauldron.

Thor and Tyr went together to visit the bellicose Hymir. After braving their way through a variety of adventures, including a fishing trip during which Thor managed to catch two whales, Hymir still was not warming to his guests. He taunted Thor by saying, “Sure, you may be able to row a boat well, but if you’re really strong you should be able to prove it by breaking this glass goblet.” Thor threw the goblet against a stone pillar, but the goblet remained intact while the pillar shattered. Hymir’s wife whispered a word of advice to Thor: “Try again; this time, throw it at Hymir’s head, which is much harder than any goblet.” Thor did as he was told, and the goblet broke.

Hymir was upset that his goblet was broken, but nevertheless conceded that Thor had outwitted him, and offered him the great cauldron as his reward—provided, naturally, that he could carry it. Although Tyr couldn’t budge the cauldron, Thor handily carried it away. But the two gods had not gotten far when they turned to see Hymir following them with a band of his multi-headed henchmen; apparently he’d had second thoughts about letting go of his prized possession after all. Thor set down the cauldron, dispatched the pursuers with his trusty hammer, and then resumed the journey home.

All’s Well that Ends with Infinite Quantities of Mead

The gods were greatly impressed when Thor and Tyr returned with Hymir’s cauldron. Even Ægir changed his tune and began cheerfully brewing up mead to last Asgard through the winter. The mead flowed freely, the gods were happy, and they all lived happily ever after, except for those who didn’t. (We are not told how Hymir and his wife got along after that “hard-headed” remark cost him his cauldron, but one imagines the incident led to marital discord, if not worse. Such matters are, of course, of a more delicate nature than is generally addressed in Norse mythology.) —Joe Kissell

The Great Cork Debate / Thinking outside the bottle

When I was in high school, I had a darkroom in the basement. Because I didn’t do a large quantity of film processing, one of my biggest concerns was that the expensive chemicals would go bad before I had a chance to use them. Since it is primarily exposure to oxygen that damages photographic chemicals, I stored them in air-evacuation containers, which are basically plastic bags inside boxes. As you drain out the chemical through a special spout that sticks through the box, the bag shrinks, thus making sure no air gets in. This solution is simple, elegant, and effective.

The very same laws of chemistry apply to wines, and that is why wine is sometimes sold “by the box” in air-evacuation containers. It keeps wine fresher longer, and is even less expensive, in many cases, than bottled wine. What’s not to like? And yet, boxed wine is routinely ridiculed as low-class. Everyone knows that any decent wine will be stored in a corked bottle. It’s just The Way Things Are. It’s not about oxidation, it’s about perception. You have to do things right. Buying wine in a box is tantamount to buying wine with a screw cap. It’s an indication of poor quality. Or is it?

Recently I’ve been seeing an increasing number of wine bottles stoppered with a “cork” made out of plastic. And I confess that my initial reaction is invariably one of embarrassment. (“I should know better than to choose such a cheap wine.”) This is of course irrational; I know intellectually that the important thing is simply to keep air away from the wine. But I’ve discovered that there is in fact an intense debate raging in the wine industry over the best method of sealing a wine bottle, and the pros and cons of each approach are much different from what I would have thought. Here for your enlightenment and entertainment is a summary of the major positions in the debate.

Cork: the traditional approach

  • Pros: Cork has a long history; it has been used as the sealing method of choice for over 400 years. Cork stoppers, because they are such a pain to remove, implicitly signal quality. When they work, they work well. They’re a renewable resource (the trees are not killed when the bark is stripped to make cork). They make a satisfying “pop” when removed from the bottle. They’re readily biodegradable. And they support an entire industry of corkscrews and other cork-removal products.
  • Cons: Corks often go bad. Estimates vary widely, but many bottles of wine are ruined due to corks that are tainted, ill-fitting, or deteriorated. (Depending on which figures you believe, as little as 1% or as much as 20% of all wine sold is “corked,” which is to say, damaged by a problematic cork.) Corks can be difficult to remove, and sometimes break off into the bottle. The world’s cork supplies are nearly maxed out, so cork prices are increasing.

Plastic: the new cork

  • Pros: Plastic is immune to cork taint, so wine is much less likely to spoil. Plastic corks can be made more cheaply, and with much more precision, than cork stoppers. Depending on the vintner’s tastes, plastic corks can be made to look very similar to natural corks, or be molded in any imaginable designer color. They’re recyclable. And the same cork-removal equipment (along with its obligatory “pop” sound) can be used.
  • Cons: If the trees used to produce cork are no longer used for that purpose, they may be cut down to make space for more lucrative crops, thus endangering the habitat of various kinds of wildlife and altering the local ecosystem in unpredictable ways. If not recycled, plastic corks also pose a more direct threat to the environment. Some wine experts claim plastic corks unfavorably affect the flavor of wine. On the other hand, they don’t hold the aroma of wine well, making the ritual of cork-sniffing unsatisfying. The plastic may not retain its elasticity well over time, making it unsuitable for wines meant to age for decades. And most importantly, it’s just not right.

Screw caps: a strange twist

  • Pros: Screw caps, like plastic corks, avoid problems of cork taint, and yet unlike plastic are much less likely to affect wine’s flavor or lose their effectiveness over time. They are less expensive than natural or plastic corks. And they can be removed without any special equipment.
  • Cons: As with plastic corks, screw caps imply environmental issues associated with the loss of cork farming. Cork sniffing, of course, is right out. And again, most importantly, it’s just not right. You shouldn’t be able to get at your wine as easily as you get at your cola.

Crown seals: good enough for beer

  • Pros: Crown seals (the type of bottle cap used on most beer bottles) are basically screw caps without the screw part, so they have all the same advantages except ease of removal.
  • Cons: The downsides of crown seals are the same as for screw caps, with the additional issue of needing a bottle opener.

Of these, crown seals came on the scene most recently and so far appear with the least frequency. Meanwhile, air-evacuation containers, which were previously used only for the cheapest wines, now sometimes hold fancier varieties. (No one seriously proposes distributing high-end wines in air-evacuation containers, since bottles are more durable and less likely to leak over a period of many years.) There are, I’m sure, any number of other equally sensible alternatives out there. But the habit of associating cork with quality is very hard to break. —Joe Kissell

Bhutanese Archery / Shooting game

One day Morgen and I were having a brainstorming session, as we frequently do, about interesting things that might fit in with certain weeks’ themes. The expression “hit or miss” came up, and we began talking about things that involve hits and misses. Morgen said, “Do you know what the national sport in Bhutan is?” I was embarrassed to admit I did not even know exactly where Bhutan is located; it’s simply not a place I’ve ever spent much time thinking about. Morgen told me that Bhutan is between China and India. Although this didn’t give me any strong clues, I made what I thought was a safe guess: “Soccer.” That turned out to be a particularly bad guess, because in 2002, Bhutan’s national soccer team was ranked 202 out of 203 worldwide; FIFA sanctioned a special match that year, at the same time as the World Cup finals, between Bhutan and 203rd-ranked Montserrat; the match was covered in a documentary film called “The Other Final.”

In fact, Bhutan’s national sport is archery. That fact alone, I think, qualifies as an Interesting Thing, but there’s more to the story.

Weapons of Play

Bhutan is a Buddhist nation, and one of the central precepts of Buddhism is a reverence for all life. So it seems somewhat incongruous that the nation’s favorite game involves a hunting instrument (or, depending on how you look at it, a weapon of war). But in Bhutan, the bow and arrow can only be used for play. In fact, when making arrows, one can use only feathers that were found on the ground; to kill a bird to obtain its feathers would be considered wrong.

Each village has its own archery range, making them as common as curling rinks in Canada. (That is to say, extremely common.) Although modern, high-tech equipment is making some headway, most competitors use traditional, hand-carved bamboo bows. Village teams compete against each other in rowdy, elaborate, multi-day tournaments that are as much about spectacle as they are about hitting a target. Archers can use almost any means at their disposal to distract or demoralize their opponents, including dancing in front of the targets. A major part of the sport goes on behind the scenes, as teams conspire to throw off their opponents’ game. It is this, rather than what I typically think of as team interaction, that gives Bhutanese archery such popularity.

The Wide World of Archery

You might imagine that since archery is the national pastime, Bhutanese archers would be world-renowned for their skills. So far, however, the country has not distinguished itself in international competition beyond Asia. Archery is the only Olympic sport in which Bhutan participates, and they have been sending their best archers to the Olympics since 1984. In the 2004 summer Olympics in Athens, Bhutan’s two archers made it only to the second qualifying round, but this was still a better showing than in previous years. This is largely due to the fact that traditional Bhutanese archery is much different in both equipment and style from Olympic archery—insulting your opponent during Olympic competition is, shall we say, bad form. But Bhutan remains optimistic that their athletes will eventually earn recognition as the world’s finest archers.

I’ve only tried archery a couple of times, and I found it a lot harder than I’d imagined. And in America, at least, I would consider it rather unsafe to taunt someone who’s pointing a deadly weapon in my general direction. All the same, I think I could get behind a national sport that is as much about fun and mischief as about skill. —Joe Kissell

English Female Social Titles / Miss-ing the point

My wife kept her name when we got married. This being the 21st century, I wouldn’t have thought that would be in any way surprising or problematic. But in the modern English-speaking world, linguistic habits haven’t quite caught up with changing social conventions—many people (and computers) still assume that when a man and woman get married, the woman will take on the man’s surname. As a result, we get mail addressed to “Mrs. Morgen Kissell” and even, bafflingly, “Mrs. Liz Kissell”—Morgen’s given first name is Elizabeth, but she has gone by her middle name since birth, and has never, ever been called Liz. At least no one, to my knowledge, has called her “Mrs. Joseph Kissell,” which I think both of us would find rather offensive.

As annoying as such mistakes can be, I do sympathize with folks who no longer feel they have a proper, respectful, and appropriate title to use when addressing women. The title “Miss,” which used to refer to an unmarried woman of any age, has fallen into disfavor, except for young girls. And “Mrs.” is supposed to refer to a married woman, but only when using her husband’s last name. (Morgen certainly is neither “Miss Jahnke” nor “Mrs. Kissell,” but she can’t be “Mrs. Jahnke” either, because that would imply my last name is Jahnke.) So that leaves “Ms.,” which virtually every style guide now proclaims as the only reasonable choice, but which many people hesitate to use because it feels like an odd, newfangled, non-word.

Stress and Mistress

The basic distinction between “Miss” and “Mrs.” harks back to earlier times when a woman’s marital status was an important indicator of her position—and when, more to the point, a woman was considered a subservient entity with respect to her husband. Interestingly, though, both “Miss” and “Mrs.” were originally shortened forms of the word “mistress.” The modern sense of “mistress” implies an illicit relationship, but before about 1600, a mistress was simply a female head of a household—married or unmarried. As a result, the abbreviation “Mrs.” would originally have been pronounced “mistress,” and would not have been used exclusively to refer to someone’s wife. The pronunciation “misses” was simply a contracted form of “mistress.”

Meanwhile, when “miss” was first used as an abbreviation for “mistress” in the mid-1600s, it referred to a concubine or someone in a role more like what we would today consider a mistress. In other words, a few centuries ago, the meanings of “Miss” and “Mrs.” were, at least in some cases, roughly the opposite of what they are today! Only in the 19th century did “Mrs.” (with the pronunciation “misses” firmly established) come to refer exclusively to a married woman.

There is also, of course, the title “Ma’am,” which was short for “madam.” Although few people refer to a woman as either “ma’am” or “madam” these days, the situation is parallel to “Mrs./mistress” in that the shortened form is considered respectful whereas the longer form sometimes denotes a woman of questionable character.

The Long and the Short of It

One of the things about “Mrs.” that has always bothered me is that it can really only ever be used in its abbreviated form. No one would spell it out as “mistress” anymore, and yet there is also no agreed spelling for the full word as it is pronounced; “misses,” “missus,” “missis,” and “missez” all seem wrong. The title “Ms.,” which came into use in the middle of the 20th century, has an even worse problem—it appears to be an abbreviation, but it isn’t short for anything. As with “Mrs.,” no one would know how to spell it out. “Mizz”?

And yet, despite the fact that “Ms.” is clearly a modern, artificial conflation of “Miss” and “Mrs.,” it now serves the useful purpose “Mrs.” once did: it provides a respectful title that does not require the speaker to have any knowledge of the woman’s marital status or age. This is a good thing, because such distinctions, even if known, serve only to perpetuate the long-outmoded belief that adult women who are married are somehow socially superior to those who are not. In this respect, “Ms.” is actually a better title than “Mr.,” which says nothing about marital status but does presume the addressee to be an adult. A young girl could be a “Ms.,” but a young boy would not normally be called “Mr.”

But then, perhaps such social titles have outlived their usefulness altogether. On Christmas cards, for example, since we can’t be “Mr. and Mrs. Kissell,” and since “Ms. Jahnke and Mr. Kissell” sounds awkward, most people simply use our first and last names and leave it at that. This, I think, is the best solution of all—personal, yet respectful. It’s a hit among Mrs./misses/miss-es. —Joe Kissell

Pennsylvania Dutch / The Germans of Lancaster County

Pennsylvania is a state (well, commonwealth if you want to be completely nitpicky) known for its linguistic, uh, irregularities. In the western part of the state, where I grew up, many people speak an endearingly odd dialect of English called Pittsburghese. Some town names have pronunciations that utterly belie their foreign roots. DuBois is pronounced “dew boys”; North Versailles is “north ver-sales”; La Jose is “la Joes.” Then, of course, there are towns that simply have goofy names—Eighty Four, Slippery Rock, and Punxsutawney come to mind.

I’ve Been to Pennsylvania; Ask Me about Intercourse.

But to put all these oddities in perspective, western Pennsylvanians rightly consider their geographic nomenclature downright bland compared to what you’ll encounter on the other side of the state. Drive four hours east from Pittsburgh and you’re in Lancaster County, an area that attracts tourists by the thousands each year for no other reason than that they want to be able to say they went through Intercourse to get to Paradise. (This makes for a roundabout route, as it turns out, but that’s only fitting.) Other nearby towns include Blue Ball, Fertility, Gap, Bird-in-Hand, Smoketown, and even (I swear I am not making this up) Kissel Hill. These place names seem all the more amusing because the area is known for its religious conservatism, being home to large numbers of Amish and Old-Order Mennonite folk in particular.

The other thing Lancaster County is known for is Pennsylvania Dutch—a term that can refer to an ethnic group, a language, a culture, or all three. Interestingly enough, despite the proximity of towns named Holland and New Holland, Pennsylvania Dutch has nothing to do with the Netherlands. The term is a misnomer, or at least an anachronism; the Pennsylvania Dutch came from Germany.

Going Dutch

How did a group of German settlers in eastern Pennsylvania—and the unique dialect of German they speak—come to be known as “Dutch”? There are two main theories.

Most people assume that Dutch is an accidental corruption of Deutsch (the German word for “German”) or Deitsch (the word for “German” in the Pennsylvanian dialect). But the term may have been more of a historical accident than a linguistic blunder. Until at least the 1500s, the English word “Dutch” was used to refer generically to people of Germanic descent from the regions now known as Germany and the Netherlands. It wasn’t until the 17th century that the term “Dutch” came to be used strictly for people from the Netherlands, but by that time a number of German immigrants had already settled in Pennsylvania, and the old term may have stuck. In any case, the language of the Pennsylvania Dutch evolved into a distinct dialect of German, and is still spoken by as many as a quarter-million people.

Eastern Pennsylvania is not the only place where you can find native speakers of Pennsylvania Dutch. Smaller communities are located in several states in the eastern U.S., as well as Ontario, Canada. Like many minority languages, Pennsylvania Dutch is slowly losing ground to the dominant regional language—English in this case. With each new generation, children are less likely to learn Pennsylvania Dutch as their first language. However, efforts are underway to preserve and promote the language through books, classes, radio shows, and other media. But the most important things Pennsylvania Dutch speakers can do to keep their language alive are to engage in conversation—and to have children who can learn the language at home. Clearly, in more ways than one, Intercourse is important to the Pennsylvania Dutch. —Joe Kissell

Folk Etymology / Lazing your way to a bigger vocabulary

I need to say a few words about woodchucks. (First let me pause while you say the rhyme to yourself. Go on, you know you want to. Get it out of your system. Good.) I never understood what the word “chuck” was supposed to mean in the rhyme. Chuck isn’t often used as a verb; when it is, its most common meaning is “to throw” (as in, “Chuck that AOL CD in the trash”). This is naturally not the type of thing we expect a woodchuck to be capable of (as indicated by the counterfactual nature of the question in the rhyme). So the real question is why anyone would have given this animal such a nonsensical name in the first place.

(As an aside, woodchuck isn’t the only nonsensical name this animal has. It’s also called a groundhog. Oddly enough, “groundhog” is a fairly literal translation of the Dutch word aardvark, even though aardvarks don’t look anything like hogs. Woodchucks (Marmota monax) are rodents, or more precisely marmots, and are not even distantly related to either aardvarks or hogs. The most salient similarity among the three species is a propensity for burrowing.)

Gimme a W

The name woodchuck is derived from a word in one of the Algonquian languages spoken by Native Americans—either the Cree word otchek or the related Ojibwa word otchig. The English-speaking settlers in North America found these words hard to pronounce, so they substituted syllables that sounded more familiar and yet approximated the original sound; hence “woodchuck.” The process of consciously or unconsciously changing the shape of a word to reflect the existing morphemes (minimal units of meaning) in a language is known as folk etymology. This process frequently occurs when one language “borrows” a word from another and the speakers of the borrowing language mishear, or misunderstand the origin of, the original word.

English has many examples of folk etymology. Cockroach comes from the Spanish word cucaracha. As with woodchuck, the Spanish word was transformed into English by substituting similar-sounding morphemes: cock (as in rooster) and roach (which at that time was simply the name of a type of fish). There wasn’t anything about a cockroach that suggested “rooster” or “fish,” of course; it’s simply a matter of the sounds fitting. The same thing happened with the word polecat (from French poule chat, a cat that feeds on poultry) and ten-gallon hat (from Spanish galón, a braid). English speakers also mistook a napron for an apron, and even an ewt for a newt.

Begging to Differ

Closely related to folk etymology (or even, according to some people, a subset of the phenomenon) is a process called back-formation. Back-formation occurs when speakers remove a portion of a word, incorrectly assuming it’s a suffix, to form a new word. For example, the word pea was pease in Middle English, but that sounded like a plural, so the “s” sound at the end was dropped to make a false singular. Similarly, the word emote is mistakenly assumed to be the root of emotion, which is logical enough since -tion is a common suffix in English. But in this case, the word dropped whole from French (émotion) into English, so that derivation is erroneous. Other words in English that have been mistakenly created by back-formation include liaise, enthuse, laze, and evanesce. Some back-formed words, however, after enough time in circulation, become generally accepted: donate, sculpt, and even beg (from beggar) fall into this category.

A postscript about the woodchuck: The Algonquian words from which “woodchuck” was derived actually refer to the fisher (or wejack), a carnivorous mammal (Martes pennanti) that bears only a superficial resemblance to the woodchuck. So woodchuck turns out to be not only folk etymology, but a misnomer at that. —Joe Kissell

Mincemeat / The dessert that eats like a meal

I set out to find a simple answer to a simple question: Why is there no meat in mincemeat? It was going to be a tidy tale of how a misnomer was born. Look up a few Web sites, collect a few facts, wrap them in a nice story, and on to the next project. As so often happens, however, my research took a rather circuitous path as I kept discovering connections and facts that I’d had no inkling of when I started out. The story of mincemeat is more interesting—and convoluted—than I ever imagined.

Mincemeat is, I must confess, a topic about which I have never felt much passion. In my family, mincemeat pie was simply one of a half dozen standard Christmas dessert choices. I rarely had room for more than two, and in my personal hierarchy of dessert preferences, mincemeat ranked well below Johnny Bull Pudding and blackberry pie. On the occasions I did eat mincemeat pie, it made no particular impression on me other than provoking a vague curiosity at its name, since whatever the filling was, it clearly did not contain any meat.

One explanation for the name could be that in Old English, the word meat had the more generic meaning of “food,” whether or not it happened to come from the flesh of animals. Thus, a mincemeat pie would actually have been a “minced food” pie, which could have been anything. However plausible this may sound, however, this explanation turns out to be incorrect (or at least misleading).

A Pie Fit for a King (or Two)

Centuries ago, mincemeat was so named for the very straightforward reason that it contained minced animal flesh (and in fact sometimes still does—more on this later). Beyond that, the details of its provenance and development are hazy. I have read a few unsubstantiated reports stating that mincemeat pie was served at least as far back as 1413, at the coronation of King Henry V of England, and that further, it was a favorite of Henry VIII. There is no record of the composition of these early dishes, but recipes dating from the early 17th century list a variety of wild game, plus eggs, fruit, spices, and sweeteners. According to some accounts, early mincemeat pies were small, like tarts; according to others, they were immense, weighing as much as 220 pounds (100kg). In any case, meat and fruit were invariably included among the ingredients.

Going back even further, however, there are some who believe mincemeat pie is based on an ancient pagan tradition of serving coffin-shaped cakes representing Osiris—the Egyptian god who, according to legend, died and was resurrected each year. This ritual took place on the winter solstice, December 21, and this very festival was later co-opted by Christians looking for a convenient date to celebrate Christmas (and stamp out pagan influences in the process). Along with the Yule log and the evergreen tree, the mincemeat pie is arguably a remnant of the original pagan celebrations that persisted when the holiday was refashioned.

Mincemeat’s Second Coming

One person who believed this argument was 17th-century Puritan leader Oliver Cromwell. Cromwell felt that Christians had no business observing the birth of Christ by eating, drinking, and merrymaking—certainly not on a pagan holiday, and using pagan symbols. So he abolished Christmas in England in 1657. Two years later, he prevailed upon authorities in Connecticut and Massachusetts to ban Christmas celebrations there too. The prohibition specifically disallowed mincemeat pies, which were characterized as being sinful both for their symbolic origin and their inherent richness. But Cromwell’s attempt to put the last nail in the coffin of mincemeat failed; it rose again. Within two centuries the ban on Christmas had been all but forgotten, and mincemeat was once again a staple in both Christmas and Thanksgiving celebrations. But over those years mincemeat had undergone a change in character. Perhaps as a way of obeying the letter of the law while maintaining tradition, some people had begun to leave out the meat in mincemeat, replacing it with nuts, apples, and raisins…along with brandy or rum. That, in short, is why the name doesn’t always match the ingredients.

This leaves the question of why anyone would think to mix meat and fruit in a pie in the first place. This notion seems to elicit “yuck” responses from many people, but I don’t see why. Sweet and sour pork contains pineapple; some curried meat dishes contain raisins. There’s nothing unnatural about mixing meat and fruit. It’s just not common to see them together in baked goods (though I have frequently said that the idea of chicken cinnamon raisin cookies sounds good to me). One commentator opined that the mixture was simply a method of preservation, as the combination of the acids from the fruits and the heat from baking inhibited the growth of bacteria in the meat. That seems vaguely plausible, though I prefer the simpler explanation: it just tastes good.

Today, a few recipes for mincemeat (and some brands of jarred mincemeat) do indeed contain meat, but of those that don’t, most of them still contain suet, the hard layer of fatty tissue surrounding the kidneys of cattle. To be sure, this doesn’t sound like an appetizing dessert ingredient. And yet, it turns out to be one of the main ingredients (again, along with raisins) in Johnny Bull Pudding, the dessert I customarily ate on Christmas instead of mincemeat pie. There’s just no escaping tradition. —Joe Kissell

Urban Monorail Systems / The rise of Personal Rapid Transit

I’ve never regretted the decision I made a few years ago to live without a car. After all, if I walk down the hill a few blocks from my home, I can catch a subway, streetcar, or bus to take me nearly anywhere in San Francisco I may want to go. But every now and then, that “nearly” part causes me grief. There are certain spots in the city I can reach via public transit only by taking a subway, a streetcar, and two buses—and then walking for 20 minutes. The prospect of all that waiting and transferring, especially on weekends or when buses are running late, tempts me to take a taxi (which gets quite expensive) or rent a car (forcing me to worry about parking and traffic). Even in a compact city such as this one, getting from place to place quickly, inexpensively, and safely can be difficult. Owning a car can help in some ways, but for many of us, it would be more trouble and expense than it’s worth.

It’s a Bird, It’s a Train, It’s a…Taxi?

Several articles here on Interesting Thing of the Day have mentioned ways of addressing the urban transportation problem: car sharing programs, carfree cities (including Arcosanti), and personal flying machines, for example. A while back, a reader suggested I check out an innovative urban transportation system called SkyTran. Later, another reader wrote to tell me about a different urban mass-transit solution called the RUF (Rapid Urban Flexible) system. Although the two differ significantly, they are both monorail transit systems designed for cities. As I began reading about these, I discovered that they are just two among many similar proposed designs. Clearly, this was a meme worth investigating.

The beauty of elevated monorail-based systems is the relative ease with which they can be retrofitted into an existing urban environment. Unlike subways, they require an absolute minimum of disruptive street closures (and no digging). Unlike streetcars, monorails don’t have to compete with cars and pedestrians for space on the roads. And unlike conventional elevated light-rail train tracks, monorails can be constructed quickly and inexpensively. Seattle already has a (very short) monorail line, as do some other cities. But some proposals currently being advanced call for much more elaborate and pervasive systems—with some interesting innovations that could make them much more efficient than buses or trains. These systems are known generically as Personal Rapid Transit (PRT). Unlike conventional mass transit, PRT replaces large vehicles with small cars that hold only two to six people—and therefore use very small and inexpensive tracks as well.

Packet-Switching Meets Mass Transit

The SkyTran is one such PRT system. Its designer proposes to install a network of tracks that can take riders within a few blocks of any location in a city, using a flexible point-to-point scheme rather than a fixed route. The cars can travel much more rapidly than a train or bus, and a sophisticated computer system prevents collisions and congestion. In theory, there would always be at least one car available at each stop; after you board, the car zips from the station’s bypass track onto the main track, where it picks up speed and takes you directly, without stopping, to your destination. This seems to combine all the advantages of a taxi with the advantages of a subway—and then some. Similar designs include the SkyWay Express, the ATN (Automated Transportation Network), and the ULTra (Urban Light Transport) system, which is being developed in the U.K.

If you want to avoid any walking—or be able to travel outside the immediate area served by the transit system—you might prefer another variant of PRT. The RUF (Rapid Urban Flexible) system being developed in Denmark is an example of a hybrid that uses specially modified electric cars that can operate automatically when riding on the tracks or manually on the road. Use your car around town as usual, but when you want to travel farther or faster, drive into a station where your car is guided onto a special monorail track. From there, allow the computer to drive you to your destination stop, where you drive off the track and resume manual control. RUF requires much less track than SkyTran and provides passengers with greater independence; on the other hand, the cars themselves are much more complex and expensive.

Proponents of PRT systems invariably point out that the cost of installing a citywide monorail system of this sort would be comparable to the cost of installing a traditional light-rail line; the additional efficiency should make it so cost-effective that it’s a no-brainer. Municipal governments are understandably hesitant to sink tens or hundreds of millions of dollars into unproven technology—but this is a chicken-and-egg problem; until one of these designs is actually put into large-scale use somewhere, there’s no telling how well it will live up to its promises. There’s another source of hesitation too: however flawlessly such a system may work, the question remains whether the teeming masses will like it and trust it enough to give up their cars. But as more urban dwellers go carless anyway (out of choice or necessity), PRT systems look increasingly appealing. —Joe Kissell

Carbon Sequestration / Greenhouse gas disposal techniques

As everyone knows, a lot of scientists are extremely concerned about global warming. Evidence suggests that the high levels of so-called greenhouse gases produced over the past half-century or so will result in higher temperatures worldwide over the coming decades. The additional heat could melt polar ice and raise the level of the ocean, causing flooding and eroding coastlines; it could also lead to more severe climate change with potentially devastating effects. Other scientists say that worries about global warming are overblown—that the temperature will not rise significantly (at least, not due to human activity), and that in any case, the results of a slightly increased average temperature would be mild rather than disastrous.

But no one disputes that the air has become quite polluted—you can verify this easily by looking out your window. One major component of air pollution is carbon dioxide (CO2), which is produced as a waste product when fossil fuels are burned. The level of carbon dioxide in the atmosphere has risen markedly since the beginning of the industrial age, and even if that change is not completely attributable to human progress, it’s not a good thing. Whether or not human-generated CO2 contributes to global warming, it clearly causes other problems.

Convincing the people and governments of the world to reduce the use of fossil fuels is essentially a lost cause, so the latest trendy approach to dealing with all that excess CO2 is capturing it as soon as it’s created and then disposing of it somewhere. Equipment installed at power plants and other major industries can separate the carbon dioxide from other waste products and liquefy it for temporary storage; finding a long-term home for massive amounts of the gas is the real problem. The process of storing carbon dioxide permanently in such a way that it cannot escape back into the atmosphere is known as carbon sequestration (or, sometimes, carbon dioxide sequestration). Broadly speaking, there are two places one might put large quantities of unwanted carbon dioxide—in the oceans or underground. Techniques for getting the CO2 to its putative final resting place (and keeping it there) are in varying stages of experimental development.

Ocean Storage

The world’s oceans already absorb unfathomable amounts of CO2; some researchers believe they could hold a great deal more with a little help. The upper part of the ocean typically has a fairly high concentration of CO2 (absorbed directly from the atmosphere), but at greater depths, the concentration is much lower. So one way to dispose of CO2 is to inject it into deep ocean water. At depths over 3,000 meters or so, liquid or solid CO2 is denser than the surrounding water, meaning that it could sink all the way to the ocean floor. Closer to the surface, it will dissolve into the water. Dissolved CO2 makes the water acidic, with unknown (but likely detrimental) effects on marine life. Liquid CO2 on the ocean floor may react with minerals there and form solid precipitates—or it may simply kill off organisms already living there.

Geological Storage

Merely burying CO2 is not good enough; in order for it to stay put, it has to be stored very deep in the ground, and somewhere that the gas cannot escape into the atmosphere. Some possibilities include:

  • Saline Aquifers: An aquifer is a porous layer of rock that holds a large quantity of water—often saltwater. Inject CO2 deeply enough into an aquifer, and the surrounding pressure keeps it in liquid form. Meanwhile, an impermeable layer of solid rock above prevents the gas from being released back into the atmosphere. Although aquifer storage is expensive, it is likely to have less impact on the environment than ocean storage—and the CO2 can remain safely underground, theoretically, forever.
  • Oil and Gas Reservoirs: If you can put carbon dioxide into an aquifer, you can also put it into a depleted gas or oil well. In fact, the technology to deliver CO2 into such wells has been in use for decades; pump CO2 into an oil well, for instance, and you can push out extra oil that would otherwise be unreachable. As long as the CO2 is stored deep enough, it will remain as a liquid.
  • Coal Seams: Most of the world’s coal deposits are located too deep in the ground for mining to be practical. When CO2 is injected into coal seams, the coal absorbs the gas. Meanwhile, in a manner similar to enhanced oil recovery, the process also pushes out methane gas, which can be used as a fuel.

And then, of course, there’s a natural CO2 storage apparatus: forests. Trees are incredibly effective at absorbing carbon dioxide and creating oxygen, so planting (or replanting) millions of acres of forest could go a long way toward solving the CO2 problem—no drilling or high-tech research required. This is not technically sequestration, as you wouldn’t manually inject previously collected carbon dioxide into a tree—but it does have essentially the same net effect.

Politicians hope carbon sequestration—of one kind or another—turns out to be a magic bullet that can appease consumers, energy companies, and environmentalists alike. Although all the potential terrestrial CO2 storage spots show some promise, the safety, capacity, and long-term effectiveness of carbon sequestration is ultimately unknown. At best, it will address only a small portion of the world’s pollution problem; at worst, we may find that something we thought we buried comes back to haunt us. On the other hand, we certainly take a lot of carbon out of the ground. Putting some back in just may balance the scales a bit. —Joe Kissell

Memetics / The science of idea propagation

Several years ago, a friend of mine gave me a book for my birthday called Thought Contagion. I had not heard of the book or its subject matter, the science of memetics, but I was fascinated by what I read. Author Aaron Lynch explained, concisely and convincingly, how some of the most significant beliefs in society came to be as popular as they are. By the end of the book I felt I understood, for the first time, a great many things that should have been obvious all along. I was even more surprised to discover that the things Lynch was saying were considered novel, and even somewhat controversial. What he described, simply and elegantly, is a compelling theory about the way beliefs spread.

What Memes May Come

The fundamental term in memetics is meme, which means a self-propagating idea. The term was borrowed from sociobiologist Richard Dawkins, who coined it in his 1976 book The Selfish Gene. Roughly speaking, memetics applies the principles of evolution by natural selection to beliefs. In conventional evolution, genes that improve an organism’s ability to survive endure in future generations and spread throughout a population; those that hinder survival eventually disappear. By analogy, memetics says that ideas are subject to natural selection as well; those that most effectively promote their own survival multiply and spread, while those that don’t, don’t.

In memetics, it is misleading to think of a person as having a belief; instead, it is more accurate to think of beliefs as acquiring people. Memes propagate from person to person in a manner analogous to the way viruses spread. A meme is passed from one person to another through one form of contact or another, and in some cases must mutate in order to continue surviving and spreading. Thus memetics is sometimes described as an epidemiology of ideas, investigating them in much the same way as a researcher might study the way a disease spreads throughout a community. This is not to say, of course, that all ideas that spread are negative ones, as the analogy to disease might suggest. Memetics itself is neutral with regard to the value of beliefs, and the principles apply equally to positive, useful beliefs as to destructive ones.

Being Fruitful and Multiplying

Just as a virus can spread by floating through the air, by skin contact, or through exchange of bodily fluids, there are a number of different mechanisms whereby beliefs spread. One of the most common and effective means of spreading a meme is simply having children, because children more often than not serve as hosts for the same memes as their parents. Thus memes that encourage procreation directly (“your biological clock is ticking”) or indirectly (“abortion is murder”) serve to propagate themselves to the children of the meme’s host. Similarly, memes that make it more likely that parents will pass a belief on to children (such as “children should respect their parents”) encourage their own propagation.

Another common mechanism of meme propagation is proselytism. Consider the meme “those who do not believe in Religion X will spend eternity in hell.” This meme aids its own propagation, because holding the belief increases the likelihood that it will be transferred to other hosts. A person who considers belief in Religion X crucial to eternal happiness will be motivated to influence its adoption by friends and even strangers (not to mention offspring). This meme also illustrates other methods of propagation, such as discouraging hosts from dropping the belief (persistence of the belief, especially at the time of death, is regarded as crucial to its effectiveness) and resisting efforts of competing memes (such as “all religions are equally good”) to displace it.

Gimme Some Truth (or Not)

Of the other methods of meme propagation, surprisingly, one of the least effective is for a meme simply to seem true. The sheer force of logic can and does cause memes to spread (as in “Earth revolves around the Sun”). But more often than not, competing memes with other methods of propagation win out over those that depend solely on truth or plausibility. In particular, political and moral beliefs (which typically spread by offspring production, proselytism, and dropout prevention) usually displace beliefs whose only mechanism of reinforcement is objective fact. This could help to explain, for example, how a nation might muster public support for a war in the absence of objective evidence of danger from an enemy.

The basic principles of memetic theory that describe the ways in which beliefs spread, persist, and recede, can account for the rise and fall of numerous widespread beliefs, including economic trends, pro- and anti-abortion movements, terrorism, racism, diet fads, and hundreds of other memes. It can explain how TV programs or radio talk shows gain and lose popularity, why less effective technologies win in the marketplace over more effective ones, and how public opinion can shift rapidly on many major issues.

My predominant thought while reading Lynch’s descriptions was, “Well, of course that’s why so many people believe such-and-such. It’s obvious. How could it be any other way?” And yet, that is precisely what’s interesting about memetics: it points out and explains things that should have been obvious all along, but weren’t. Although Thought Contagion is written for a general audience and therefore avoids complex mathematics, memetic theory is in fact a very serious science, backed up by increasing amounts of highly technical analysis. Very few professionals currently consider themselves full-time memeticists, but that is certain to change, thanks to the rapidly spreading meme, “memetic explanations rock.” —Joe Kissell

Intaglio Printing / Duplicating under pressure

As I look around at the many printed items within arm’s reach—books, magazines, a calendar, posters, checks, labels, boxes, and so on—I am vaguely aware that nearly all of them made their way through a printing press at some point. And, since I’ve used rubber stamps and stencils, I have an equally vague awareness that any printing process is based on putting ink or other coloring onto some parts of paper while keeping it off other parts. But despite having worked in the prepress field for a while, I never thought very deeply about the methods for transferring ink to paper; terms like “offset” and “lithography” had no specific meaning to me. Even after I finally grasped how laser printers work, ink-based printing methods remained a mystery.

Every time I realize that I’ve been living in blissful ignorance about something so common, I feel sort of guilty—it’s the same feeling I had when I was in high school and knew that I’d studied just enough to get through my exams, but not enough to actually understand or remember anything. So I began some remedial self-instruction in printing techniques, determined to fill in those embarrassing gaps in my knowledge. Along the way, I learned all sorts of interesting things, but one printing method particularly struck my fancy: intaglio (in-TAL-yo) printing.

Making an Impression

There are several major large-scale printing methods. The original printing press and its descendants (including rubber stamps) use raised letters to ensure that ink is applied only to the desired portions of the page; although an entire block of type may be covered with ink, only the raised parts make contact with the paper. In lithography, a printing plate (or stone) is moistened with water and then coated with ink; the greasy ink adheres only to the portions of the plate with the right texture (achieved in a variety of ways), while the water on the blank portions of the plate repels the ink. Although paper is brought into contact with the entire plate (directly, or, in offset lithography, via an intermediate rubber roller), only the inked portions transfer marks to the paper.

Intaglio printing (from an Italian word meaning “carve”) predates lithography by more than three centuries. Like lithography, it employs full-plate contact—but instead of relying on water to keep ink where it belongs, it uses recesses cut, engraved, or etched into a metal plate (or cylinder) to hold the ink. After the ink is spread, the plate is wiped down to remove excess ink from the top surface. The paper is then applied under tremendous pressure to push it into the grooves, transferring the ink where it has made contact. One of the side effects of intaglio printing is that the inked surfaces are very slightly raised on the front and indented on the back; depending on the type of paper and ink used, this can give intaglio prints a unique texture. A variant of intaglio printing called gravure varies the depth of the recesses in order to produce a range of tones; deeper grooves hold more ink and therefore create darker colors.

Show Me the Money

Intaglio presses can cost ten times as much as offset presses, and an intaglio printing plate can cost hundreds of times more than a comparable plate intended for offset printing; hence the relative popularity of the latter. But intaglio printing has some important advantages. For one thing, the plates have an incredibly long life; many millions of impressions can be made before the image quality degrades. For another, intaglio printing can achieve remarkably fine levels of detail. These facts, combined with the raised surfaces of the design, make intaglio printing the natural choice for currency, passports, and other high-security documents. Virtually every banknote in the world is printed at least partially using intaglio, because its distinctive appearance and texture make it easier to spot counterfeits. Although intaglio will never replace laser and inkjet printers on the desktop, there’s no better printing technique when only perfection is good enough. —Joe Kissell

Sea Monkeys / New life for an old fad

I recently went to a toy store with my son, and found myself marveling at how little had changed since I was a kid. Alongside all the miracles of modern toy science were dozens of items that I remembered seeing on toy store shelves 25 years or more ago, and they looked exactly the same—except for the price. Slinkies. Magic Rocks. Ant Farms. Silly Putty. Nerf balls. And, of course, Sea Monkeys. I vividly remember the ads in comic books and magazines promising “Instant Life—Just Add Water!” The ads pictured anthropomorphic sea creatures with tails, smiling faces, and crown-like protuberances on their heads. These intelligent and fun-loving creatures could be your new pets for just a few dollars.

I never managed to prevail upon my parents to spring for the Sea Monkeys, but I always wondered just how close the real thing would be to the hype. A couple of years ago, when Morgen bought a Sea Monkeys set as a present for a friend, I got to see them in action. The little critters were, unsurprisingly, not terribly impressive as pets. However, in terms of both biology and marketing they are a marvel every bit as interesting as those ads implied.

Brine Shrimp Deluxe

Sea Monkeys are a variety of brine shrimp. Unlike the common species Artemia salina, Sea Monkeys were engineered as a larger and longer-lived hybrid variety the manufacturer calls Artemia nyos (NYOS stands for New York Ocean Science Laboratories, where the breed was developed). But like all brine shrimp, Sea Monkeys lay eggs encapsulated in a cyst shell. These cysts have the unusual capability of remaining viable over long periods of time when completely dehydrated—effectively maintaining a state of suspended animation. This state, known as cryptobiosis, is also seen in some plant seeds, insect larvae, and crustacean eggs. When the eggs are re-hydrated in a saline solution, they continue with their development and hatch soon thereafter.

Sea Monkeys have other interesting characteristics, such as the fact that they have one eye when they hatch but later grow two more. According to the official Sea Monkeys literature, the animals also breathe through their feet—I’ll have to take their word for it—and the females can reproduce either sexually or asexually.

Just Add Hype

But when you get right down to it, these creatures, which rarely grow longer than half an inch (about 15mm), are not that interesting as pets go. Brine shrimp are often sold as food for other fish, and their low status on the food chain says something about not only their size but their neural capacity. Compared to even the most ordinary tropical fish, the translucent Sea Monkeys are rather tedious to watch—if you can spot them at all—as they swim around in their little tanks.

That brine shrimp could ever be conceived of as pets is nothing less than a stroke of marketing genius. The man behind it was inventor Harold von Braunhut, who was also responsible for such kitschy fads as the X-Ray Spex, which got me in trouble when I tried to wear them during class in sixth grade. Von Braunhut began working with brine shrimp in 1957, and in 1960, his first simple kits went on sale. The fact that the eggs could be shipped easily, stored indefinitely, and brought back to life within a couple of days suggested the name “Instant Life,” which was how the product was first sold. When von Braunhut realized the creatures themselves needed a more marketing-friendly name, he began calling them Sea Monkeys, reportedly because of their tails. (Any actual resemblance to monkeys is purely in the mind of the beholder.)

Von Braunhut died on November 28, 2003. But in recent years, his invention—along with its innumerable variations and spin-offs—has sprung back to life as a retro fad. For about US$10 (rather than the original $0.49), you can get a plastic tank, water purifier, egg “crystals,” food, and accessories—including a handbook whose main purpose is to convince you to buy still more supplies to keep your new pets alive as long as possible. Sea Monkeys come with a two-year “growth guarantee,” but owners seldom maintain their interest in keeping the creatures alive for more than a few months. As pets, they make great fish food. —Joe Kissell

Welcome To The Next Level Of Mobile App Development

Creating a New Project

Once you’ve signed up for Dropsource, you would create a project. You can choose either iOS or Android. After that, you’ll see the editor’s main screen. Create the initial structure in a few clicks. Each screen in your app is represented as a page, and your app needs to have at least one page in it. So, the first thing we need to do is select the “Pages” option on the left of the editor.

(Large preview)

The first page you create will be automatically set as the home (or landing) page for your app. This is the page your users will see first. You can also respond to page lifecycle events (such as “Page Loading,” “Page Appearing,” etc.) in the “Events” tab. For example, by changing “Page Loading” events, you can add a loading animation during the data-loading process.

page loading events
(Large preview)

Navigation Between Screens

Next, we need to tie two pages together. To allow the user to navigate between pages in your app, you can use actions. For example, we can add a button on the home page with a label “Get to know us,” and then the user can navigate to the “About Us” page by tapping the button.

adding button to improve navigation
(Large preview)

Open the “Events” button in the “Properties” tab. Click “Manage,” choose “Go to Page,” and select the target page from the list of available pages. In our case, we’ll transition to “About Us” and choose the transition type “Push.”

selecting the target page
(Large preview)

Building the User Interface

Dropsource uses objects called Elements as the building blocks of an app’s user experience. In the “Elements” section, to the left of the editor, you’ll see a variety of common components that you can use in your pages. To add them, simply click and drag and drop them to the canvas.

elements section

For the “About Us” page, we’ll add two elements: “Image View” and “Text View.”

adding elements
(Large preview)

Now we need to fill them with real data; select an image for the “Image View,” and add the text to be displayed. We can do this in the right panel. With just a few clicks, we’ll have the following page:

result about us
(Large preview)

Styling Elements

A lot of tools intended for fast product development provide a limited number of style options, and in most cases, a tool will force users to select from the list of available templates. As a result, many apps created with the tool will look similar. Not so with Dropsource. Dropsource is fully customizable, and you have complete control over the look and feel of your app. You can change style options for each element presented on the canvas — simply click the element, and you’ll find all available style options in the right panel.

change style options
With Dropsource, your app will be as unique as your vision. (Large preview)

You can also set styles dynamically while the app runs, so you’ll be able to change the appearance of elements when events occur in the app. Last but not least, if you create an app for both iOS and Android platforms, you can see the differences between styles. An app created using Dropsource is designed to provide the standard look and feel for each platform.

API Integration

Dropsource allows creators to connect their app to any REST API. It uses Swagger (or OpenAPI) specifications to build requests to the APIs. You can use prebuilt APIs or create your own API for the app. Public API providers, as well as back-end-as-a-service (BaaS) and internal enterprise systems, can be plugged right into your app quickly and easily, putting the full potential of that data at your fingertips. You can connect your Dropsource app to a back end built with Bubble or Backendless or even create a mock API with Stoplight. Essentially, you can use any provider you like, as long as it provides a REST API.

Working with data is one of the more complex elements of building your app, and Dropsource provides a good deal of resources to help you along.

If you want to use your own API, create a Swagger description file to integrate with Dropsource, so that it can access the API endpoints, signatures and data types.

swagger description file
If you want to use your own API, create a Swagger description file to integrate with Dropsource, so that it can access the API endpoints, signatures and data types. (Large preview)

Let’s create a “Search” page, which will be used to search for restaurants in the user’s area. We’ll need a few elements for this page: a search box, a submit button and a dynamic list. To provide search features, we’ll also need Google API integration. This means we’ll need to add an API to our project and configure it to show the search results. Dropsource already preloads several APIs into the platform for testing purposes, such as the Google Places API, the Slack API and others. Compared to visual design, API integration will require some initial effort (it’s not as easy as visually dragging and dropping). But as soon as you are familiar with it, you’ll be able to create truly powerful mobile apps. You can connect external data using an API. In our case, we’ll use the Google Places API (provided by Dropsource) to search for the nearest places.

connecting to an API
You can connect external data using an API. In our case, we’ll use the Google Places API (provided by Dropsource) to search for the nearest places. (Watch video)

Test the App

Testing is an essential part of the UX design process. It ensures that your applications will perform as expected in production and will deliver a consistent experience to users and earn you five-star ratings in the app stores. Unfortunately, this iteration often takes a significant amount of time. With Dropsource, the process of testing native apps is streamlined, because you can do so directly in the browser or on a real device.

testing right from the design screen
Dropsource allows you to test right from the design screen.

Browser testing is done through the Appetize.io tool, which makes it possible to share the app via a link. Share your work with colleagues and friends to get immediate feedback. Alternatively, you can test your app on a mobile device; with just a few clicks, Dropsource will email you a link to install the app directly on your mobile phone. From there, you can test all of the native functionality of your app and see the mobile UI right on your device’s screen, all without ever opening an IDE such as Xcode or Android Studio!

It’s possible to test the app using a simulator or on a real device. You can test your ideas and quickly iterate upon them.

tesingt apps using a simulator
It’s possible to test the app using a simulator or on a real device. You can test ideas and quickly iterate on them. (Large preview)

Publish the App

Once everything is tested and polished, you can ship the app to the App Store or Google Play in a few clicks. Simply click “My Build,” select the build that is ready to be shipped, and choose the option “Request a Service.” The Dropsource team will help you with publishing to the App Store or Play store for no additional fee. (Note: This is a premium feature, costing around $49 per month, but there is a 30-day free trial!)

publishing your app
You can publish your app to the App Store or Google Play directly from Dropsource. (Large preview)

Advantages And Disadvantages Of Building An App Yourself Versus With Dropsource

It’s worth comparing the differences between the standard approach for creating a mobile app (i.e. coding the app in IDE) and using Dropsource. Let’s suppose we have all of the technical skills for building a mobile app.

Coding from scratch Building with Dropsource
Software required to build for Android and iOS You’ll need to download and install the IDE for each platform. You’ll need only Dropsource. There’s no need to download anything; everything is available in the cloud.
Dealing with Android and iOS updates You’ll have to update your project according to the platform’s requirements, as well as update broken code (the “Auto update” functionality integrated in Android Studio and Xcode rarely works well). Dropsource is always up to date with the latest specifications for Swift and Java. Just run a new build in Dropsource after an OS update, and your native source code will be rewritten following any new standards or updates.
Visual inspection of UI elements; setting properties using visual editor A limited set of features is available in the IDE’s Layout Editor (Android) or Interface Builder (Xcode). A lot more can be defined in code. All properties of standard UI elements can be customized using Dropsource’s UI. It’s possible to set complex interactions by using a robust system of events and actions for each component.
Data-integration capabilities Integration with each third-party service requires coding. No coding needed to integrate app with external data sources.
Code ownership: Is it possible to download and distribute the source code of your app? Yes Yes
Is it possible to extend the app with custom logic? Yes Yes: You can either ask the Dropsource team to build a plugin or download your source code to customize yourself.
Performance optimization In most cases, you’ll need to optimize the code to achieve good performance. An app created with Dropsource doesn’t have any performance trade-offs; 100% truly native source code (Swift and Java) will always perform best on iOS and Android devices.
Testing on devices Use the IDE emulator and on real devices. Use the emulator in a browser and on real devices (either via a link or download the code to install on a device via the IDE).

Why Using Dropsource Is Good For Your Project

Hopefully, you now see that building a truly native app can be easy. Let’s see what the other benefits of using Dropsource are.

Both iOS and Android Are Supported

Dropsource allows you to create iOS and Android apps side by side. The app can be made for both platforms while maintaining similar interfaces and features. You won’t be stressed about OS updates because Dropsource is always up to date with the latest specifications for Swift and Java, eliminating any worry when Apple and Google update their operating systems.

No Lock-In

With Dropsource, you can download your app’s source code whenever you like. Dropsource generates source code that is written in Swift for iOS apps and Java for Android apps, and that code can be downloaded onto your desktop when you need it.

Dropsource allows you to download the source code in one click. This is a great opportunity to inspect the code and debug and to use that as the base for a fully customized app down the road.

downloading the source code with one click
Dropsource allows you to download the source code in one click. This is a great opportunity to inspect the code and debug and to use that as the base for a fully customized app down the road.

Prototyping and Development Finally Come Together

Usually, a prototyping phase that includes user interface design is separate from actual development. Developers get information from the designers (in the form of a specification) and start to implement the actual interactive app. With Dropsource, you have one phase, and this is a great advantage.

Easier Buy-in From Stakeholders

When talking about a design, a lot of stakeholders want to be able to see (and possibly play with) a prototype to better understand what’s being proposed. With Dropsource, you’re freed from asking stakeholders to imagine what they’ll see once the development team turns out the latest version — simply create a functional app prototype, and put it in their hands. Dropsource is perfect for building a minimum viable product to test out an idea.

Quick Iteration

The reality today is that we have to move fast in order to succeed. This is especially true in mobile development, where thousands of apps are released daily. We need to test a lot of hypotheses to figure out what works for us. One of the top mobile development trends is to reduce the duration of the development lifecycle and to shorten the gap between developing a concept and building the mobile application itself. With Dropsource, you can test ideas and quickly iterate on them. This eliminates the need for distinct, time-consuming phases of design (including static mockups and overwhelming specifications.) Dropsource substantially reduces the time to market for users and enterprises that need to innovate quickly.

Conclusion

App development should be available to all. Whether you’re an entrepreneur with a great idea but little in the way of development resources or a developer looking to save time, Dropsource offers powerful potential to save time and effort:

  • You can build a truly native app. A wide variety of common UI elements, such as buttons and input fields, are available on the platform.
  • Instead of having different developers (or even development teams) build the same product for different platforms, you can use the same team, regardless of platform.
  • The tool eliminates the requirement to manually code, while still providing access to native source code.
  • Easily integrate your app with any REST API’s back end.
  • Finally, the prototyping and testing phases are seamlessly integrated in the development process.

I would rate Dropsource five out of five for ease of use, features and functionality. If you’re looking for a robust tool to prototype or build a fully functional mobile app, try Dropsource for free. Every idea is worth building. Who knows? Maybe your app will change the world.

Smashing Editorial(da, ra, al, il)

Debugging CSS Grid Layouts With Firefox Grid Inspector

Overlay Grid

The first section you will see in the layout panel is Overlay Grid, which will show you all the elements on the page with display: grid applied. You will be able to turn on the grid overlay on each grid by checking their respective checkbox. For now, only one grid overlay can be displayed at any one time, but having multiple grid overlays is a feature on the roadmap.

Toggle grid overlay (Large preview)

Every additional grid will have a different color from the default purple, but you are free to change the colors of your grid overlays by clicking on the colored circle on the right of each grid element. The grid overlay will show all the grid tracks and grid gaps of the selected grid.

Customize grid overlay color
Customize grid overlay color (Large preview)

Once you select a grid, a rendering of the selected grid will appear in the space below in the color of the grid overlay. This rendering will show you each section of the grid you defined and hovering over any section will highlight its corresponding area on the actual page. There will also be a tool-tip that shows you the line number of the row and column of the highlighted grid item.

Visual highlighting tool
Visual highlighting tool (Large preview)

Most of us would be in the Rules panel when examining the CSS on our site, and you can toggle the grid overlay from there as well. Select the element which has display: grid applied to it, and click on the waffle-like icon on the property. The options for display of line numbers or grid area names that have been set on the Layout Panel will be respected when the grid overlay is toggled in this manner.

Toggle Grid overlay via Rules panel
Toggle Grid overlay via Rules panel (Large preview)

Grid Display Settings

The next section on the panel is the Grid Display Settings, which allows us to toggle three options for now. The display of line numbers, the display of area names and the option to extend grid lines indefinitely.

The basic premise of how Grid works is that you first define a grid, then proceed to place your grid items within that grid. You can either place those grid items manually or let the browser do it for you. The position of the grid items depends on their grid-row and grid-column values. Grid lines are referred to by their numerical index which starts from 1.

Toggle line numbers
Toggle line numbers (Large preview)

Once Display line numbers is active, the selected grid overlay will display the line numbers of the grid in the color of each respective grid overlay. Each grid has their own numerical grid index which starts from 1, different grids will not share the same numerical grid index.

Line numbers cut off at the top edge
Line numbers cut off at the top edge (Large preview)
Line numbers cut off at the side edge
Line numbers cut off at the side edge (Large preview)

If your grid extends the width or height of the viewport, you will notice that the line numbers get cut off at the edges. The Mozilla team is aware of this issue and it is being tracked under Bug 1396666.

You can also define a grid using the grid-template-areas property, which gives us the ability to name the areas on our grids. The syntax for this property also provides a visualization of the grid structure in the CSS itself, making it easier to understand the layout of the grid from your code.

Take the following block of CSS for example:

.subgrid1 { display: grid; grid-template-columns: 1fr 1fr 1fr; grid-auto-rows: 5em; grid-template-areas: "apple banana pear" "grape watermelon pineapple" "strawberry peach kiwi"}

This creates a 3 by 3 grid and each section is named according to how they are laid out in the grid-template-areas property. If the sections are named, they will be displayed as a second tool-tip when you hover over the rendering of the grid in the layout panel.

Grid area name tool-tip
Grid area name tool-tip (Large preview)

We can also toggle the display of the grid area names on the grid overlay by checking that option in Grid Display Settings. According to Mozilla, this feature was inspired by CSS Grid Template Builder, which was created by Anthony Dugois.

Toggle grid area names
Toggle grid area names (Large preview)

Fun fact. You can use emojis for grid area names and everything will work just fine.

Emoji grid names
Emoji grid names (Large preview)

The last option you can toggle is to extend grid lines indefinitely. By default, the grid lines on each grid are constrained to within the bounds of the grid container. But sometimes it can be useful to see how the grid aligns in the context of the entire page.

Extend grid lines indefinitely
Extend grid lines indefinitely (Large preview)

A Better Box Model Tool

The Box Model section under the Layout Panel shows a rendering of the dimensions of the selected element, its padding, borders, and margins. In addition to that, it also shows the CSS properties that affect the position, size and geometry of the selected element, namely box-sizing, display, float, line-height, position, and z-index. A convenience when it comes to troubleshooting layout-related CSS issues.

The computed value of the height and width of the selected element and its current positioning value is displayed below the box model outline. You can also directly manipulate the margins, borders, and paddings of the element from the diagram itself.

Tweak layout properties
Tweak layout properties (Large preview)

If you use CSS lengths other than pixels, the DevTools will convert the values into pixels automatically based on the computed value, which is really nifty.

Grid Inspector Plays Well With Transforms

There are many instances where Grid will be used in combination with other CSS layout properties, like transforms, for example. The Grid Inspector tool plays well with CSS transforms and the grid overlay will adjust to it, however, the selected element has been transformed. You will be able to see how the Grid has been rotated, skewed, scaled or translated.

Grid Inspector and Transforms
Grid Inspector and Transforms (Large preview)

Help Make The Grid Inspector Tool Better

As with any other browser feature, the Grid Inspector tool will inevitably have bugs as the team is hard at work adding new features and polishing existing ones. If you do encounter any such issues, please raise an issue at Bugzilla, Mozilla’s bug tracking tool.

The metabug, which tracks all Grid Inspector related issues, is Bug 1181227. You can search for the term Grid Inspector to see the list of related bugs as well.

Grid Inspector bugs
Grid Inspector bugs (Large preview)

If you have any suggestions or feedback on the Grid Inspector tool or the Firefox DevTools in general, Mozilla is on Discourse. Or you can also tweet at @FirefoxDevTools.

Resources

(rb, ra, il)

Customizing Admin Columns In WordPress

(This is a sponsored article.) If you manage a WordPress website, you’ve probably faced a common problem. How do you get insight into all of your content at a glance? WordPress’ admin area does not show you much about your pages, posts, users and comments. That can make it hard to find the right page, to check if all associated fields are properly filled, or simply to get a general sense of your website’s content. Does this sound familiar to you? Read on because we will demonstrate some simple custom solutions and a ready-to-deploy plugin to overcome this problem.

A modern WordPress website usually consists of much richer content than simply titles and chunks of text. Plugins such as Advanced Custom Fields and WooCommerce introduce custom fields that store specific pieces of content, such as prices, additional images, subtitles and so forth. Those functions on their own are great, but how do you keep track of all of that content when you can still only see the title, date and author in your admin screens? The answer is, you can’t.

In this tutorial, we’ll tackle this problem by showing you some easy-to-implement custom code. For those of you who don’t want to code, we’ll show you how to configure the Admin Columns plugin to do the job for you.

Also, you will learn how to:

  • add new columns to the posts overview,
  • sort your posts by these columns,
  • create a filtering form to find your content,
  • use Admin Columns to edit your content inline (without having to navigate to the individual post).

A Motivating Use Case

Imagine that you’re tasked with building or managing a website containing a real-estate agency’s portfolio. On the website, you display pictures, house addresses, locations, number of rooms and other attributes. On the admin screen, you manage the portfolio, adding, removing and editing existing real estate. The columns WordPress shows by default (title, author, publication date, number of comments) are hardly relevant for your real-estate website, and you’d be more interested in seeing the existing pictures and information about the real-estate listings as a whole.

Let’s look at a standard admin overview screen for custom post types:

admin overview screen for custom post types
(View large version)

This would be pretty useful if this were our website’s blog posts or news items, right? But for our real-estate portfolio, this gives us no information at all. The same goes for web shops, car dealerships, creative portfolios and so forth. Luckily, there’s a solution. We’ll work towards a far more pleasing overview of our real-estate portfolio, which will look like this:

overview real-estate portfolio
(View large version)

As you can see, this gives us a lot of insight into our real-estate portfolio. It’s now much easier to find, validate and, as you’ll see, edit the content.

We’ll provide a step-by-step guide to adding custom columns to your WordPress admin screens, sorting them and adding custom filters. We’ll also show you how to do this with the Admin Columns plugin. (If you don’t want to code, you can just skip to that part right away.)

Managing Columns With Code

First up is the management of columns for admin screens: adding columns that are specific to your content type, removing columns that are obsolete, and reordering columns. For this goal, WordPress offers the Columns API. It’s available for users and taxonomies as well, but we’ll focus on the posts screen. Changing the existing columns can be accomplished using two WordPress hooks: manage_[post_type]_posts_columns, which allows you to remove, reorder and add columns, and manage_[post_type]_posts_custom_column. In place of [post_type], enter the post type you wish to target. For pages, for example, you would use manage_page_posts_columns and manage_page_posts_custom_column, respectively.

If you haven’t heard about WordPress hooks, we encourage you to move on to the “Managing Columns With the Admin Columns Plugin” section. It explains how you can manage your columns without touching any code. But if you feel like learning, then read more about WordPress hooks (filters and actions).

“Where Do I Place My Code?”

To add all of this custom functionality, we need a place to run our code. This is best done in a plugin. In this tutorial, for example, we’re creating a custom plugin to run all of this code in. If you don’t know how to create a plugin, you can learn how.

All of the code snippets we’ll provide will go in our custom plugin. It is advisable to place such code in a plugin, not in your theme.

Adding, Removing and Reordering Columns

The first hook for managing columns (manage_posts_columns) is a filter that handles the array of columns. The standard array of filters for the posts overview is this:

[ [cb] => <input type="checkbox" /> [title] => Title [author] => Author [categories] => Categories [tags] => Tags [comments] => [..] Comments [..] [date] => Date]

We’re going to remove a few columns from this list and add a few. To do so, we’ll add a callback to the manage_posts_columns filter and append our custom columns to the columns array. Note that we’re using the manage_realestate_posts_columns hook. Here, realestate is the name of our post type, passed as the first argument to the register_post_type function for registering custom post types. We use it in place of [post_type] in the manage_[post_type]_posts_columns filter.

add_filter( 'manage_realestate_posts_columns', 'smashing_filter_posts_columns' );function smashing_filter_posts_columns( $columns ) { $columns['image'] = __( 'Image' ); $columns['price'] = __( 'Price', 'smashing' ); $columns['area'] = __( 'Area', 'smashing' ); return $columns;}

The first line adds our function smashing_filter_posts_columns as a callback to the filter that handles the columns that are displayed. The second line defines the callback function. Lines 2 to 4 add our custom columns to the list of columns. Finally, line 6 returns the resulting columns list.

Note: The smashing_ part before our functions is just a best practice to make sure that our function name is unique in WordPress. The __ function is used for translating the string to the user’s preferred language. Notice that for both “Price” and “Area,” we use smashing as the text domain, which WordPress uses to determine what source should be used to translate the string. We can omit this for translating “Image” because WordPress already includes translations of this word itself. You can read more about text domains in the WordPress Codex.

We’ve added columns to display an image, the price and the area, and the array with the new columns has been returned. The resulting real-estate list looks like this:

resulting real-estate list
(View large version)

We still have to do two things:

  • Remove the “Author,” “Date” and “Comments” columns, which are irrelevant to our real-estate content.
  • Reorder the columns so that “Image” is first.

We’ll modify our function to accomplish this. Note that we do not explicitly remove the three columns mentioned above, but simply construct an entire new array of columns precisely as we need them. The modified lines are highlighted.

add_filter( 'manage_realestate_posts_columns', 'smashing_realestate_columns' );function smashing_realestate_columns( $columns ) {  $columns = array( 'cb' => $columns['cb'], 'image' => __( 'Image' ), 'title' => __( 'Title' ), 'price' => __( 'Price', 'smashing' ), 'area' => __( 'Area', 'smashing' ), );  return $columns;} 

Our new real-estate overview screen is starting to take shape: Irrelevant columns have been removed, and new ones have been added in the right positions.

real-estate overview screen
(View large version)

Populating Columns

Next up is populating our columns. Again, WordPress provides a pretty simple hook to do so: the manage_[post_type]_posts_column action. Unlike the previously discussed hook, this is not a filter, so it only allows us to add content, not to change it. Thus, in the callback for this action, we’re simply going to echo the column content that we want to display.

Let’s start by adding the “Image” column.

add_action( 'manage_realestate_posts_custom_column', 'smashing_realestate_column', 10, 2);function smashing_realestate_column( $column, $post_id ) { // Image column if ( 'image' === $column ) { echo get_the_post_thumbnail( $post_id, array(80, 80) ); }} 

We added a callback function, smashing_realestate_column, to the action 'manage_realestate_posts_custom_column', taking two parameters: the column name and the post ID. This is indicated by the fourth parameter, add_action: It specifies the number of arguments expected by the callback function. The third parameter, called the priority of the hook, determines in what order the callback functions registered to the hook should be executed. We’ll leave it at the default, which is 10. This callback function populates a single post’s “Image” column.

image column
(View large version)

The remaining two columns, “Price” and “Area,” are stored as custom fields with the keys price_per_month and area, respectively. We’ll display these in the same way as we did with the image, displaying “n/a” when a price or surface area value is not available. The implementation is very similar for both columns. Starting with the price column, the changed lines in our smashing_realestate_column function are highlighted in the code block below.

add_action( 'manage_realestate_posts_custom_column', 'smashing_realestate_column', 10, 2);function smashing_realestate_column( $column, $post_id ) { // Image column if ( $column == 'image' ) { echo get_the_post_thumbnail( $post_id, array( 80, 80 ) ); }  // Monthly price column if ( 'price' === $column ) { $price = get_post_meta( $post_id, 'price_per_month', true ); if ( ! $price ) { _e( 'n/a' ); } else { echo '$ ' . number_format( $price, 0, '.', ',' ) . ' p/m'; } } } 

Next up is the area column. Except for the unit (square meters, m2, instead of dollars), the code is pretty much the same:

add_action( 'manage_realestate_posts_custom_column', 'smashing_realestate_column', 10, 2 );function smashing_realestate_column( $column, $post_id ) { [...]  // Surface area column if ( 'area' === $column ) { $area = get_post_meta( $post_id, 'area', true ); if ( ! $area ) { _e( 'n/a' ); } else { echo number_format( $area, 0, '.', ',' ) . ' m2'; } } }

That’s it! Our real-estate overview page now contains all relevant information that we want to display:

real-estate overview page
(View large version)

Let’s move on to some of the more funky stuff. Let’s add some sorting functionality to our columns!

Making Columns Sortable

Making columns sortable is relatively easy in WordPress, yet it’s rarely implemented for custom columns. Sorting helps you organize content and enables you to find content quickly. For example, we could sort our real-estate overview by price and then find our cheapest and most expensive pieces of property.

We’ll start by adding our “price” column to the list of sortable columns:

add_filter( 'manage_edit-realestate_sortable_columns', 'smashing_realestate_sortable_columns');function smashing_realestate_sortable_columns( $columns ) { $columns['price'] = 'price_per_month'; return $columns;}

This code hooks into the manage_edit-realestate_sortable_columns filter and adds smashing_realestate_sortable_columns as a callback function (line 1). The “price” column is made sortable by adding it to the list of sortable columns in line 3. Note that the array key, price, is the name we’ve given our column before. The array value is used to tell WordPress what it should sort by. We could, for example, use WordPress’ native sorting strategies to sort by title, date or comment count.

In our case, however, we want to sort by a custom field. This requires us to create another function, which needs to alter the posts query if we’re trying to sort by price. We’re going to use the pre_get_posts action. It allows us to change the WP_Query object (the object that WordPress uses to query posts) and fires before posts are queried. We check whether to sort by price and, if so, change the query accordingly:

add_action( 'pre_get_posts', 'smashing_posts_orderby' );function smashing_posts_orderby( $query ) { if( ! is_admin() || ! $query->is_main_query() ) { return; } if ( 'price_per_month' === $query->get( 'orderby') ) { $query->set( 'orderby', 'meta_value' ); $query->set( 'meta_key', 'price_per_month' ); $query->set( 'meta_type', 'numeric' ); }}

Lines 1 and 2 add the callback function to the action and start the definition of the callback function, respectively. Line 3 then checks whether we’re in the admin panel and whether the query is the main posts query (see the Codex for more information). If not, we don’t change the query. Then, we check whether the current sorting strategy is by price. If it is, we adjust the query accordingly: We set the meta_key value to price_per_month, telling WordPress to retrieve this custom field for all real estate, and we set the orderby key to meta_value, which tells WordPress to sort by the value belonging to the specified meta key. Finally, we tell WordPress to sort numerically instead of alphabetically, because “price” is a numerical column.

Note: You might have noticed that the filter we hook into is named manage_edit-realestate_sortable_columns, whereas you might have expected it to be manage_realestate_sortable_columns (without the edit-). This is simply an inconsistency in filter naming in WordPress.

The result is a sortable price column:

code sorting

The same procedure can be repeated for the “area” column. For textual columns, which should be sorted alphabetically, be sure to leave out the $query->set( 'meta_type', 'numeric' ) part.

Managing Columns With The Admin Columns Plugin

Now that we’ve covered the programming part of this tutorial, it’s time to move on to the much simpler method: using the Admin Columns plugin. Without touching any code and using a simple drag-and-drop interface, you can manage columns with just a few clicks. More than 150 column types exist. It comes with optional fields that let you customize how a column is named and behaves. In this last part of the tutorial, we’re going to show you how to set up Admin Columns to create the exact same overview as before. On top of that, we will show you how you can then filter and edit content directly from the content-overview screens.

First off, install Admin Columns as you would install any plugin, and activate it. It’s ready for use right away, so let’s start to manage our columns by going to the “Column Settings” page.

Admin Columns lets you control the columns per content type (for example, posts, pages, users or comments) using the dropdown box highlighted in the image above. In our case, we will select the post type “Real Estate.” You will see the screen immediately showing the columns that are currently active for this post type.

controlling the columns per content type
(View large version)

Adding, Removing and Reordering Columns

Let’s clean up a bit by removing columns we don’t need for our real-estate overview:

Wasn’t that easy? We will continue by adding our first relevant column: the featured image that shows a picture of the property. To do so, simply click the “Add Column” button, choose the “Featured Image” column type from the dropdown, and fill in the appropriate settings:

adding columns

As you can see, Admin Columns shows relevant display options for your columns to give you full control over their appearance. Here, you’re asked to specify the dimensions of the image to display. Later, we will see that Admin Columns shows the appropriate options when you select a different column type. For these options, Admin Columns tries to present sensible defaults, to minimize the time required to add new columns.

The last part showed us how to drag the column to the first position. Admin Columns lets you reorder columns simply by dragging them around. Our real-estate screen now looks like this:

eal-estate screen updated
(View large version)

We’re now going to add the two columns to display the property’s living area and monthly rent. Because we’ve added these custom fields using the Advanced Custom Fields plugin, we will use Admin Columns’ ACF integration plugin for this task. However, the “Custom Field” column would have also sufficed for this purpose.

The animation below shows the process of adding the “Area” and “Price” columns:

adding area and price columns

Note: Admin Columns offers integration add-ons for quite a few other plugins, including WooCommerce, Ninja Forms and Yoast SEO.

For those who followed the code examples and paid close attention, we did not add the “City” column. It’s a little trickier to do that with code, but with Admin Columns it’s a breeze. We simply select the “Taxonomy” column and pick the “City” taxonomy, and voilà! Our result is there. Didn’t we tell you? It’s a breeze!

city taxonomy column
(View large version)

Depending on your mouse-handling speed, we’ve achieved this result, from top to bottom, in somewhere between two and three minutes!

Sorting and Filtering With Admin Columns

Most of what you’ve seen so far is part of the free version of Admin Columns, which can be downloaded from WordPress.org. However, there is also Admin Columns Pro, which offers additional features. We’ll discuss the most prominent features for this use case: sorting, filtering and editing. These features will help you to quickly find and update your content right from the overview screen.

Although the features might be pretty self-explanatory, I’ll explain them really quickly in the context of Admin Columns.

Sorting will display your content in a particular order based on the value of a column. It’s great for getting insight into your content very quickly. For example, it enables you see which pages have a page template and to order them alphabetically. For a regular blog, you could quickly find out which users have authored the highest number of posts by sorting users according to their post count.

Filtering helps you to find content faster. You can filter columns that have a specific value, or a value within some range (for numeric columns) or without any value set at all. For instance, you could find e-commerce products within a price range, or posts missing a featured image or custom field. You could even use multiple filters together to target content more precisely.

Let’s get back to our use case and consider a simple example: We want to find houses with the largest surface areas. This will take us only a few seconds because we can simply make the “Area” column sortable and sort by that column in the real-estate overview screen:

sorting

Now, let’s take it a step further by adding a filter: We want to find the top 10 houses with the largest surface areas, but only those with a monthly rental price between $300 and $500. Again, a few clicks are enough:

filtering

There are, of course, many other ways to sort and filter. Combined, the features are a powerful tool to gain insight into your content.

Editing With Admin Columns

The real-estate overview screen now shows all relevant information and allows you to find the content you need. However, one thing is lacking: To edit our content, we have to go to the editing page, find the fields we want to change, update them, click “Update,” and go back to our overview screen.

What if we could do the same process in just three simple steps: click, edit, save? With Admin Columns Pro, we can.

editing

The screenshot above shows “direct editing” mode for the property title, and it’s available for almost all custom columns. In Admin Columns Pro, inline editing can be toggled from the columns settings screen. It automatically detects your content type and adds editability accordingly. With images, for instance, the media gallery will pop up.

In this example, we’ve used the Advanced Custom Fields add-on for Admin Columns, which comes with all business and developer licenses. It detects your ACF fields and adds them as possible columns. They are automatically sortable, filterable and editable — just toggle the corresponding icon.

The result is pretty neat: Our real-estate overview screen adds editing icons to all cells, and just by clicking, editing and saving, we can update our content. Let’s see that in practice: We’ve enabled direct editing for all of our custom columns, and we’re going to use that functionality to quickly update our content:

editing all

The changes are instantly saved. Should anything go wrong, undo and redo buttons are available to quickly revert.

Direct editing is supported for almost all columns. With the Advanced Custom Fields and WooCommerce add-ons, Admin Columns gives you a native editing experience as if you were editing from the details page.

Wrapping Up

Admin Columns can do much more cool stuff, but there’s just not enough room in this article. Why not take a look and check out some of the awesome features for yourself? We hope to see you there!

(mc, ra, al, yk, il)

Cheerful Wallpapers To Deck Your December Desktop (2017 Edition)

To get you in the right mood for December and the upcoming holiday season, artists and designers from across the globe once again got their creative ideas bubbling and created festive and inspiring desktop wallpapers for you. Wallpapers that are a bit more distinctive as the usual crowd and that are bound to add some holiday cheer to your screen.

All wallpapers featured in this post can be downloaded for free and come in versions with and without a calendar for December 2017. Happy holidays!

Please note that:

  • All images can be clicked on and lead to the preview of the wallpaper,
  • You can feature your work in our magazine by taking part in our Desktop Wallpaper Calendars series. We are regularly looking for creative designers and artists to be featured on Smashing Magazine. Are you one of them?

‘Tis The Season To Be Happy

Designed by Tazi from Australia.

'Tis The Season To Be Happy

Coming Home

“December is undoubtedly the family month. As a civil engineer I worked abroad and this was the only month we were guaranteed to return home to be with our families. I tried to represent this in my illustration, using, naturally, my namesake: Rudolph, the red-nosed reindeer. Even he has the right…” — Designed by Rodolfo Henriques from Portugal.

Coming Home

Christmas Cookies

“Christmas is coming and a great way to share our love is by baking cookies.” — Designed by Maria Keller from Mexico.

Christmas Cookies

Celebration Galore Is Here Again

“Christmas bells are swinging above the snow fields, we hear sweet voices ringing from lands of long ago… It’s time to count your blessings, sing your Christmas carols, open your gifts, and make a wish under the Christmas tree!” — Designed by Norjimm Pvt Ltd from India.

Celebration Galore Is Here Again

Christmas Woodland

Designed by Mel Armstrong from Australia.

Christmas Woodland

Surprise

“Surprise is the greatest gift which life can grant us.” — Designed by PlusCharts from India.

Surprise

Getting Hygge

“There’s no more special time for a fire than in the winter. Cozy blankets, warm beverages, and good company can make all the difference when the sun goes down. We’re all looking forward to generating some hygge this winter, so snuggle up and make some memories.” — Designed by The Hannon Group from Washington D.C.

Getting Hygge

Joy To The World

“Joy to the world, all the boys and girls now, joy to the fishes in the deep blue sea, joy to you and me.” — Designed by Morgan Newnham from Boulder, Colorado.

Joy To The World

Enchanted Blizzard

“A seemingly forgotten world under the shade of winter glaze hides a moment where architecture meets fashion and change encounters steadiness.” — Designed by Ana Masnikosa from Belgrade, Serbia.

Enchanted Blizzard

Christmas Owl

“Christmas waves a magic wand over this world, and behold, everything is softer and more beautiful.” — Designed by Suman Sil from India.

Christmas Owl

Snowflake

“I wanted to design something for Christmas with a modern twist — this is my effort!” — Designed by James Mitchell from the United Kingdom.

Snowflake

Winter

“The winter solstice has always been special to me as a barren darkness that gives birth to a verdant future beyond imagination, a time of pain and withdrawal that produces something joyfully inconceivable, like a monarch butterfly masterfully extracting itself from the confines of its cocoon, bursting forth into unexpected glory. (Gary Zukav)” — Designed by Dipanjan Karmakar from India.

Winter

Expectation

“Blessed is he who expects nothing, for he shall never be disappointed.” — Designed by StarAdmin from India.

Expectation

Magical Night

“At night, when the sky is full of stars and the sea is still, you get the wonderful sensation that you are floating in space.” — Designed by UrbanUI from India.

Magical Night

Santa Coming To India

“It’s December! Like elsewhere in the world, it is celebration time for us. How well do you know? Santa is coming with gifts for us Indians this way.” — Designed by Anish Joseph from India.

Santa Coming To India

Rudolph Dance

“Great inspiration is Rudolph the reindeer and a song about him. Rudolph the red-nosed reindeer, had a very shiny nose…” — Designed by S7 Design from Serbia.

Rudolph Dance

A Merry Christmas You Will Have

“I am a huge fan of Star Wars and there’s a new Star Wars movie premiering December 14, so I designed a parody cartoon image of Master Yoda on Dagobah wishing everyone a Merry Christmas… Yoda-style. I designed a candy cane as his walking stick and added a Christmas hat to complete the picture. I hope you like it!” — Designed by Evita Bourmpakis from Greece.

A Merry Christmas You Will Have

The Season Is Calling

“Christmas is coming… Music fills the air, stars brighten up the sky, Santa is on his way loading gifts for us on his sleigh… It’s time that we awake from our slumbers, open up our hearts, and be taken by all wonders of this beautiful month!” — Designed by IPIX Technologies from India.

The Season Is Calling

Let’s Spread Love And Joy

“The beauty of Christmas is in the happiness and cheers of the family that gathers around the gifts wrapped in colors of joy and peace all the way from Santa’s world. While the angels in the heaven, sing praises of the Lord, let us welcome Christmas with heartfelt joy and happiness. Wishing all a Merry Christmas and Happy Holidays.” — Designed by Acodez IT Solutions from Mumbai, India.

Let’s Spread Love And Joy

Season Of Joy

Designed by Antun Hirsman from Croatia.

Season Of Joy

Let It Snow

“How the snow falls in the north! Flake on flake falling incessantly, until the small dingles are almost on a level with the uplands. Let it snow!” — Designed by Mozilor Technologies from India.

Let It Snow

Shining Holidays

“All holidays can be good times. Wherever you go, no matter what the weather, always bring your own sunshine.” — Designed by TemplateWatch from India.

Shining Holidays

The World Is Asleep

“The snow kisses the trees and fields gently; and then covers the earth entirely with a white quilt and slowly whispers into its ears ‘Go to sleep, till the summer comes knocking at the door.’” — Designed by Tours In India from India.

The World Is Asleep

I Fell In Love With You In December

Designed by Priscilla Li from the United States.

I Fell In Love With You In December

Christmas In Matera

“I designed a front view of the famous Sassi of Matera, the Italian city that will be ‘European Capital of Culture in 2019’, by using ‘modular hearts’ and simulating the texture of typical Christmas jumpers.” — Designed by Antonio Cappiello from Italy.

Christmas In Matera

Happy Birthday Rudyard!

“December 30th is the birthday of Rudyard Kipling, the writer of the Jungle Book. To celebrate, I decided to create a very festive jungle scene with some of the characters from the story.” — Designed by Safia Begum from the United Kingdom.

Happy Birthday Rudyard!

Learn From Your Mistakes

Designed by Metrovista from Orlando, FL.

Learn From Your Mistakes

Dream What You Want To Do

“2017 will end, hope the last month, you can do what you want to do, seize the time, cherish yourself, expect next year we will be better!” — Designed by Hong Zi-Qing from Taiwan.

Dream What You Want To Do

Winter Romance

“What good is the warmth of summer, without the cold of winter to give it sweetness.” — Designed by BootstrapDash from India.

Winter Romance

Snowy White

“It is that time of the year when the world is covered in layers of white snow. Let’s bring some warmth to this cold month by getting wrapped in blankets and sipping a hot cup of chocolate by the fireplace.” — Designed by TBPL Builders from India.

Snowy White

Join In Next Month!

Please note that we respect and carefully consider the ideas and motivation behind each and every artist’s work. This is why we give all artists the full freedom to explore their creativity and express emotions and experience throughout their works. This is also why the themes of the wallpapers weren’t anyhow influenced by us, but rather designed from scratch by the artists themselves.

A big thank you to all designers for their participation. Join in next month!

What’s Your Favorite?

What’s your favorite theme or wallpaper for this month? Please let us know in the comment section below.

From Idea To Reality: Designing An App With Sketch And Xcode

Everyone has an idea for a mobile app, from your mom to the guy you met in line at the grocery store. You might even be one of those people, if you are reading this tutorial. Building your own app really gives you the ability to create anything you can imagine. For some people, the idea is the easy part; when it comes to making it a reality, they have no clue where to start.

In this tutorial, we are going to look at one page of an existing app and learn how to get the design into Xcode. The design for this app was done using an app called Sketch. Sketch allows you to design anything from websites to mobile apps. It is my preference for designing mobile apps.

When you are building an app, do not jump directly into Xcode. You’ll want to work on the app’s look and feel before doing any code. This will enable you to figure out exactly what your app will do before you start coding. Fixing a design is easier than fixing code. Once you are done with the design, you will then match it in Xcode. Here are a few other options that you might want to look at if you are interested in designing an app:

Moving From Photoshop And Illustrator To Sketch

Unlike Photoshop, Sketch was made for UI design right from the start; UI wasn’t an afterthought. If you’re a UI designer and are still using mostly Photoshop or Illustrator, it may be time to consider using Sketch instead. Read a related article →

Exploring The Design

One of the first things I like to do when I see an app is to review the design and see if I can figure out how they built it. Let’s first look at the design of this page:

appdemo

As you can see, this is a product detail page, which might be similar to others you have seen in e-commerce apps. What I most like about this product detail page, for learning purposes, is that it contains a lot of different user interface (UI) components. Designing a UI like this enables you to explore Xcode in a meaningful way and to tackle many of the most common components you would encounter when designing an app. The following diagram breaks down the different UI components of our design page:

different UI components
(View large version)

Let’s better understand each of these elements.

UIImageView

UIImageView
(View large version)

A UIImageView is a component that allows you to show images.

UILabel

UIlabel
(View large version)

A UILabel is typically used to display text on a single line, although you can set it up to display multiple lines of text. This component is not interactive.

UIStackView

UIStackView
(View large version)

A UIStackView allows you to stack components vertically and horizontally. For example, if you wanted to display three buttons spaced 10 pixels apart, you could use a UIStackView to make it easier.

UITextView

UITextView
(View large version)

A UITextView is typically used to display multiple lines of text. Users can interact with this component by editing the text. If we simply wanted to display text, with no ability to edit, we would normally use a UILabel. However, for this tutorial, I want to introduce you to both the UILabel and UITextView components.

UIScrollView

UIScrollView
(View large version)

A UIScrollView allows you to add multiple components that scroll either horizontally or vertically.

Designing In Xcode

Before we begin designing our app page in Xcode, I want to introduce you to two important aspects of Xcode, storyboards and table views. Let’s start with storyboards.

What Are Storyboards, And Why Do We Use Them?

A storyboard is a tool in Xcode that enables us to set up our visual elements. These elements, our UI components, can be dragged and dropped into place without the need for code. If you are a visual person, you will most likely feel very comfortable with storyboards.

In addition to not having to code, I love storyboarding instead of coding all of the elements because it makes it easy for another person to understand what is going on in the project and to step in if need be. Storyboarding also makes it easier for you to step away from a project for a period of time and then come back to it. If everything is in the storyboard, it will be relatively easy to figure out what you did and where you left off, as well as to make any visual changes you desire. Plenty of people prefer coding to storyboarding, but in this tutorial I am going to show you the benefits of storyboards.

To get familiar with storyboarding, let’s review the five basic areas of Xcode.

Xcode
(View large version)

Navigation Area

The navigation area shows all of your files (such as Main.storyboard, where you design your visual elements) and Assets.xcassets (the blue folder), which holds your app’s icon and images.

Editor Area

The editor area is where you will work. Both storyboard and Swift files open in this area.

Toolbar

On the left side of the toolbar, you will find controls to launch your app using a simulator. On the far right of the toolbar, you will find icons that allow you to toggle different panels to be either shown or hidden.

Utility Area

When inside of a storyboard file, you will use the utility area to make changes to UI components. This area will change depending on the screen with which you are currently interacting.

Debug Area

The debug area is very useful when you are coding. It shows issues with your code that you need to address. In this tutorial, we will not be using this area because we will not be coding, focusing instead on storyboarding.

Now that you are familiar with storyboards, let’s discuss table views.

What Is A Table View?

As you can see above, our page is one in which the user scrolls down to view more information. One of the great features of iOS is that you can use a table view to scroll long pages without having to code anything. A table view is a way to list data in one column that can be vertically scrolled. A table view can have sections, and each section can have a header. There are two types of table views: dynamic and static.

Dynamic table views use code, and they typically have variable numbers of rows and/or sections based on some data. Dynamic table views are great for mailing and contact lists, which can change over time.

Static table views do not use code and instead are set up using storyboards in Xcode. They are not dynamic, and they have a finite number of rows or sections based on certain data. Static table views are good to use for things such as forms and detail pages that will not change.

For the product detail page in this tutorial, we will use static table views, which give us the flexibility to have complex layouts without having to write a lot of code. This solution will not work for every situation, but it is a good place to start.

Setting Up the Basic Structure

Let’s set up the bare bones of our basic structure; then, we can start entering the details of our page. I have already created a starter project for you, where you will find all of the assets needed to complete this tutorial. Download the files, and then open the file named DesignToXcode.xcodeproj in the file inspector in the navigation area:

DesignToXcode
(View large version)

Next, select the Main.storyboard file. You should see the following:

Main.storyboard file
(View large version)

As the image above shows, our storyboard contains a single view controller on the scene. Nothing else has been created, because we will create the rest together. This view controller is where we will add the UI components that we discussed.

Looking at our page design, we need to add a navigation bar at the top, which will automatically add a label and two placeholders for buttons. We will eventually update the label title to CONVERSE CHUCK TAYLORS and leave the button placeholders alone.

To add the navigation bar, we first have to add a navigation controller. So, select the view controller by choosing “View Controller” under “View Controller Scene” in the outline view or by clicking on the leftmost icon of the view controller in the scene. The outline view is located as shown in the following image:

Adding A Navigation Controller
(View large version)

Then, in your Apple toolbar, go to “Editor” → “Embed In” → “Navigation Controller.” You should now have the following in your scene:

Embedding Navigation Controller
(View large version)

Next, let’s update the title in our view controller to read CONVERSE CHUCK TAYLORS. Click on “Navigation Item” under the view controller. In the utility area, select the “Attributes Inspector:”

Attributes Inspector

Type CONVERSE CHUCK TAYLORS in the title area. You will see the new title in the view controller in the scene.

Adding “Add to Cart” Button

Next, we need to address one of the major features of this product page. Looking at the design, you will notice that the “Add to Cart” button is pinned to the bottom and that the content scrolls underneath the button. We can create this design feature in a few different ways, but I find using a container view to be easiest. A container view is just a container that sits in our controller and allows us to use another view controller of our choice. For our design, the container view will consist of our static table view. Because a static table view cannot be dragged into a view controller with other elements, the container view will provide a separate container within which to set up the table view. In addition, the container view allows us to pin the “Add to Cart” button to the bottom, as the content is being scrolled.

The two main elements of the “Add to Cart” button are an image (the background of the button) and a button. Whenever I can, when items are grouped together, I put them into a UIView, which I treat as a container.

Let’s start setting up our “Add to Cart” button by adding the container. In the utility area, open the “Object” library, and then type view in the filter bar:

object-library-filter-area
(View large version)

Drag the view into our view controller, and then click on the size inspector in the utility area:

Size Inspector

Set the following values in the size inspector:

  • X: 0
  • Y: 607
  • Width: 375
  • Height: 60

Now that our container is in place, we need to add our image.

In the object library, type image in the filter area. Drag an image view into the view we just added. In the size inspector, add the following values:

  • X: 0
  • Y: 0
  • Width: 375
  • Height: 60

In the attributes inspector, set “Image” to btn-bg.

Finally, let’s add our button. Type button in the filter area, and drag the button into the same view. In the size inspector, add the following values:

  • X: 8
  • Y: 8
  • Width: 359
  • Height: 44

In the attributes inspector, add the following values:

  • Type: System
  • Title: Change Button to “ADD TO CART” in the text field above “Font.”
  • Font: Click the font icon, then “Custom,” and choose Avenir Next Condensed, Bold 24.0
  • Text color: White
  • Background: addtocart-bg

Now that we have set up the button, our storyboard should look like the following:

Navigation Controller
(View large version)

We now need to add some auto layout for our elements. Auto layout is a tool used to constrain components to the view. For example, you would use auto layout if you wanted a label to be pinned 10 pixels from the top of the view. You also would use auto layout to make sure that the label is vertically centered inside of your view. For our purposes, we will use auto layout to pin our “Add to Cart” button to the bottom of our view so that our content scrolls under it.

Let’s get started on applying auto layout to our “Add to Cart” button. First, select the view we recently added (i.e. our container), and click on the pin icon:

Select Pin Icon
(View large version)

With the pin icon selected, enter the following values:

  • Left: 0
  • Right: 0
  • Bottom: 0
  • Height: 60 (make sure box is checked)

You can enter the left, right and bottom values just by clicking on the red barbells if their values are already at 0. After entering those values, click “Add 4 Constraints”:

Add To Cart
(View large version)

Now, our elements will always be pinned to the bottom of the device, with a height of 60, regardless of how tall our device is.

Next, we want to ensure that, no matter the size of the view, the background will fill the entire area. Therefore, select the image we are using for the background, click the pin icon, and then enter 0 for the top, left, right and bottom constraints. After entering those values, click “Add 4 Constraints”:

Adding New Constraints
(View large version)

We also need to apply auto layout to our button. Select the button, click the pin icon, and then enter 8 for the left, right, top and bottom constraints. After entering those values, click “Add 4 Constraints”:

Add 4 Constraints
(View large version)

The constraints we just added will make sure that our button is always 8 pixels from the left, right, top and bottom of the view.

Let’s see how our application of auto layout works across different devices. Rather than building and running our project for each device, we can preview how our “Add to Cart” button looks across devices quite quickly. In the top right of your Xcode screen (above the utility area), select the “Assistant Editor” button, which will split the screen:

Assistant Editor button

Then, in the menu at the top of the new screen, select “Preview(1)”:

(View large version)

Once you select “Preview,” if you scroll to the bottom of the assistant editor screen, you will see the “Add to Cart” button pinned to the bottom of the iPhone 7 screen. Next, select and delete the iPhone 7 screen image in order to have an empty screen. Then, in the bottom-left corner, click the “+” button:

Assistant Editor
(View large version)

In the menu that appears, select the “iPhone SE.” Then, open this menu again and add the “iPhone 7 Plus” as well as the “iPad Pro 9.7″ | Full Screen.” When you are done, you will see the following:

different resolutions
(View large version)

Notice that auto layout works exactly as we expected. Our “Add to Cart” button has expanded to the full width of the screen and is pinned to the bottom. Feel free to look at other devices and orientations. When you are done, exit the assistant editor and return to the standard editor.

Adding a Table View

Let’s now add a table view to our design. In the object library, type container in the filter area. Drag a container view into the view, and in the size inspector add the following values:

  • X: 0
  • Y: 0
  • Width: 375
  • Height: 607

When we added our container view, you would have noticed that it created a view controller. Because we need a static table view, we will delete the view controller that was just created for us and replace it with a table view controller. Therefore, select the view controller that was created for us and hit “Delete.” Then, in the object library, type table view in the filter area. Drag a table view controller onto the scene. Then, from the container view that we just created, hold the Control button and drag to the table view controller. Select “Embed” on the screen that pops up:

Container view to table view controller

You have now connected the container view to the table view controller. Next, select the “Table View” in the table view controller, and in the attributes inspector change the “Content” from “Dynamic Prototypes” to “Static Cells.” Three new cells should now be at the top of your table view controller:

(View large version)

However, we need a total of five cells for our product detail page. Let’s see these five cells delineated in our design:

(View large version)

As you can see, each of the five cells has different elements that we will need to add in order to create this product page. In order to get the desired layout and functionality, we need to update a few things.

First, in the outline view, select “Table View Section.” Then, in the attributes inspector, update “Rows” to 5. Select each cell, and in the size inspector update each cell row’s height to the following values:

  • Cell 1: 540
  • Cell 2: 290
  • Cells 3 and 4: leave as the default
  • Cell 5: 235

When you are done, hover your mouse over the table view in the scene, and then swipe up and down to scroll through the table view:

(View large version)

Select each table view cell, and in the attributes inspector update “Selection” from “Default” to “None.” Table views, by default, allow the user to select an item such as a cell. Because we do not need the behavior of cell selection, we have now removed this default.

Finally, we need to add auto layout to the container view that we added. Select the container view, click the pin icon, and then enter 0 for the top, left, right and bottom constraints. After entering those values, click “Add 4 Constraints”:

(View large version)

Let’s build and run the project by hitting the play button (or press Command + R). You should see our static table view, as well as have the behavior we want, which is the table view scrolling under our “Add to Cart” button:

(View large version)

Now that our basic structure is established, it is time to start building our product page to make it look like the design we reviewed at the beginning of this tutorial.

Updating Our Cells

We will work with one cell at a time in order to add all of the elements we need and position them in the cell, and then we’ll add auto layout to ensure that the elements will work with any device’s screen.

Cell One

In our first cell, we need two labels to display the product’s name and price. In addition, we need five images, four as product thumbnails and one for the product’s large image.

To begin, type label in the filter area of the object library, and drag two UILabels into the table view cell. Then, type image in the filter area, and drag five UIImageViews into the table view cell. We need to update each of these element’s size and position to the following.

UILabel 1

Size inspector:

  • X: 15
  • Y: 308
  • Width: 345
  • Height: 28

Attributes inspector:

  • Text: plain
  • Under text: change “Label” to “CONVERSE CHUCK TAYLOR ALL STAR HIGH TOP”
  • Color: light gray
  • Font: Click font icon, then “Custom,” and choose Avenir Next Condensed, Medium 20.0

UILabel 2

Size inspector:

  • X: 15
  • Y: 337
  • Width: 54
  • Height: 28

Attributes inspector:

  • Text: plain
  • Under text: change “Label” to $55
  • Color: black
  • Font: Avenir Next Condensed, Bold 20.0

UIImage 1

Size inspector:

  • X: 0
  • Y: 0
  • Width: 375
  • Height: 300

Attributes inspector:

  • Image: red-chucks

UIImage 2

Size inspector:

  • X: 15
  • Y: 474
  • Width: 77
  • Height: 50

Attributes inspector:

  • Image: red-chuck-thumbs

UIImage 3

Size inspector:

  • X: 100
  • Y: 474
  • Width: 77
  • Height: 50

Attributes inspector:

  • Image: pink-chuck-thumbs

UIImage 4

Size inspector:

  • X: 185
  • Y: 474
  • Width: 77
  • Height: 50

Attributes inspector:

  • Image: yellow-chuck-thumbs

UIImage 5

Size inspector:

  • X: 270
  • Y: 474
  • Width: 77
  • Height: 50

Attributes inspector:

  • Image: blue-chuck-thumbs

After adding all of these elements and updating all of their attributes, you should see the following in your storyboard scene:

The only remaining components we need to add to cell one are the shoe sizes. If we break this down, for when the shoe is out of stock, we need three elements: (1) the background, (2) the label and (3) the slash image. If the shoe is in stock, we need just the background and the label. Earlier, I mentioned that whenever elements are grouped together, I prefer to put them in a container. The shoe size elements are an instance of this.

Let’s begin setting this up by dragging a UIView, which will act as our container, into our first table view cell. In the object library, type image in the filter area and update the following values in the size inspector:

  • X: 15
  • Y: 374
  • Width: 40
  • Height: 40

Next, in the object library, type image in the filter area and drag a UIImageView into the container we just created, and then update the image with the following values:

Size inspector:

  • X: 0
  • Y: 0
  • Width: 40
  • Height: 40

Attributes inspector:

  • Image: outstock-bg

Now, in the object library, type label in the filter area and drag a UILabel into the same container, and update the following values for that label.

Size inspector:

  • X: 0
  • Y: 0
  • Width: 40
  • Height: 40

Attributes inspector:

  • Text: plain
  • Under text: change “Label” to 8
  • Color: light gray
  • Font: System 17.0
  • Alignment: center (icon)

Finally, in the object library, type label in the filter area and drag another UIImageView into the same container, and then update the image’s following values:

Size inspector:

  • X: 0
  • Y: 0
  • Width: 40
  • Height: 40

Attributes inspector:

  • Image: slash

At this point, your storyboard should look like this:

Now, we need to duplicate this element to create all of the different shoe sizes.

For the first row of shoe sizes, in the outline view, select the container that we just created and hit Command + C to copy, and then hit Command + V to paste. Continue to hit Command + V until you have seven of these containers.

We need to ensure that all seven of these views stay the same size, in both height and width, when in a StackView, which, as the name suggests, allows us to stack both horizontally and vertically.

First, select all of these views in the outline view (hold Shift, and then click the first and last one to select all):

(View large version)

Click the pin icon, check the boxes for both height and width, and, lastly, click “Add 14 Constraints.”

While the seven views still are selected, click the StackView icon, located two icons to the left of the pin icon:

(View large version)

Our containers are now all in a StackView. However, they are stacked right next to each other. To fix this, in the outline view, select the StackView that we just created, and in the attributes inspector update the following values:

  • Axis: horizontal
  • Alignment: fill
  • Distribution: equal spacing
  • Spacing: 10

We need to add another row. With the StackView still selected, hit Command + C to copy, and then Command + V to paste. Once you paste the new StackView, move it to right under the first one. They do not need to line up perfectly.

Next, select both of the StackViews and then the StackView icon. Similar to when we selected the StackView icon, the StackViews are now stacked; however, they are on top of each other, rather than next to each other. Select the main StackView, and in the attributes inspector update the following values:

  • Axis: vertical
  • Alignment: leading
  • Distribution: equal spacing
  • Spacing: 7

Then, click the pin icon and enter the following values:

  • Top: 9
  • Right: 15
  • Left: 15
  • Height: 87
  • Constrain to Margins: unchecked

Click “Add 4 Constraints.”

Select one of the other two StackViews in the outline view, click the pin icon, and enter the following values:

  • Right: 0
  • Left: 0
  • Height: 40
  • Constrain to Margins: unchecked

Click “Add 3 Constraints.” Repeat this step for the remaining StackView. When you are done, you will see the following:

Finally, select the last four boxes of the bottom StackView, and hit “Delete.” When you complete this step, the boxes will fill the space evenly.

Our next step for setting up cell one is to change the “8” in each of the boxes to the shoe sizes that are in our example page. In addition, we need to adjust two of the boxes to reflect the sizes that are in stock, 9 and 9.5, without a slash through the boxes.

To change the 8 to another shoe size, select the label under the view for a particular box, and in the attributes inspector change the 8 to a new shoe size. Repeat this for each of the sizes in our design.

Lastly, to show that size 9 is available, select the view with “9” as the label, and in the attributes inspector change the outstock-bg image to instock-bg. Repeat for the view with “9.5” as the Label. Then, in the outline view, for each of these two sizes, select the slash image and click “Delete.” This will now show that you have two sizes in stock, 9 and 9.5:

Cell one is now complete.

Cell Two

Let’s add our elements to cell two. Here, we have two components, a UILabel to display our header and a UITextView for a large body of text. Drag one of each into our second table view cell. With the label selected, update the following values.

Size inspector:

  • X: 18
  • Y: 7
  • Width: 109
  • Height: 21

Attributes inspector:

  • Text: plain
  • Under text: change “Label” to “DESCRIPTION”
  • Font: Avenir Next Condensed, Demi Bold 14

Next, with the text view selected, update the following values:

Size inspector:

  • X: 13
  • Y: 22
  • Width: 362
  • Height: 261

Attributes inspector:

  • Text: plain
  • For the text, enter the following:

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec id maximus erat, imperdiet iaculis ligula. Curabitur elit dui, ullamcorper ut rutrum in, facilisis non nibh. Maecenas eget ipsum dictum, commodo purus id, aliquam lorem. Duis vitae tincidunt velit. Praesent vestibulum et velit vel tempus. Vivamus fringilla sollicitudin cursus. Nunc sit amet elit mauris. Sed quis tincidunt sem. Proin a rutrum nibh. Nunc porta aliquam dolor at sollicitudin. Nam nisl diam, mattis vel sapien a, eleifend convallis lacus.

Proin tortor arcu, semper vitae blandit pharetra, efficitur eu purus. Sed pharetra odio vitae massa efficitur dapibus. Aenean vitae arcu sollicitudin, mollis erat et, convallis dolor. Mauris feugiat mi elit, ac suscipit mi tempus sodales. Aliquam vitae odio luctus sem bibendum eleifend. Praesent eu aliquet justo, quis tristique dui. Nunc sed purus purus.

  • Font: Avenir Next Condensed, Ultra Light 17

This text view is now set up to match our design. So, the height of 261 that I asked you to enter above is to completely show all of the text we entered. Feel free to experiment with this by changing the amount of text, which would then require a change in height as well.

In regards to UITextView versus UILabel, I honestly do not use UITextView much. My preference is to use UILabel, but in this tutorial I wanted to show you both. I do not have a reason for using the latter other than I just like it more. For this cell, we are adding dummy data to match our design. If you were trying to make the UITextView or UILabel dynamic in height, you would need to do some auto layout updates. For this tutorial, set the height manually and rest assured that the heights of both UILabel and UITextView will adjust to their content’s size using auto layout.

Lastly, let’s add some auto layout to our cell items. First, select the label, click the pin icon, and then enter the following values:

  • Top: 7
  • Left: 18
  • Width: 109
  • Height: 21

Then, click “Add 4 Constraints.”

Select the text view, click the pin icon, and enter the following values:

  • Top: 22
  • Right: 0
  • Bottom: 6.5
  • Left: 13
  • Constrain to Margins: unchecked

Click “Add 4 Constraints.” Cell two is now complete.

Cells Three and Four

Cells three and four are basically the same, except for their text. First, drag a UILabel into each of cell three and cell four. For each label, enter the following values.

Size inspector:

  • X: 18
  • Y: 10
  • Width: 109
  • Height: 21

Attributes inspector:

  • Text: plain
  • Font: Avenir Next Condensed, Demi Bold 14

Finally, for the text, for cells three and four, change “Label” to “SIZE GUIDE” and to “REVIEWS (0),” respectively.

Cell Five

Let’s update our last cell. As you can see from the design we reviewed at the beginning of this tutorial, cell five contains a UIScrollView in order for our “You may also like” section to scroll from left to right. ScrollViews can be created through code; however, consistent with the rest of this tutorial, we will build a working ScrollView with no code.

First, drag four UIImageViews into the cell, next to each other (even overlapping them in order to fit). In the size inspector for each image, change the width to 118 and the height to 172. Then, in the attributes inspector, change “Image” under the four image views to mn-hoodie1, mn-hoodie2, wm-hoodie1 and wm-hoodie2, in any order you like. When you are done, you should have something resembling the following:

Next, select all four images and select the pin icon. Set the width and height for all four images by clicking the boxes next to width and height and then on “Add 8 Constraints.” With the four images still selected, hit the StackView icon. In the attributes inspector, update the following values:

  • Axis: horizontal
  • Distribution: equal spacing
  • Spacing: 10

As you can see below, the images are now spaced equally, with 10 pixels in between:

Next, we need to put the StackView inside of a view. Select the StackView that you just created, and in the Apple toolbar click on “Editor” → “Embed In” → “View.” We need to adjust the size of the newly created view by updating the width to 502 and the height to 172. We also need to adjust the position of where the StackView is located in this new view. Select the StackView and enter the following values in the size inspector:

  • X: 18
  • Y: 0

Now, we need to get everything we just created into a ScrollView. Select the view in which the StackView resides, and then select “Editor” → “Embed In” → “Scroll View.” With the new ScrollView selected, enter the following values in the size inspector:

  • X: 0
  • Y: 0
  • Width: 375
  • Height: 172

Lastly, in order to make our images scroll, we need to put the ScrollView in another view. Select the ScrollView, and then click “Editor” → “Embed In” → “View.” With this new view selected, enter the following values in the size inspector:

  • X: 0
  • Y: 33
  • Width: 375
  • Height: 172

The last element we need to add is a UILabel. Drag a label into cell five, and enter the following values in the size inspector:

  • X: 18
  • Y: 3
  • Width: 116
  • Height: 21

In the attributes inspector, enter these:

  • Text: plain
  • Under text: change “Label” to “YOU MIGHT ALSO LIKE”
  • Font: Avenir Next Condensed, Demi Bold 14

Let’s add auto layout to our elements in cell five. With the Label selected, click the pin icon, and enter the following values:

  • Top: 3
  • Left: 18
  • Width: 116
  • Height: 21

After entering the values, click “Add 4 Constraints.”

Then, for all of the other elements in cell five, to add auto layout, ensure that all of the disclosure arrows are open in the main view container that is holding the ScrollView, and ensure that you can see all the way to your images, as follows:

Now, select the StackView, click the pin icon, and enter the following values:

  • Top: 0
  • Right: 0
  • Left: 0
  • Height: 172 (should be checked)

When you are done entering the values, click “Add 4 Constraints.”

Next, click on the align icon, which is just to the left of the pin icon, and enter the following values:

  • Horizontally in container: 0 (should be checked)

Then, click “Add 1 Constraint.”

Next, in the outline view, select the view that is holding the StackView. With that view selected, click the pin icon and enter the following values:

  • Top: 0
  • Right: 0
  • Left: 18
  • Bottom: 0

After entering the values, click “Add 4 Constraints.”

In the outline view, select the ScrollView, click the pin icon, and enter the following values:

  • Top: 0
  • Right: 0
  • Left: 0
  • Bottom: 0

Then, click “Add 4 Constraints.”

Finally, in the outline view, select the main container (the view holding the ScrollView), click the pin icon, and enter the following values:

  • Top: 0
  • Right: -8
  • Left: 0
  • Height: 172 (should be checked)

When you are done, click “Add 4 Constraints.” You have now completed all of the auto layout for cell five.

Let’s build and run the project by hitting the play button (or press Command + R). You will now be able to see your ScrollView working without having had to code anything. If you run your project on multiple devices, you will also see that everything fits the way it is supposed to.

Where To Go From Here?

Now that you have completed this tutorial, my first suggestion would be to try repeating what you’ve done without referring to the steps in the tutorial. Once you are comfortable with storyboarding in Xcode, take some time to learn Swift 3. By knowing Swift, you will be able to add a product list as well as to show products on the detail page that we just created with dynamic data. If you still want to learn more, check out my book iOS 11 Programming for Beginners, which will be released later this year.

Summary

In this tutorial, you’ve learned how to bring a design into Xcode without any code. You’ve also learned how to look at a design and figure out what components it has. Then, you added all of the components of the design into storyboards and updated them to match the design. You’ve also learned how to add auto layout so that the design looks good on any device. Hopefully, this tutorial has introduced you to the ease and possibilities of storyboards. The more you work with storyboards, the more comfortable you will get.

As a full-time iOS engineer, I love doing the design side of an app because it helps me to become a better engineer. To me, it is always fun going into the App Store or looking at my favorite app and trying to figure out how they built it, including how they designed it. I really enjoy trying to recreate an app that catches my eye.

If you are a designer, I am sure you have seen plenty of designs that are not perfect. I am OK with my design not being perfect, and you should feel that way with your app’s design. You have to start somewhere, and with the help of other designers and developers, you will improve. Hopefully, this tutorial has opened your eyes to some things that you did not know or at least enabled you to hone your existing skills.

(da, ra, al, il)