Mastodon June 2015 – Josh Hrach

iOS today view widgets and margins

One of the toughest things I’ve had to deal with while working on an app has been the today view widget. The widget I’ve been working on is very simple: 2 buttons and a label. Yet, there were a couple of issues I kept running into.

  1. When loading the widget, my buttons will appear and layout. With a button tap, the two buttons change size to what is constrained in the Storyboard. This only happens when the widget is loaded and with the first tap. Subsequent taps don’t affect it again.
  2. The widget, as much as I tried, would not appear as it did in the storyboard. Things weren’t centered properly.

The first item I still haven’t solved. The issue that ended up solving the second item is what I thought was affecting the button layout. Essentially, here is what I had: left button is x points from the left edge of the view, is y points from the right button, and has a width equal to the right button. The right button is the same except it has a constraint to the right edge of the view instead of the left. I had hoped that this would lead to a dynamic button size that would change on various devices and widths. Unfortunately, the small issue with the resizing buttons kept bothering me. If someone can figure this out, let me know.

The second issue was actually fairly easy to figure out. If you look at any of your current widgets, you probably notice two different layouts: ones that are full width, and ones that start indented.

I thought that Apple wanted all widgets indented, but there are even some of Apple’s own widgets that are full width. While it wouldn’t solve the first issue I was having (and gave up on), it did impact why the storyboard, set to the width of the device, wasn’t looking like what my widget was showing.

To solve this, make use of the NCWidgetProviding protocol. There is a method called widgetMarginInsetsForProposedMarginInsets  that you can use to either accept the default margin or set it to a custom value.

- (UIEdgeInsets)widgetMarginInsetsForProposedMarginInsets:(UIEdgeInsets)defaultMarginInsets
{
    return UIEdgeInsetsZero;
}

By removing the insets, I suddenly had a widget that not only was centered but also was taking up the space in the view as it was in the Storyboard.

If you want to see what I was working on, check out Countr on the App Store.

The advantage of digital work

I’ve had JoshsPadd.com for over 10 years. This WordPress site has been up for over six. Yet, I always felt like I wasn’t writing as much as I wanted to.

The very thought of writing can be intimating when you feel you have a lot you want to say. For instance, I recently completed our birth story post. I had started on it shortly after the birth of our son. But as time went on, it kept getting put off. The idea of being thorough with what I was writing held me off from just sitting down and finishing it. Would I miss something vital? Would people like what I had completed?

That last thought is something that I also struggle with when I’m developing apps. Sometimes I get so caught up in making things just right that I don’t release an update as quickly as I could. But sometimes, you just need to sit down and go through with something and deal with any missed details later.

The advantage of digital work: it can always be touched up.

 

Our Birth Story

It’s hard to believe that our son, Tiberius, is already six months old. ((Previous drafts of this post had the terms “over two weeks”, “over three weeks”, “over a month”, “three months”, and “almost six months”. I guess I’ve been working on this for a while. )) In some ways, it has felt like he’s been here with us forever. In others, I can’t believe that he’s even here with us. Before too much time passes, I wanted to share our birth story.

Our Plans

natural birth in progress sign

My wife Shannon and I, early on, had every intention of having as natural of a birth as possible. We did research on hospital births, caesarians, epidurals, vaccines, and anything else that might come up around the birth of a child. In the end, we made the choice to plan for a home water birth. With that intention, we sought out a midwife to help us prepare for our home birth.

We had already known that we were going to move when we found out we were pregnant, so before our move to Arizona in September, we began looking at midwives around the Phoenix area. After a few FaceTime calls to some prospects, we settled on Crystal. ((Crystal also worked with an assistant, who was also well qualified. For us, that was Rose.)) All of the midwives we spoke to were definitely educated and qualified. However, my wife also wanted a midwife that she would be comfortable with and that would be there for us when we needed her. Crystal proved to fit all of our needs.

Our other request before moving was to line up a doula. For those that don’t know, wikipedia provides a somewhat dry definition:

A doula is a nonmedical person who assists a woman before, during, or after childbirth, as well as her spouse and/or family, by providing physical assistance, and emotional support.

For us, having a doula meant added support for both my wife and I. While the midwife would assist with the actual birth, we knew that additional emotional support would be of great assistance to my wife, while also providing a support so that I would be able to assist without feeling overwhelmed.

Again, we took a look at our options for doulas around Phoenix. In the end, Rebecca was our choice. Just like with choosing a midwife, we wanted someone that we both would be comfortable with. After an almost two hour ‘interview’ over Skype, we felt comfortable with our decision.

birth team rebecca crystal rose

Over the following months, our lives continued on as we had planned: we eventually packed, moved, and settled into Tempe, Arizona. That was in early September, still a couple of months before Bear ((Bear was our nickname for our son; it still is, though we’ve added a few more)) was due to arrive.

In the weeks that followed, we continued forward with our plans. We started purchasing items that we would need for a home birth, such as items that would work along with the birth pool we were renting. We also planned where we wanted the pool to be. In the end, we chose to have the pool in the bedroom. It would provide easy access for my wife to get back into bed should she need to, plus it would keep her close to the bathroom should she need to use it.

There was one more thing that we wanted with our home birth: a photographer. While not necessary to the birth process itself, we wanted to be able to have photos and videos from the birth of our son that we would be too busy to take ourselves. Several factors came into play with our ultimate decision for a birth photographer. First, we wanted someone that could take good photos and knew how to capture important moments. Second, we wanted someone that did a good birth story video. Several of the potential photographers did videos, but they didn’t always seem to be a story video; some seemed to just be plain video of births. We wanted something more. And lastly, we wanted a good photographer that could meet in our budget.

In the end, we chose Kelly. From her online portfolio, we knew that she could catch those rare and wonderful moments that we would be too busy to catch. Plus, her video offering was indeed a birth story, not just a birth video.

By the middle of October, we had all of these elements of our birth team in place.

Getting Closer

With our birth team figured out, things seemed to turn into a waiting game. Our estimated due date ((It’s never an exact due date, no matter how many ultrasounds and examinations are done. Why? Because each baby is different, and sometimes you don’t know exactly when the baby was conceived.)) was November 17. It was just a matter of getting to that date and seeing what would happen.

Of course, as is to be expected, we were approaching November 17 with little sign of when things would begin. And then November 17 came and went. Was something wrong? Was the baby okay? Yes, everything was fine.

When it comes to babies, they come when they come. Just because a baby hasn’t arrived by the time of an estimated due date doesn’t mean that you should start to panic. When humans first started having children, did they count out 40 weeks and stick to an exact calendar?

Of course, we not only weren’t rushing to have our son arrive, but we also came to a realization. One day, while checking one of her ‘monthly tracking’ apps, Shannon noticed that our guess as to when we had conceived was different from the actual data. In short, we were off a week. Instead of November 17 ((Roughly)) beginning our 40th week, it was really November 24. We had an extra week.

That extra week was very important for us. According to state law in Arizona, after 42 weeks, if the baby has not been born, care must transfer from a midwife to a doctor in a hospital. ((At this point, the state would consider the pregnancy to be higher risk, though just crossing the 42 week mark doesn’t spontaneously put the baby at risk.)) We were doing our best to stay away from unnecessary medical intervention, so we were glad to have a little more breathing room.

Still, we were caught in a waiting game. Even if everything is going fine, you can easily get anxious. When will we see our little guy? When will things start? What will be the first signs?

Saturday, November 29, we thought we would be finding out those answers. On that morning, Shannon thought that her water had broken. ((Obviously, water can’t break. This term refers to the spontaneous rupture of the amniotic sac surrounding the baby.)) Our morning plans quickly changed into waiting to see what would happen. Was she feeling any contractions? Was this finally it?

While my wife had been feeling Braxton Hicks contractions for some time, she wasn’t feeling anything else. And after a check by our midwife, it was determined that her water hadn’t broken yet. Another sigh of relief: if she had broken her water, we’d be put on a clock. With no rupture, we had no such rush.

With these false alarms, we began to question just when our son would arrive. He would obviously be after his estimated due date. How far after? It turns out, not long.

At Last

house rules

Among all of the hype and planning as we prepared for our son’s arrival, I was still working. Thankfully, I’m fortunate to be able to work from home. My typical morning involves me waking up next to my sleeping wife, giving her a kiss, and heading across the hallway into my office. In the last couple weeks of pregnancy, she was having difficulty falling back asleep in the middle of the night, so I would occasionally find her awake and laying in bed. Sometimes she’d be reading. Other times, she’d be journaling her day and her feelings.

On the morning of Thursday, December 4, as I began to stir, Shannon looked over at me with a smile. “Are you ready to have a baby?” she asked. Was I ready? We’ve been ready for weeks! What could she mean by that?

“Good, because I’ve been having contractions since 3am.”

What? That’s the past five hours! ((Don’t ask when I get up for work.)) It was looking like the long-awaited day had finally come! If everything went well, we’d be meeting our son that night.

I knew that, once things started moving, our birth team would need to be assembled. But I didn’t want to jump the gun, either. For instance, our photographer doesn’t have to be there at the very beginning; she was there to document our birth story, so she would need to be with us closer to the actual birth. I was not wanting to go too long without any guidance, though. So right away, we made sure to text our midwife for her feedback. Based on everything my wife was feeling, she felt we had some time to go.

As the day progressed into the early afternoon, Shannon was starting to feel stronger contractions. I was doing my best to be supportive, but there was only so much I could do without feeling overwhelmed. So we decided it was time to bring in our doula, Rebecca.

From early afternoon on Thursday through the birth of our son, Rebecca was there supporting us and helping Shannon to cope with her progressing labor. ((Rebecca went home for a short while, so she wasn’t with us continuously, though she was there for us all evening; we definitely appreciated it.)) I know that, without her being there, and the subsequent assistance of Crystal and Rose, that this would have been an overwhelming experience for both of us. ((Not like it wasn’t overwhelming in its own way. But this is definitely an experience best shared with those that are knowledgable and experienced with labor and birth.))

Moving into the evening, it was obvious that it was going to be a long night. Based on how Shannon was progressing, we didn’t see the need to contact Crystal yet. But Rebecca stayed with us. Despite it starting to get dark outside, there was a lot of activity still going on inside. My wife was in a lot of pain from her contractions, which were continuing pretty regularly. The later it got, the more tired we all got. I felt bad that I hadn’t gone through the contractions and was able to get some rest. Meanwhile, Shannon was switching positions between the birth pool and our bed to try and become comfortable. In time, after becoming exhausted from almost 24 hours of labor, she was able to get a little bit of sleep.

shannon birth pool

As we slowly progressed into Friday morning, it became clear that our baby was still a couple of hours away from coming. When it comes to the ‘pushing phase’ of labor, a typical first time mother could spend two hours doing so. ((Of course, each mother and each pregnancy is different and will have its own unique timing.)) Just to be safe, we called up Crystal and had her come by to see how things were progressing. Around 9am, she arrived and began doing some checks of both mom and baby.

Between her various positions, my wife was also occasionally in the bathroom, sitting on the toilet. At 930am, with an audible splash, she finally had her water break. With that having taken place, we knew we were now on our way to seeing our son. Crystal checked to see how dilated Shannon was; she was between 4 and 5 centimeters. At that point, we had hoped that labor would have progressed smoothly and swiftly. We had the birth pool full and warmed up. We just needed to welcome our son into the world.

The Unexpected

We kept our positive view for much of Friday. As the afternoon started to come and the contractions got more painful, we needed to see how well things were progressing. Between her contractions and all of labor, the baby should’ve been moving into position and her body ready to welcome him into the world.

Around 4pm, Crystal did another check of her cervix to see where we were at. Between 5 and 6 centimeters. We weren’t there yet. In fact, in the several hours of painful labor my wife had endured, there seemed to be little progress.

But there was more. Upon inspecting my wife’s progress, she also found a warning sign: meconium. Meconium is essentially baby’s first poop, composed of what the baby has ingested while in the uterus. Normally, this would come out in his first diaper after birth. But it being in the womb meant one thing: he was in some level of distress.

shannon crystal heart beat

Our midwife was also checking our son’s heart rate. While still beating fine, her results were showing that he went from being an active participant to a passive one, despite all of the contractions. Labor requires participation from both mother and infant. For him to not have a fluctuating heart rate at this point in labor indicated that he may not have the strength required for the ‘pushing phase.’

After almost forty hours of labor, we made the call: we’ll beam him out with a  transporter. Sadly, being stuck in the 20th century, we had to go with the more realistic option: transferring to the hospital.  We already had one in mind from prior planning with Crystal, and we made the call early enough that it wasn’t an emergency situation. ((We needed to go, for sure. But we didn’t need to be there within five minutes, nor did we need to get an ambulance.)) Unfortunately, having planned a home birth, we had not packed a bag to take to the hospital. And for some reason, while putting things together, I didn’t think about packing enough for four days. Thankfully, the hospital we went to was only thirty minutes from home.

We arrived at the hospital around 7:30pm. We chose this particular hospital due to their reputation for being pro-natural birth in as much of a way as a hospital can be. Starting around 8:00pm, nurses, doctors, and a hospital midwife hooked Shannon up to several monitors and began tracking how she and our baby were doing. At this point, she had been in labor for 41 hours, with intense contractions for at least half that time. She “opted” for an epidural. [In her words, she “earned” it.]

crystal shannon hospital

At that point, we were still hoping for a natural, vaginal birth. We had gone to the hospital with the goal of still delivering as planned, just with a larger team ready to take care of our newborn once he arrived. Because of our son’s signs of distress, the initial plan was to give my wife Pitocin to speed up the labor process. By this point, though, our son’s heart rate was decelerating. Even if we sped up the process by artificial means, it still could take up to two hours to get through the pushing phase. Would our son have the strength needed to participate in that?

In the end, after careful consideration, we decided that it would be safer to go with a Caesarean section. It wasn’t at all what we had planned but, at this point, it was our best option.

Operation ‘Operation’

shannon hospital hallway crystal

The decision to go with the Caesarean was made before 11:00pm. By 11:15, Shannon was rolled out towards the operating room so they could prep her for the surgery. At 11:30, I was summoned to join her.

Now, this is something that I’m particularly glad about: I could go into the operating room with my wife. When my dad talks about my Caesarean birth, he says how he wasn’t allowed in there. I’m very glad that I could be there with my wife during our son’s birth.

I also was glad that they allowed our photographer, Kelly, to join us. We had originally planned for her to do video of our home birth. However, they would only allow her to take still photos in the operating room. Still, it’s better than nothing and definitely allowed for some great and memorable shots.

The concept of surgery in general has me thinking that it’ll take a long time. So when we were heading to the operating room, I was a bit unprepared when our midwife asked me, “How does it feel to know that you’ll see your son in a few minutes?” A few minutes? It was a question that brought on a surreal moment. He would be here. I remember how long my father’s heart bypass took, and I was expecting this surgery to last for a good amount of time, too. But a few minutes? That was a lot sooner than I was anticipating. And I was excited. And nervous. And everything in between.

me hospital thumbs up

After some minutes in the ‘prep area’, Kelly and I were finally escorted into the operating room. I think it was about 11:45pm at this point. I was put at a seat next to my wife’s head so we could talk. A blue drape was up, preventing us from seeing the surgery from our seated ((Or, in my wife’s case, laying flat.)) positions.

Shannon wasn’t feeling anything that the doctors were doing. I couldn’t see anything from my seated position. All I heard was the idle chatter from the doctors while her and I talked a bit. After a few minutes, the anesthesiologist asked me, “Do you want to see your son being born?”

That was a deep question at the moment. I mean, we had planned for a home birth, so I was prepared to see him be born. I was even ready to catch him in the birth pool. But I wasn’t prepared to see him born surgically. Then again, he’s only born once, so I wanted to see. So after just a couple of seconds, I replied in the affirmative.

“Then you’d better stand up.”

Stand up? Right now? But I’ve only been in the operating room for a few minutes, and I swear that my wife wasn’t cut open when I walked in. Sure enough, I stood up and saw the doctors doing a few clips and then pulling my son out of my wife’s body. That was a lot faster than I expected. And it also was amazing to see and hear him. Shannon, while hearing him right away, would be seeing him real soon.

And there he was. All 7 pounds 11 ounces of him. The doctors brought him over to show him to us briefly before handing him off to be cleaned in the corner of the room. And while he was a totally new being, someone that I had never set my eyes on before, he already seemed familiar. He also wasn’t a huge cryer, likely being worn out from labor, so it was almost like he was glad to be out and in the dry world.

me shannon tiberius hospital operating room

After given the opportunity to clip the rest of his umbilical cord, they finished cleaning him up and wrapped him in a blanket. Then he was back with us. One other thing we both were grateful for: because everything was fine, he never left our sight. After being cleaned and brought over, he was with us for the rest of our time in the hospital. I hear not all hospitals are so baby friendly. We’re glad that the one we chose was. That’s why we chose it, after all.

Moving Forward

As tough as the actual labor and birth process may have seemed, there was more to feel afterwards. It did pain us that we didn’t get the home birth that we originally wanted. We had done everything we could have to avoid a Caesarean. Yet, that’s ultimately what we ended up having to do. And in time, we’ve come to terms with those feelings. And we know that we can always try for those plans again with another child in the future.

Ultimately, we’re glad that Tiberius was born healthy. And over the past few months, we’ve seen him start to develop his personality. We’ve seen him smile. We’ve seen and heard him laugh and giggle. We’ve seen him begin to sit up on his own. And we’ve watched as his first two teeth have started to come in.

We couldn’t have asked for a better baby than Tiberius. He’s the very best, and we love him so very much.

hrach family